Repository navigation
fix(codex): steer a running turn over codex-acp's _session/steering - #14115
Conversation
|
Intent: make Steer on a codex session reach the running turn, using codex-acp's own |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify a live composer steer on a real codex session (the PR's own dashboard run was blocked by the test host) before relying on delivery. Suggestions
[DESIGN-REVIEWED] eb59e97 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify on live codex-acp 1.11.0 the two measured claims the design rests on: reject cancels the turn dropping injected text; What this change shipsInventory (10 items) — 10 justifiedIntent: a dashboard-composer steer on a codex session reaches the running turn, and one the turn drops is requeued, not lost — a FIX.
[FIRST-PRINCIPLES-REVIEWED] eb59e97 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
f460f69 to
f022a3c
Compare
|
self-added: yes
|
|
self-added: no
|
|
self-added: no
|
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
f022a3c to
02454b3
Compare
|
self-added: yes
|
|
self-added: yes
|
|
@iamwhatever @chenmingwei23 could one of you rule on the fenced GPT finding here? It blocks the PR and only a repository writer's override can clear it. The lane has raised the same thing twice, on the round-1 head and on this head: when codex has not answered a steer within 10 s, the handle returns True ("accepted, delivery open"), which is how the default kiro-cli steer already behaves. The alternative the lane proposes, returning False, was this PR's first shape. It caused a double run on a late If you would rather have the bound removed or handled differently, say how and I'll change it. |
02454b3 to
93286b5
Compare
|
Removed the dashboard lost-steer recovery in 19f7490 and documented the limit it tried to cover. Asking maintainers to accept that limit. Why: across five review rounds, GPT found an upheld race in that recovery path each time: the metadata restore, the row state, redaction collisions, the text-keyed maps, and on 5925996 both an interrupted loss report and a hard kill requeuing discarded steers. Each fix added state that the next finding lived in. So this push takes the recovery out rather than patching it a sixth time. The limit: if a codex turn settles a user's steer and a tool approval later in the same turn is denied, codex cancels the turn and drops the injected text, and Kiro Crew does not recover it. After a denial, nothing later in that turn settles, so a steer still in flight is queued rather than lost. The limit is stated in the What stays is the part the reviews did not dispute: codex steer over Removed: Checked locally: the 269 steering, requeue and subagent tests pass, 13,139 backend tests across the affected files pass, and mypy, the agent-SDK boundary, comment-history and docs lint are clean. @iamwhatever @chenmingwei23, does the documented limit work for you? The alternative is a stronger delivery guarantee from codex-acp itself, for example a steering-consumed notice, which I can file upstream. |
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
Re-triggered: the GPT, Opus, Security Scope and Internal Content Scan lanes on d15c1a9 ended with no verdict at 00:32 UTC, right after the CI app's API rate limit (403 at 00:31). Every other check on that head passed. 37fd7ea is the same change rebased onto current main (8ab7636), with no code change. |
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
Replies to the GPT review of issue (blocking): steer settlement reverses transcript ordering ( issue (blocking): a later denial drops a steer already reported consumed ( |
|
Reply to the GPT review of issue (blocking): a later approval denial loses an already-settled steer ( |
|
@Pearcekieser has accepted the documented limit of codex steering for this PR. When an approval in a codex turn is denied, including an automatic host or policy denial, a steer the turn already settled is lost with the cancelled turn and its transcript row still shows "consumed". The limit is recorded in the Dispositions for the reviews of GPT, issue (blocking): a later approval denial loses an already-settled steer ( Opus, issue (blocking): a codex steer settles as consumed after a plain Opus, suggestion (non-blocking): the Opus, suggestion (non-blocking): bound |
|
A codex steer now counts as consumed only when its turn ends cleanly.
|
|
Replies to the GPT review of issue (blocking): settled steer text bypasses the retention cap ( suggestion (non-blocking): pin suggestion (non-blocking): the |
|
Reply to the GPT review of issue (blocking): cancellation can erase a consumed steer from the transcript ( PR Hygiene and Fork PR Description: the description now has the template's Backend Tests shard 3 on |
|
|
|
Rebased onto current main ( The only conflict was one row in The 112 codex steering and requeue tests pass on |
|
A new parametrized test, Four other red checks on
|
|
Parking this PR at Settlement edge cases found so farEach line gives the head that exposed the case and what happened to it.
Why the class keeps recurringEvery case above comes from the same shape. The steer's only durable trace, its transcript row, is written at the end of a hand-off between three in-memory owners: the steer RPC caller, the ACP reader loop, and the chat runner's pending list. Each pair of owners has its own ordering and cancellation windows. Each fix closed one window and moved the risk to the next one. A simpler modelPersist the steer's transcript row, in a new "sent" state, before the steer is injected into codex. After that, every later event only changes the state of a row that already exists:
No in-memory hand-off holds the only copy of the steer, so no cancellation or teardown window can lose it. Cases 1, 2, 3, 7, 10 and 12 disappear as a class rather than one at a time. Cases 4, 5, 6 and 9 are about ordering and bounds on the codex wire, and they stay as they are. What the simpler model costs
Where that leaves this PRThis PR stays open at |
|
Un-parking with a fix for the last open GPT finding on GPT's fix, emitting consumption only after the steering caller has returned acceptance, is taken, without making the terminal wait on the caller (the stall the adjudicator warned about):
Tests: The skill-size and Frontend (2) / Electron Shell / Coverage Gate reds noted on the previous round are inherited from main, as before. |
codex sessions offered the steer/queue split but every steer fell back to the queue: the handle only spoke kiro-cli's _session/steer. Speak codex's own request on the shared runtime, read its outcome as the delivery evidence, and keep deny notices on the recovery continuation.
|
Rebased onto current main with no code change ( GPT 5.6 and Opus 5 both passed on a4049c4. The only reds were inherited: |
|
@iamwhatever @chenmingwei23 |
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed on behalf of the maintainers (sweep 2026-09-28): readiness passed, required checks green on eb59e97, no blocking review threads, security posture unchanged. Approving and merging.
Problem / Motivation
Goal: On a codex session, a steer sent from the dashboard composer reaches the running turn, and a steer that turn does not keep is queued instead of lost.
On a codex session the busy composer offers Steer and Queue, but Steer never steers. Every steer the user sends lands as a queued message and runs only after the current turn ends. The same holds for a steer from Side Chat, the messaging channels and
spawn_steer; this PR fixes the dashboard composer, and those three keep queueing on codex (see below).Why it matters
A user correcting a codex turn mid-flight ("stop, use the other file") waits for the wrong work to finish before the correction reaches the model. The UI gives no sign the steer was downgraded.
Not a goal
spawn_steeror a peersession_send: those keep queueing on codex._session/steerpath andsteering_consumedecho are unchanged.What changed (motivation → approach → change)
Steer depends on
supports_steer, which readACP_BACKENDS_STEER, and that set names only the kiro-cli family because the handle speaks only kiro-cli's_session/steer. codex-acp 1.11.0 has its own verb,_session/steering. Driven live, it answersinjectedwhen a turn is running andstartedNewTurnwhen none is (then running a turn of its own), and it sends nosteering_consumedecho.session/cancelstops that adapter-owned turn and the next prompt runs normally.A new set,
ACP_BACKENDS_STEERING_REQUEST = {codex}, turns onsupports_steerfor the shared-runtime session handle. The handle sends_session/steeringthrough a newAcpRuntime.send_request_for_answer, off the session queue, and waits for the answer or for the aimed-at turn to end, with no timer. The answer is registered with that prompt before the write can suspend, and the turn's dispatch loop checks it ahead of every frame:injectedyieldsEVENT_STEER_CONSUMED, so the existing settle path marks the steer delivered, but only at a frame that is not the turn's terminal while nothing is buffered behind it on the session queue. The reader resolves answers and routes the terminal one line at a time, so only there is it certain the answer was read first; near the end of a turn nothing settles.steer()returns True only after that settlement.startedNewTurnsendssession/canceland reports undelivered. Because the cancel names no turn, a new prompt first waits up to 5 s for answers still owed from the last turn and for the cancels they schedule; an answer still missing is forgotten and replaced by onesession/cancel, so an adapter-owned turn is stopped before our prompt is written.failed, an error, a malformed answer, or the turn ending first report undelivered, and the caller queues the text. At most 16 steers are held unsettled, counting answers still awaited after their turn ended (kept so a latestartedNewTurncan be cancelled), each at most 64,000 characters; past that the steer takes the queue path.destroydrops the runtime's registration of any answer the session still holds (AcpRuntime.forget_request). The mid-turn steer line on the backend card reads either set.Delivery is at-least-once. codex-acp orders the steering answer against the prompt's terminal in no way and sends no consumption echo, so an
injectedanswer read after the terminal, or in the same read as it, leaves the steer queued too, and it runs a second time as its own turn. That is the requeue path's existing trade (a visible duplicate over a silent loss); the late answer is logged so the window can be measured.No codex steer is sent while the turn waits on an approval: codex answers it
injected, but its only reject option cancels the turn and drops the steer, so the steer is queued for the next turn instead. A codex steer that was accepted is still dropped if a later approval is denied or the turn is cancelled, because codex's reject andsession/canceldiscard injected text with the turn. Sosteer()returns True once codex answersinjected(accepted, not consumed), and the turn reports the steer asEVENT_STEER_CONSUMEDonly when it ends cleanly, with no denied approval, no cancel and no refusal (_release_proven_steers), and only once that steer'ssteer()call has returned True. The composer writes the steer's transcript row synchronously on that return, so a consumption report never clears a pending entry whose row does not exist yet; a steer still suspended in its write at the terminal is left pending and queued by the teardown. On any other ending nothing is reported, and the composer's pending entry is queued by the turn's teardown, so the steer runs again as its own turn instead of being lost. The wait for codex's answer is bounded at 8 s (_STEERING_ANSWER_WAIT_SECS), below the browser's 10 s send abort, and a slower answer takes the queue path. Because only the composer keeps such a pending entry, codex steer is limited to the dashboard composer: the newsteer_needs_loss_recovery(declared onLLMProvider, overridden byAcpProvider,AcpSessionProviderandAcpClient) makesAcpProvider.supports_steerFalse andAcpProvider.steerrefuse, which keeps the messaging channels and Side Chat on their queue paths for codex, andspawn_steer(subagent_manager/continuation.py) refuses withsteer_unsupportedin favour ofmode='follow_up'. A peer'ssession_sendinto a codex session is refused the same way inchat_delivery.steer_into_running_turn(user_origin=False), so it falls back to the queue and only the session's own composer steers codex. An earlier revision of this PR requeued already-settled steers from the dashboard; review found five successive races in that recovery path, so it was removed. Deferring the consumed report to a clean turn end lets the existing teardown requeue cover the denial and cancel cases instead.Where it lives: the set in
agent_sdk/backends.py(re-exported byacp_backends.pyandacp/types.py) and the card line inagent_sdk/backend_cards.py; the verb inacp/session_handle.pywith its transport inacp/runtime.py;supports_refusal_steeronacp/client.py,acp/session_provider.py,providers/acp.pyandproviders/base.py; its two readers indeny_notice.pyanddashboard/chat_runner.py. The harness-parity spec's H6 row (docs/system-specs/modules/harness-parity.md) andharness-onboarding.mdname both steer tables and the user/refusal split, andmessaging.mdandcommon/injected-messages.mdname the deny-notice gate assupports_refusal_steer.Backwards compatibility
Compatible: kiro-cli and KAS steers take the same path as before, and every other backend still reports no steer. The one new provider property defaults to False.
Tests
test/test_codex_steering_request.py(new): each answer outcome (injectedsettles through the echo,startedNewTurncancels and is undelivered,failedand error answers are undelivered), no request without a running turn, an unanswered steer undelivered once its turn ends (a latestartedNewTurnstill cancelled), malformed answers undelivered without raising, the count and size bounds, a cancelled caller releasing its slot, answers awaited past their turn sharing the bound and dropped ondestroy, the terminal-before-injectedorder reporting undelivered, a latestartedNewTurncancelled before the next prompt is written, an answer that never arrives forgotten and cancelled before the next prompt, an answer for an earlier prompt never settling a newer one, aninjectedanswer read in one buffer with the terminal, in either order, queued rather than settled, aninjectedanswer never settled at the terminal or with frames buffered, an answer read while the steering write is still draining settling at the next non-terminal frame before the turn completes, through the real reader and dispatch loop, no late cancel once our next prompt runs, a steer against real turn state, no request while the turn waits on an approval, a failed cancel logged rather than raised, nothing reported consumed after a denied approval on codex (and a kiro denial leaving settling on), a steer proven mid-turn not reported consumed when the turn is then denied or cancelled (through the real reader and dispatch loop), an answer slower than the send-request bound queued, a steer cancelled after it was proven never reported consumed, proven steers counted toward the retention cap,ACP_BACKENDS_STEERING_REQUESTpinned to codex, the kiro verb unchanged, andsend_request_for_answerresolving off the session queue.test/test_steer_requeue.py:TestPeerSteerOnCodex, a peer steer into codex refused before any RPC while the composer still steers.test/test_subagent_continuable.py:spawn_steerrefuses a codex run withsteer_unsupported.test/test_codex_steering_request.pyalso covers the provider wrapper refusing a codex steer while still steering kiro.test_acp_codex_harness.py,test_harness_parity.py: codex advertises user steer but not refusal steer, and the tables stay the source of both answers.test_refusal_inband_notice.py,test_messaging_driver.py,test_slack_handler_coverage.py: the doubles gainsupports_refusal_steer, since the deny paths now read it.Manual verification
Drove codex-acp 1.11.0 over stdio:
_session/steeringduring a prompt returned{"outcome":"injected"}in 10 ms; with no prompt running it returned{"outcome":"startedNewTurn"}and started a turn;session/cancelthen stopped it and a followingsession/promptran toend_turn. A dashboard run was not possible on the test host: codex sessions refuse to start there without a sandbox backend, and the model call is denied by an account policy.Related Issues
Fixes #14114
Pattern harvest
Not generalizable: the defect is a missing per-harness verb, and the harness-parity checks already gate steer by table membership rather than harness identity.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)