fix: turn-timeout gaps — interrupt, early deadline, options threading (closes #27)#28
Merged
Merged
Conversation
…st, thread through options (closes #27) Three gaps from Codex cycle-review of PR #26: 1. Timed-out turn not interrupted: deadline rejected the await but turn/interrupt was never sent. The broker kept executing a write-capable turn after it was reported failed. Fix: catch deadline rejection, best-effort interruptAppServerTurn(cwd, {threadId, turnId}), re-throw. 2. Deadline armed after turn/start response: a stalled turn/start (app-server alive but not responding) was unbounded. Fix: arm the deadline BEFORE startRequest, race the entire lifecycle (startRequest + completion) against it. If the deadline fires during startRequest, there's no turnId to interrupt, but the process no longer hangs. 3. --turn-timeout-ms ignored for background: applyForegroundTurnBudget was foreground-only (env side-channel gated by if(!options.background)). Replaced with options threading: resolveTurnTimeoutMsFromOptions resolves the value from the flag/env/default (foreground=110s, background=600s), passes it through buildTaskRequest → handleTaskWorker → executeTaskRun → runAppServerTurn → captureTurn → resolveTurnTimeoutMs. Deleted applyForegroundTurnBudget (env side-channel gone). Env fallback (CODEX_TURN_TIMEOUT_MS) remains for operator-configured overrides. Also threads cwd into captureTurn options (needed by the interrupt path). Verified: 166 tests, 162 pass / 4 pre-existing (unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
axisrow
force-pushed
the
fix/turn-timeout-gaps-27
branch
from
July 20, 2026 13:21
b6b6b9d to
bec139c
Compare
This was referenced Jul 20, 2026
Closed
axisrow
added a commit
that referenced
this pull request
Jul 21, 2026
Ships accumulated fixes since fork.4: - #29 broker-busy hang (PR #30): bound broker handshake - #31 spawned-app-server handshake (PR #32): bound request() primitive - openai#508 config-driven sandbox + --read-only (PR #33) + resume-sandbox fail-closed - #34 model/effort in /codex:rescue launch line (PR #35) - #28 turn-timeout gaps (already in fork.4 base) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Closes #27. Three gaps from Codex cycle-review of PR #26.
166 tests, 162 pass / 4 pre-existing.