Skip to content

Queue pending approvals instead of displacing them - #157

Open
Mydao57 wants to merge 1 commit into
Louis-CFM:mainfrom
Mydao57:approval-queue
Open

Mydao57 wants to merge 1 commit into
Louis-CFM:mainfrom
Mydao57:approval-queue

Conversation

@Mydao57

@Mydao57 Mydao57 commented Oct 2, 2026

Copy link
Copy Markdown

Problem

With several agents in parallel, a second PermissionRequest displaced the first one: ask was written to its socket and it fell back to its terminal, so the user lost track of requests.

Change

  • New ApprovalQueue (pure value type): FIFO, cap of 5, per-request matching.
  • Each queued request keeps its own fd, disconnect source and 115 s timeout (started at arrival). A disconnect or timeout removes only that entry, silently.
  • Beyond the cap, the newest request gets ask and an nbLog line, like the old displacement.
  • The approval card shows "1 of N" when several are waiting, plus the agent name when they come from different sessions or agents. Nothing else is restyled.
  • A decision only applies to the request that was drawn on the card (id check), and is never carried over. A request whose socket is already dead is dropped before display and before writing.
  • "Handled in Cursor/Codex/VS Code" now matches the specific request (session + agent, plus tool and input for PostToolUse) instead of the pill alone.
  • The island stays held open while the queue is non-empty and releases as before when it empties.

Testing

  • bash scripts/test-approval-queue.sh (FIFO, removal of head and non-head, cap, per-session matching).
  • Debug build passes with no new warnings. Tried locally with several simulated PermissionRequests on the socket.

Known limits

  • The fd liveness probe narrows but cannot fully close the window between the check and the write.
  • A non-head request that expires does so silently (the counter drops).

macOS only.

🤖 Generated with Claude Code

Each PermissionRequest keeps its own fd, disconnect source and 115 s
timeout. FIFO with a cap of 5 (the newest gets ask beyond it). The card
shows '1 of N' when several are waiting. Decisions only apply to the
request shown on the card, and dead sockets are dropped before display.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Mydao57

Mydao57 commented Oct 2, 2026

Copy link
Copy Markdown
Author
approval-queue

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant