Repository navigation
state: a turn ending is not an idle session - #9
Merged
Merged
Conversation
The pane dropped out of the tree and onto the idle screen between turns,
showing a summary of a run from earlier while the work it was opened to watch
carried on underneath. Attaching to a background job session and watching it
do nothing visible for minutes at a time is what this looks like from the
outside.
`{"type":"system","subtype":"turn_duration"}` was mapped to SessionIdle.
parse.go called it a hint in a comment and the machine treated it as a state,
and the session state decides a whole-layout swap: idlePhase sends an idle
session to renderIdleFrame before anything else gets a say.
The two claims are not the same. The registry saying `status:"idle"` means
that CLI process is waiting for a human. A turn ending means main stopped
working, and a background job ends turn after turn with no human anywhere
near it.
Measured on one such session: 40 turn ends, and the gap from each to the next
tool call had a median of 125 s, a p90 of 627 s and a maximum of 2.5 hours.
Two of the 39 gaps were under 30 s. So this was not a flicker to debounce; it
was the pane spending most of a working session on a summary screen.
So the transcript emits TurnEnded, and only the registry idles a session.
Replaying that session's whole transcript now flips into the idle screen zero
times, where the old mapping did it once per turn end.
A turn end still settles the run, which is the thing it is genuinely evidence
of, so checkRunEnd takes it as an alternative to idleness rather than losing
the trigger: gating run-end on idleness alone would leave a background job's
runs open forever. It still waits for the run's agents to land, exactly as the
idle path does.
The agent-file case is unchanged and still emits nothing: a subagent's own
turn ending is not the session's.
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.
The pane dropped out of the tree and onto the idle screen between turns, showing a summary of a run from earlier while the work it was opened to watch carried on underneath. Attaching to a background job session and watching it do nothing visible for minutes at a time is what that looks like from the outside.
The mapping
{"type":"system","subtype":"turn_duration"}was mapped toSessionIdle.parse.gocalled it a hint in a comment and the machine treated it as a state, and the session state decides a whole-layout swap:idlePhasesends an idle session torenderIdleFramebefore anything else gets a say.The two claims are not the same:
status:"idle"means that CLI process is waiting for a humanWhy it isn't a debounce
Measured on one live background job session, gap from each turn end to the next tool call:
Not a flicker. The pane was spending most of a working session on a summary screen.
The change
The transcript emits
TurnEnded; only the registry idles a session. Replaying that session's whole transcript now flips into the idle screen zero times, against once per turn end before.A turn end still settles the run, which is what it is genuinely evidence of.
checkRunEndtakes it as an alternative to idleness rather than losing the trigger, since gating run-end on idleness alone would leave a background job's runs open forever. It still waits for the run's agents to land, exactly as the idle path does.The agent-file case is unchanged and still emits nothing: a subagent's own turn ending is not the session's.
Tests
A turn end settles the run and leaves the session active; it waits for the agents to land first; a registry idle still idles the session; the agent-file line still emits nothing. Plus the taxonomy and line-mapping tests for the new kind.
Follows #8, which stopped the same hint latching forever. That fix made the pane come back for each turn; this one stops it leaving. The three
codexsrcTestRealCodexSession*failures predate both and fail onmain.