Skip to content

fix(codex): stop counting a request as working once it is answered - #863

Closed
baxen wants to merge 1 commit into
baxen/agent-local-typingfrom
baxen/codex-final-ends-turn
Closed

baxen wants to merge 1 commit into
baxen/agent-local-typingfrom
baxen/codex-final-ends-turn

Conversation

@baxen

@baxen baxen commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

What

Codex doesn't end its turn when it sends a reply with final: true. It makes one more model call that returns nothing, then ends the turn about 3s later. That call is visible in the #buzzin-in-secret rollouts. Until now, the request's workingUntil handoff settled only when the turn ended, so the agent's working reactions and typing (#860, #861) lingered past its reply.

The handoff now settles as soon as a final send succeeds. That covers every request the turn has taken in by then: the first one and each steered follow-up. A follow-up steered in after the send keeps counting as working until its own answer.

Why not end the turn

Claude Code ends its turn on a final send through a hook. The Codex app-server has no matching option, so the only way to end the turn is turn/interrupt. Codex then writes a <turn_aborted> note into the session after every reply: "The user interrupted the previous turn on purpose…". The model would read that note on every later turn, and live.mjs already asserts that ordinary final sends leave no such note. So the turn still ends by itself, and only the "working" signal moves. That extra model call still happens; it is cheap, with cached context and no output.

Validation

  • vitest run src/bundled/codex src/bundled/claude-code src/features/agents2 src/features/relay/typing: 218 tests pass. tsc --noEmit is clean.
  • Tests:
    • A final send settles the handoff while the turn is still running.
    • When a follow-up is steered in after a final send, only the first request settles.
    • Each request steered into a turn settles at that turn's answer.
    • With the answered() call removed, the first two tests fail.
  • Not yet done: a native run.

🤖 Generated with Claude Code

Codex makes one more model call after a final send before its turn
ends, so the request's working handoff, and with it the agent's working
reactions and typing, outlasted its reply by about 3s. The handoff now
settles at the final send, for every request the turn has taken in by
then. The turn itself still ends on its own: interrupting it would leave
a <turn_aborted> note in Codex's history after every reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bradley Axen <baxen@squareup.com>
@baxen

baxen commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 Folded into #860 (show agents working) to keep the merge stack small. Branch kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant