Skip to content

Queue approval requests instead of replacing the open one #790

Closed

Description

@EVWorth

Severity: P1. A click can approve a statement the user never read.

What happens

The mock serialises approval requests (src/dev/mock/handlers/agent.ts, ask() chains on queue), so ?mock=connected cannot show this. The real path does not:

  1. An agent (in-app or on the MCP endpoint) calls run_write, and the approval dialog opens with statement A.
  2. While it is open, a second run_write (a parallel tool call, or another client) arrives with statement B.
  3. The dialog's SQL, row count and connection change in place to B. A user who read A and clicks Apply approves B.
  4. Request A is never answered. Its transaction stays open until DECISION_TIMEOUT, and its agent stays blocked.

Cause

  • src/stores/agentStore.ts:193: showApproval: (approval) => set({ approval }) overwrites.
  • src-tauri/src/mcp/window.rs (approve → bridge.ask) does not serialise approval asks.
  • src/components/agent/ApprovalDialog.tsx:57: the dialog is not keyed on the request id, so the swap happens inside one mounted dialog.

Fix

Hold approvals in a FIFO queue in the store, show the head, and say "1 of N" when more are waiting. Key the dialog on approval.id so each request remounts it.

Part of #783.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. added a commit that references this issue on Oct 21, 2026
    e588cef
  3. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions