Repository navigation
Conversation
ymichael
force-pushed
the
bb/6966-close-approval-cards-the-agent-withdraws-thr_y24w76r9m4
branch
2 times, most recently
from
November 18, 2026 21:25
baf709f to
fc951a9
Compare
When a provider stops waiting on a request it raised (a Claude
PermissionRequest hook answered it, Codex resolved it itself, a Pi dialog
timed out, an ACP or Pi session ended), its bridge dropped the request
locally and told nobody, so the card stayed pending and held back the
thread's next message.
Bridges now send notifications/cancelled { requestId } for every
interaction/request they stop waiting on (Claude, Codex, ACP, Pi). The
runtime aborts the matching interactive request, the daemon waits for
registration to settle and posts the new
/session/interactive-request/withdraw route, and the server closes the
interaction as interrupted without overwriting the item the provider
settles itself. A turn that ends with a call still waiting for approval
no longer shows it as waiting.
HOST_DAEMON_PROTOCOL_VERSION 268 -> 269; plugin SDK 0.6.159 -> 0.6.160
for BRIDGE_NOTIFICATION_METHODS.requestCancelled.
Fixes #6966
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ymichael
force-pushed
the
bb/6966-close-approval-cards-the-agent-withdraws-thr_y24w76r9m4
branch
from
November 18, 2026 22:44
fc951a9 to
2cf5a4a
Compare
ymichael
deleted the
bb/6966-close-approval-cards-the-agent-withdraws-thr_y24w76r9m4
branch
November 18, 2026 22:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
A provider can stop waiting on a request it raised: a Claude
PermissionRequesthook answers it and the SDK aborts thecan_use_toolrequest, Codex sendsserverRequest/resolved, a Pi dialog reaches itstimeout, or an ACP/Pi session ends with a permission open. In each case the bridge dropped its local waiter (Claude'sonAbortonly answereddenylocally; Codex ignoredserverRequest/resolved) and nothing reached the runtime, daemon, or server. The interaction row stayedpending, so the card stayed up and every later message queued behind it (#6966). The wire had no way to say a request was withdrawn:notifications/cancelledexisted only for ACP tool calls, and the server only closed interactions per thread (provider exit) or on reconnect.Pointed at by T3 Code's fix for the same bug, pingdotgg/t3code#27320.
What changed
BRIDGE_NOTIFICATION_METHODS.requestCancelled(notifications/cancelled { requestId }) now coversinteraction/requestas well as tool calls. Every bridge that stops waiting sends it:serverRequest/resolvedfor a request bb has not answered, plus child exit and session release. These apply to forwarded tool calls too.cancelPendingPermissions, which covers stop, release, steer cancel, policy change, and agent exit.timeoutand session close/replace.RuntimeToolCalls→RuntimeProviderRequests, also used for interactive requests.onInteractiveRequest(request, signal)gets an abort signal. A withdrawn request is never answered.InteractiveRequestRegistry.registerAndWait(request, signal)rejects a withdrawn wait. Once registration settles, it reports the withdrawal through the existing retrying interrupt queue to a newPOST /session/interactive-request/withdrawroute, so a withdrawal that races registration cannot leave a row behind.interruptWithdrawnProviderRequestcloses the matching row asinterruptedwith the reason "The agent stopped waiting for this answer". The next queued message then dispatches. It writes the lifecycle record but not the approval'sitem/completed: interrupted. Writing that item made the projection drop the real result Claude sends after the hook allows the tool; the first live re-run caught this.thread-view): a call that its turn ends without settling no longer keepsapprovalStatus: waiting_for_approval(ininterruptPendingToolMessages,event-projection-state.ts). This affects a provider that withdraws and never settles the item.withdrawPendingQuestions(bb answers on its own when a new prompt starts) now also aborts the forwarded request, so that card closes too. Codex and Pi keep Never report a failure as the user's answer to an agent #7723's unanswered-interaction warnings and add the withdrawal on top.HOST_DAEMON_PROTOCOL_VERSION268 → 269 (new route). Plugin SDK 0.6.160 → 0.6.161 (newBRIDGE_NOTIFICATION_METHODSkey, bridge-grammar snapshot). Docs:docs/provider-bridge-protocol.md,docs/provider-plugin-api.md.withdraw_approval, and the fake Codex app-server getswithdrawAfterMs.How you verified
Live repro, before (origin/main 502cf5a,
pnpm start:worktree, claude 2.1.325). I used a project.claude/settings.jsonPermissionRequesthook (matcherBash) that returnsallow, and aclaude-codethread inaccept-editsthat runs two unsandboxedcurlcommands. Both commands completed (HTTP/2 200) and the turn finished withDONE.. Then:Same steps, after:
I also stopped a thread with a genuinely pending approval (no hook). The card closed and the command row shows
interruptedwith no lingering "waiting for approval".After rebasing onto #7754 (timeline rows rebuilt from item records) and #7723, I re-ran both live cases. The hook case shows both commands
completed, exit 0,HTTP/2 200,approvalStatus: null, both cardsinterrupted, and the follow-up dispatched. The stop-while-pending case shows the cardinterruptedand the command rowinterruptedwith no approval state.Tests:
tests/integration/fake/smoke/withdrawn-approvals.test.ts, full server + daemon + runtime + scripted bridge. The card closes, the row is not left waiting, and the follow-up message dispatches.serverRequest/resolved(no late answer reaches Codex), ACP stop, Pi timeout/answer/close.expected [ { id: 'pint_nk2fcgcggg', … } ] to deeply equal []. Without the projection change, the thread-view test fails.pnpm exec turbo run typecheckandtestpass for@bb/agent-runtime,@bb/host-daemon,@bb/server,@bb/host-daemon-contract,@bb/provider-bridge-protocol,@bb/provider-bridge-acp,@bb/thread-view, the Claude, Codex, and Pi plugins, and the scripted-echo bridge.lintpasses on the touched packages.Fixes #6966
🤖 Generated with Claude Code