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
fix: turn-timeout gaps — interrupt on deadline, arm before startRequest, 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>
0 commit comments