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
[Bug]: Codex background command exiting mid-turn never triggers a continuation notice #44787
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
In a Codex thread, start a command with exec_command that outlives yield_time_ms, returning a running session ID to the model while the turn continues.
Have the model keep doing other tool calls or reasoning in the same turn without polling that session again via write_stdin.
Let the background command exit (e.g., fail with exit code 1) while that same turn is still active, before turn/completed.
Let the model finish the turn assuming the job is still running in the background.
Expected behavior
Codex is woken with a "Background command completed..." continuation notice once the turn ends (or notified if a backgrounded exec_command exits without the model having observed its completion), so the agent does not end the turn believing a failed/finished job is still running.
Actual behavior
No continuation notice is ever sent. In apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts:
resolveItemEventContext(payload.turnId) (lines 2920–2929) returns settled: false because payload.turnId is still in activeTurns, not settledTurns.
The commandExecution completion handler (lines 6029–6115) clears the item from runningCommandItemsByTurn and emits turn_item.updated, then gates continuationRequests.offer(...) on if (settled) (line 6065).
Because settled is false, codexBackgroundCommandDetail is never queued, and once the turn ends the command is already gone from runningCommandItemsByTurn.
In practice, Codex receives the initial "running with session ID" response, the command fails with exit code 1 mid-turn, the model finishes its turn 40s later saying the job is still running, and the thread stays idle indefinitely until the user manually checks in.
Impact
Major bug (silent dropped background job failure / wedged workflow)
Activity