Repository navigation
fix(codex): surface the backend reason for failed turns - #571
officialasishkumar wants to merge 1 commit into
Conversation
When Codex rejects a turn (for example an unsupported model for a ChatGPT login) it writes the reason to its JSONL stdout as a `turn.failed` event and exits non-zero. The runner only parsed stdout after a successful exit, so users saw the generic `Command failed: codex exec ...` argv plus incidental stderr such as `Reading prompt from stdin...`, with no hint about what actually went wrong. The Codex runner now reads the `turn.failed` reason from the stdout that execCliWithInput already attaches to exec errors and reports it as `Codex CLI failed: <reason>`, keeping the original exec error as the cause. The same reason replaces the generic "CLI returned empty output" if a failed turn is ever reported with a zero exit. Only `turn.failed` is used: Codex fills it with the turn error or the last critical stream error, while top-level `error` events can be transient retry notices and item-level errors are non-fatal warnings. Failures without a turn failure (timeouts, interrupts, missing binary) keep their existing messages. Fixes steipete#565
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex review: needs maintainer review before merge. What this changesThis PR exposes terminal Codex turn-failure reasons in Summarize’s error messages. Example: Codex rejects gpt-5.5 for a ChatGPT account and exits 1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR narrowly fixes a confirmed diagnostic bug still present in main, with no introduced correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI dispatches summary requests to the Codex runner, which executes Codex through the shared subprocess executor and converts its output into summary text or a user-facing error. flowchart LR
A[Summarize CLI] --> B[CLI provider dispatcher]
B --> C[Codex runner]
C --> D[Shared subprocess executor]
D --> E[Codex process]
E --> F[JSONL stdout and exit status]
F --> C
C --> G[Summary or terminal error]
Technical reviewBest possible solution: Land the focused terminal-reason extraction using the existing executor stdout attachment and Codex parser owner. Do we have a high-confidence way to reproduce the issue? Current-main source confirms that rejected execution bypasses Codex JSONL parsing, and the linked report supplies a release reproduction; this review ran no target code. Is this the best way to solve the issue? The patch repairs the Codex-specific diagnostic at its existing owner, preserves the original cause, and avoids forwarding lifecycle events or nonfatal warnings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aaccb7c9c30e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 11, 2026, 7:17 AM ET / 12:17 UTC. |
Local audio/video extraction ignores `--json`, Markdown and transcription diagnostics misidentify their providers, and the Codex adapter pins an unavailable default while hiding backend failure reasons. Optional OpenRouter diagnostics can also wait beyond the request deadline, and Windows uninstall deletes launcher files even when Task Scheduler refuses deletion. This consolidates and finishes #559, #560, #570, and #571, retaining their authors' fixes and adding truthful extraction provenance, supported Codex default selection, and regression coverage. It also corrects the YouTube fallback order and incorporates the small gateway documentation example from #568 through the existing OpenAI-compatible transport. Existing string-returning library converters remain compatible; explicitly requested Codex models remain explicit. Validation: - The new regression set fails on unmodified main across six test files, including denied task deletion, stalled HTTP response bodies, local media JSON, provenance, and Codex failure/default handling. - Full `pnpm run build` and `pnpm run check` passed on Linux/Node 24: 605 test files passed, 3,909 tests passed, 49 skipped; coverage 94.52% lines and 85.67% branches. - Independent Codex P0–P2 autoreview: scoped clean after fixing one stale test assertion. - No version bump, release, deployment, or Chrome Web Store operation. Addresses #561 Addresses #562 Addresses #563 Addresses #564 Addresses #565 Addresses #566 Addresses #567 Co-authored-by: Sebastien Tardif <[email protected]> Co-authored-by: Vincent Peng <[email protected]> Co-authored-by: Asish Kumar <[email protected]> Co-authored-by: Nirupam Bhowmick <[email protected]>
|
Thanks for the focused contribution. Incorporated into #572 with co-author and changelog credit. The failed-turn regressions fail on main and now pass. Backend failure reasons retain their cause; the same patch also fixes the stale Codex default and unsupported injected verbosity option. Full build/check passed (3,909 tests), and #572 passed exact-head CI before landing. Closing this superseded branch. |
Summary
When Codex rejects a turn (for example
The 'gpt-5.5' model is not supported when using Codex with a ChatGPT account.), it writes the reason to its JSONL stdout as aturn.failedevent and exits non-zero. The Codex runner only parsed stdout after a successful exit. Users got the genericCommand failed: codex exec …argv and incidental stderr such asReading prompt from stdin..., but never the reason.execCliWithInputalready attaches stdout to exec errors; the Grok runner uses the same mechanism. The Codex runner now reads theturn.failedreason from that stdout and throwsCodex CLI failed: <reason>, with the original exec error kept ascause. If a failed turn ever comes back with a zero exit, the same reason replaces the genericCLI returned empty output.Only
turn.failedis used. Codex's exec event processor fills it with the turn error, or else the last critical stream error. Top-levelerrorevents can be transient retry notices, and item-levelerroritems are non-fatal warnings (such as the unrecognized-config notice from #564), so neither is reported. Timeouts, interrupts and other failures without a turn failure keep their current messages. A stream with only lifecycle events still fails as before.Fixes #565
Validation
tests/llm.cli.regressions.test.tscover a turn failure on a non-zero exit (the stream also contains an item-level warning and a retryerrornotice) and on a zero exit. Both fail onmainand pass with this change. A third test checks that the exec error is kept when noturn.failedis present. Unit coverage forextractCodexTurnFailureFromJsonlis intests/llm.cli-provider-output.coverage.test.ts.pnpm check: formatting, localization, lint, typecheck and coverage all pass. 605 test files passed, 30 skipped; 3,898 tests passed, 49 skipped.CODEX_PATHscript that emits the JSONL from the issue and exits 1, runningsummarize doc.txt --cli codex --force-summary --retries 0:main:Command failed: …/codex exec --ephemeral … -m gpt-5.5 -c text.verbosity="medium"followed byReading prompt from stdin...Codex CLI failed: The 'gpt-5.5' model is not supported when using Codex with a ChatGPT account.(exit 1)No changes to model selection, arguments or retry behavior.