Skip to content

fix(runtime): terminate turns on terminal errors - #710

Open
ALV0612 wants to merge 1 commit into
openai:mainfrom
ALV0612:fix/issue-698-terminal-error-notification
Open

fix(runtime): terminate turns on terminal errors#710
ALV0612 wants to merge 1 commit into
openai:mainfrom
ALV0612:fix/issue-698-terminal-error-notification

Conversation

@ALV0612

@ALV0612 ALV0612 commented Sep 2, 2026

Copy link
Copy Markdown

Summary

  • treat matching root-turn app-server error notifications with willRetry: false as terminal failed turns
  • keep willRetry: true errors non-terminal so valid retries can complete
  • preserve the exact error in failed task/review payloads, rendered output, and tracked job state
  • keep unrelated and tracked-subagent errors from overwriting the result-authoritative root turn

Root cause

captureTurn() recorded an error notification and emitted a cosmetic failed progress phase, but never settled state.completion. When Codex did not send a later turn/completed, the companion and broker stayed alive indefinitely while the job remained running / failed.

The generated protocol includes willRetry, so only a non-retryable error is terminal. This patch synthesizes a complete failed Turn and routes it through the existing idempotent completeTurn() path. A later turn/completed cannot overwrite that first terminal transition.

Testing

  • node --test --test-name-pattern='(non-retryable turn error|terminal failure|retryable turn error|unrelated thread|review terminates|tracked subagent error)' tests/runtime.test.mjs — 7/7 pass
  • npm test — 98/98 pass
  • npm run build — pass
  • npm run check-version — pass
  • git diff --check — pass

Regression coverage includes:

  • terminal error after turn/start acknowledgement
  • terminal error buffered before acknowledgement
  • terminal error followed by a contradictory completion
  • retryable error followed by success
  • unrelated-thread error isolation
  • tracked-subagent error isolation
  • native review error rendering and terminal persisted state

Fixes #698

@ALV0612
ALV0612 requested a review from a team September 2, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

captureTurn treats the error notification as non-terminal, so a Codex-side failure hangs the turn forever and wedges the job at status: running

1 participant