Repository navigation
Conversation
A message that is not from the user (another thread's tell, a system notice) resolves to permission escalation "deny". bb steered it into the running turn with those options, so a turn the user started lost its approvals mid-flight: Codex interrupted the turn to apply approvalPolicy "never", and runtime-enforced bridges such as Pi auto-declined the turn's later approval requests without asking. The dispatch checkpoint now queues a deny-escalation message behind a running "ask" turn (thread-busy), so it runs as its own turn afterwards, in order, with its own permissions. As a backstop the runtime never lets a steer lower the running turn's escalation, and it logs every approval request it declines without asking, with the reason and request/turn ids. Fixes #7040 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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 message that isn't from the user (another thread's
bb thread tell, a child-outcome system notice) resolves to permission escalationdeny. When it arrived during a turn the user started, the dispatch checkpoint steered it into that turn with thosedenyoptions. The steer overwrote the running turn's permissions. Codex's bridge saw changed permission settings and interrupted the active turn to restart it withapprovalPolicy: never, so the step that needed approval was aborted and no prompt appeared. Runtime-enforced bridges that inject steers without restarting (Pi) kept running the user's work whileruntime.steerTurnsaveddenyas the thread's options, so later approval requests in that turn were declined before any interaction was persisted. ACP cancels the prompt on a steer and reruns with the steer's options, which has the same effect. On main I reproduced it live with real Codex in Accept Edits, 2 of 2 times: a turn ransleep 20and then wrote outside the workspace, a sibling sent "FYI, my build finished" during the sleep, and Codex replied "Step 1 was interrupted… Step 2 did not run, and no approval was requested". No file was written. #7040What changed
dispatch-attempt.ts,thread-events.ts): the dispatch checkpoint gets a new core wait. Ajoin-turnattempt whose author resolves todenywaits onthread-busywhen it would join anaskturn (one the user started or steered) whose main run is working. The existing queue keeps order and author, so each queued message runs afterwards as its own turn with its own permissions. A newgetActiveTurnInitiatorreads the initiator of the active turn's latest accepted input, or of the latest request while the turn is still starting. Each deferral is logged at info with the thread, initiator and sender. Non-user messages still steer into non-user turns, and user messages still steer into any turn.runtime.ts,execution-options.ts): this is a backstop for any steer that still arrives.steerTurnnever lowers a running turn's escalation fromasktodeny(keepRunningTurnApprovals), so the provider isn't told to drop approvals and the runtime gate keeps asking. This differs from the proposed "fixed copy". A strictly fixed copy would also stop a user steer from raising adenyturn toask. On main that raise works: Codex restarts the turn with on-request and Pi's gate flips to ask. Freezing it would bring back the same silent decline the other way round.runtime-provider-requests.ts): every approval request the runtime declines without asking now logs a line with the request id, turn, thread and reason (denyescalation or no handler). Command contents aren't logged.approve:<kind>in steer text). Steer-mechanics tests for system notices (limiter, held notice, pending question, offline host, coalescing, recovery, turn-starting parking) now seed a non-user running turn, which keeps them testing those mechanics. There is a new system-notice test for the user-turn case.HOST_DAEMON_PROTOCOL_VERSIONor SDK bump.Behaviour change to note: a manager thread whose current turn the user started now gets child notices after that turn ends instead of mid-turn. That is the queueing #7040 asks for, and it is what keeps the user's approvals.
#7538's busy-answer/re-send layer is not reintroduced. Nothing is refused, so nothing needs re-sending.
How you verified
dispatcher-paths.test.ts: three agent tells during a user turn all queuethread-busyand then run as three separatenew-turnagent turns, in order. Control: an agent tell into an agent-started turn still steers.runtime.interactive-requests.test.ts: anaskturn steered withdenyoptions still routes the next approval to the user. A declined approval logs its reason.system-notice-dispatch.test.ts: a child-completed notice waits behind a user turn and then runs as its own system turn.pnpm exec turbo run test lint typecheck --filter=@bb/server(4503 passed), andtestfor@bb/agent-runtime(315),@bb/host-daemon(915) and@bb/templates. Typecheck and lint pass for agent-runtime, templates and the scripted echo provider.pnpm start:worktreeinstance:sleep 20ran fully, and an approval prompt appeared. After approval Codex said "Both steps completed in order" and the file was written. The notice then ran as its own agent turn, which completed.sleep 90turn all queued. The turn finished with "done", then the 7 notices ran as 7 separate completed turns in order (Notice 1…7). The thread endedidle, the queue was empty and no errors were recorded.denyprompt mid-turn.Fixes #7040
🤖 Generated with Claude Code