You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cd6cb84
Browse filesBrowse the repository at this point in the historyBrowse files
fix: split the turn budgets and stop opting out of liveness deltas
Two findings from #43, both consequences of the idle-timeout redesign in
#41. They share the same subsystem and the same tests, so they land together.
Finding 1 — a foreground turn could outlive the host's SIGKILL.
At base, FOREGROUND_TURN_TIMEOUT_MS (110s) was a non-resettable race against
the whole turn, so a foreground turn was always cut before Claude Code's
~120s Bash SIGKILL and captureTurn's catch reached interruptAppServerTurn in
time. #41 made that deadline resettable, so a turn that keeps producing
events now sails past 110s to the host kill: the catch never runs, no
turn/interrupt is sent, and the broker keeps executing a possibly
write-capable turn nothing can reach. Three of the four links in that chain
predate #41 (see #42); the reachability is what #41 introduced.
Fix: split the two budgets instead of collapsing them.
- The resettable idle budget is unchanged (110s FG / 600s BG).
- The hard wall-clock ceiling becomes an option instead of the fixed
HARD_WALL_CLOCK_CEILING_MS constant. The companion resolves it per host:
foreground -> FOREGROUND_TURN_TIMEOUT_MS (110s, below the Bash kill),
background -> 45 min (no external ceiling to collide with).
- CODEX_TURN_HARD_CEILING_MS overrides it, for tests and for hosts whose
external kill differs. No CLI flag: the ceiling is a property of the
host, not something a caller should tune per run.
- hardCeilingMs threads alongside turnTimeoutMs through buildTaskRequest /
executeTaskRun / executeReviewRun -> runAppServerTurn / runAppServerReview
-> captureTurn. The existing catch already interrupts on any deadline
rejection, so it is untouched.
Foreground at defaults is behaviourally back to the pre-#41 ceiling, while a
lowered idle budget still catches a genuine stall faster.
Finding 2 — the liveness signal for long reasoning was opted out.
Of the nine delta branches added in #41, only three could ever fire.
item/agentMessage/delta, item/reasoning/summaryTextDelta and
item/reasoning/textDelta were listed in
DEFAULT_CAPABILITIES.optOutNotificationMethods, so the server never sent
them. That is precisely the gpt-5.6-sol / effort=xhigh case #40 was filed
for: during a long reasoning stretch those deltas are the ONLY liveness
signal — no item boundary arrives for minutes — so the idle deadline fired
and killed a turn that was demonstrably alive.
Fix: drop those three from the opt-out list. item/reasoning/summaryPartAdded
stays opted out — it is a boundary marker, not a delta.
Also removed the command/exec/outputDelta and process/outputDelta cases:
their params carry only a connection-scoped processId / processHandle and no
threadId (verified against the generated protocol types), so belongsToTurn
can never route them and the cases were dead code. item/fileChange/outputDelta
is kept despite being deprecated upstream — an older app-server may still
emit it, and treating it as activity costs nothing.
Tests (TDD-first, each confirmed red before / green after):
- long-progress-hits-wall-clock-ceiling fixture: streams an outputDelta
every 500ms for ~20s, so the idle budget is reset continuously and only
the ceiling can stop the turn.
* with CODEX_TURN_HARD_CEILING_MS=3500 the run is cut at ~5s citing the
ceiling, the job is failed, and the fixture records lastInterrupt.
Red pre-fix: the turn ran to completion (~21s).
* the same fixture through the foreground path with the ceiling lowered
must also be cut and interrupted — red pre-fix for the same reason.
- reasoning-delta-idle-ok fixture: streams reasoning summary deltas across
the idle budget. The turn must complete, and the handshake capabilities
recorded by the fixture must no longer opt out of the three methods,
while still opting out of summaryPartAdded. Red pre-fix on the opt-out
assertion.
npm test: 184 tests, 184 pass, 0 fail. npm run build passes. Version
metadata untouched at 1.0.6-fork.6.
Closes#43
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FQBJirbWNKWhnpFUnWogB8
0 commit comments