Skip to content

bug(chat): one held tool call streams its approval card twice, and the resume stream sends it a third time #21751

Closed

Description

@mrveiss

Problem

When the chat graph holds a tool call, the SSE stream carries the same approval card twice, with two different message ids. The resume stream then carries it a third time.

Live install, 2026-11-18 (46a8943282), one held click call:

"id": "457ad4b2-...", "type": "command_approval_request", "content": "Click the anchor/link element", ... "calls": [{"tool": "click", "params": {"selector": "a"}}]
"id": "9c6ff835-...", "type": "command_approval_request", "content": "Click the anchor/link element", ... "calls": [{"tool": "click", "params": {"selector": "a"}}]

The same pair appeared on another chat's held call, and its POST /chats/{id}/resume stream opened with a third copy of the card.

Where

  • autobot-backend/chat_workflow/graph.py request_approval: stream_cb(approval_request) ("emitted before the interrupt"), then interrupt(approval_request).
  • autobot-backend/chat_workflow/turn_control.py stream_graph_turn: after ainvoke returns, for intr in result.get("__interrupt__") puts intr.value on the queue again.
  • On resume, LangGraph re-runs request_approval from the top, so the stream_cb line fires again before interrupt() returns the decision.
  • _to_message gives each emission a fresh id, and ChatController.ts (~L469) handles each command_approval_request as its own message.

Not established: whether the chat UI renders two (or three) approve/reject cards for one hold. Rendering was not observed; the stream was read through the API.

Acceptance criteria

  • A held turn streams exactly one approval card for one interrupt, and the resume stream re-emits none (test counting command_approval_request events on both streams).
  • Host evidence: one held call on a live install shows one card in chat.

Related: #19957, #19951 (one hold → one approval record), #13421.

Activity

  1. added
    bugSomething isn't working
    phase:M2.7Approvals and board controls take effect
    on Nov 18, 2026
  2. mrveiss commented on Nov 18, 2026

    @mrveiss
    OwnerAuthor

    The fix is in #21749: request_approval no longer streams the card itself, the card carries a stable per-plan id, and the resume stream carries no card. It is pinned by a test through stream_graph_turn that counts exactly one command_approval_request across the initial run and the resume. The host-evidence AC is still open until it is deployed.

  3. mrveiss commented on Nov 18, 2026

    @mrveiss
    OwnerAuthor

    Witness from before the fixes, cause not established: in a live chat on the local install on 2026-11-09, two user turns sent 23 s apart both ran in full. Their replies arrived 7 and 13 minutes later, and navigate was held for approval both times. The logs for that day have rotated, so they cannot show whether the two holds were one interrupt emitted more than once (this issue) or two turns each holding its own call. Recorded as a sighting only; the acceptance criteria are unchanged.

  4. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    Landed in #21749, merge 80870f228d

  5. mrveiss commented on Nov 19, 2026

    @mrveiss
    OwnerAuthor

    AC check against main at 80870f228d (merge of #21749). This stays open: the host-evidence AC needs a deploy.

    AC (verbatim) Evidence on origin/main Ticked
    "A held turn streams exactly one approval card for one interrupt, and the resume stream re-emits none (test counting command_approval_request events on both streams)." tests/unit/chat_workflow/test_held_call_stops_turn_19951.py:208-230 test_through_the_turn_stream_exactly_one_card_reaches_the_client runs stream_graph_turn for the initial and the resumed stream. It asserts one command_approval_request across both and none on resumed. Frontend dedupe: ChatController.approvalCard.test.ts:49-59 ✅
    "Host evidence: one held call on a live install shows one card in chat." Needs host evidence after deploy. #21749 is not deployed yet; the install runs 96241c46d5 ❌

    Remaining: host check after deploy. Ticked 1 of 2.

  6. mrveiss commented on Nov 20, 2026

    @mrveiss
    OwnerAuthor

    Deploy status, 2026-11-20: the local install now runs 13685f3999, which is current main. It includes the merges of #21749 (80870f228d) and #21888 (f559d8c0a7), verified with git merge-base --is-ancestor.

    Host evidence: none gathered yet. The live chat check is paused until the owner decides how the test logs in, because credentials come only from the secrets manager. No AC is ticked from this deploy.
    Remaining: host AC: one held call on the live install shows one approval card.

  7. mrveiss commented on Nov 20, 2026

    @mrveiss
    OwnerAuthor

    Live check on the local install at 13685f3999, 2026-11-20 21:26–21:35 Riga. The login question is resolved, but this run's two turns (navigate, then web_search) did not exercise this issue: neither tool was held for approval, so no approval card was produced. No AC is ticked. Next: a live turn that holds a tool call, such as a shell command needing approval.

  8. mrveiss commented on Nov 21, 2026

    @mrveiss
    OwnerAuthor

    Live check on the local install at d08333f564, 2026-11-21 03:42–03:45 Riga. A new chat asked to run uname -r (execute_command), then a follow-up was asked in the earlier two-turn chat.

    Still not exercised. uname -r was pre_approved (Auto-approved (safe risk)), so no approval card was produced. The next run needs a command that is not rated safe.

  9. mrveiss commented on Nov 21, 2026

    @mrveiss
    OwnerAuthor

    Live check on the local install at 7657af8cb986 (includes #21911, not #21954), 2026-11-21 11:13–11:16 Riga, chat 46a8048a. Still reproduces.

    • The touch command (MEDIUM risk) stores two command_approval_request entries, at 11:15:55.384 and 11:15:55.457.
    • The resume stream sends a command_approval_request again, followed by approval_waiting and approval_still_pending.
    • A related and worse problem is filed separately: approving the card does not run the command.
  10. github-actions commented on Nov 21, 2026

    @github-actions
    Contributor

    Landed in #21964, merge f349aa78ca

  11. mrveiss commented on Nov 22, 2026

    @mrveiss
    OwnerAuthor

    Live check on the local install at a2384694b9f0 (includes #21964), 2026-11-22 02:18–02:28 Riga, chat 1c825dfd, request "Run the shell command touch /tmp/autobot_livecheck_21959 in the terminal". Host AC ticked.

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

    backendbugSomething isn't workingphase:M2.7Approvals and board controls take effect

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions