Repository navigation
Conversation
…e echoed prompt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — Failed Codex text generation now uses an exit-code-only message and moves CLI diagnostics into the error cause, avoiding echoed prompts in the displayed detail. The supplied High finding about lost actionable diagnostics remains independently blocking. Needs human approval because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dismissing prior approval to re-evaluate da68b1c
|
Note 🤖 Claude Opus 5.5 responding on behalf of saphid I reworked this PR to follow the documented error rule in docs/internals/effect-services.md "Errors". An error detail must be fixed or built from structured attributes, and raw provider output stays in
Commit: da68b1c |
| detail.length > 0 | ||
| ? `Codex CLI command failed: ${detail}` | ||
| : `Codex CLI command failed with code ${exitCode}.`, | ||
| detail: `Codex CLI command failed with code ${exitCode}.`, |
There was a problem hiding this comment.
🟠 High textGeneration/CodexTextGeneration.ts:346
For nonzero Codex exits, callers receive only Codex CLI command failed with code ..., so authentication, configuration, or usage failures become unrecoverable. protect rebuilds the error from cause.detail and discards the nested cause; include the extracted output in detail so the actionable CLI error survives.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/textGeneration/CodexTextGeneration.ts around line 346:
For nonzero Codex exits, callers receive only `Codex CLI command failed with code ...`, so authentication, configuration, or usage failures become unrecoverable. `protect` rebuilds the error from `cause.detail` and discards the nested `cause`; include the extracted `output` in `detail` so the actionable CLI error survives.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of saphid
Leaving this as is for now, and flagging it for maintainers because it's a deliberate trade-off. docs/internals/effect-services.md "Errors" says a tagged error's message is fixed or built from structured attributes, never from raw provider text. The raw value belongs only in cause. codex exec gives no structured failure category, only an exit code and stderr. That stderr starts with the banner, the full prompt and the staged patch, which is the leak this PR fixes. So the detail is the fixed Codex CLI command failed with code N., and the extracted ERROR: text stays on the error as its cause (CodexTextGeneration.ts:343-347). maria-rcks confirmed the toast in a real run: main showed the banner, prompt and patch, and this PR shows only the fixed line.
On protect: there's no such helper at da68b1c. The one place that rebuilds an error from cause.detail (line 240) is the runtime-resolve path. It's unchanged from main and never sees CLI output.
If maintainers want auth or usage failures to be actionable from the toast, two options fit the rule. One is a bounded diagnostic field like DeviceBootError.diagnostics, which caps the extracted ERROR: line. The other is mapping known codex exit conditions to fixed categories. I'm happy to do either. I didn't want to put raw provider text back into the detail without that decision.
There was a problem hiding this comment.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
|
Note Written by Verified in a real dev environmentverified as-is at created a git project through the app, selected Codex
short runtime/check transcript: the Blacksmith snapshot needed its public pr ancestry fetched before Not verifiednative desktop, iOS/Android, remote/relay/tunnel connections, live authentication or quota failures, and the other text-generation entry points (branch names, PR content, review guides, and title failure). the exercised failure was a real HTTP 404 from the local proxy, not a usage-limit simulation. the provider diagnostic cause is intentionally absent from the client toast; this pass proves the displayed detail, not access to that cause from a client. |




Problem
When Codex text generation fails (commit messages, PR text, branch names, thread titles, PR review guides), the error shows Codex's startup banner and the whole prompt, not a short failure. In human mode,
codex execwrites its banner (version, workdir, model, session id) to stderr, then repeats the full prompt, including any diff, underuser. Only after that does it printERROR: …lines.runCodexJsoncopied all of stderr into the error detail, so the toast or failed review guide starts withOpenAI Codex v0.160.0 --------and the prompt follows.#26033 diagnosed this, and #26073 fixed the Guide tab layout. That PR says: "Trimming the Codex stderr on the server is a separate fix and is not included." This PR is that fix.
Change
This follows docs/internals/effect-services.md "Errors": an error detail is fixed or built from structured attributes, and raw provider output lives only in
cause.Codex CLI command failed with code N.It contains no Codex output.cause. That is stderr from the lastERROR:line to the end, without the prefix, so earlier retry notices such asERROR: Reconnecting... 5/5are skipped. If there is noERROR:line,causegets trimmed stderr, or else stdout.codex exechas no structured failure category to map. I ran the real CLI with--json, and its terminal event is{"type":"turn.failed","error":{"message":"unexpected status 401 …"}}, which has only a message. The exit code is 1 for every failure. The detail therefore uses one fixed message, not a per-category mapping. The chat adapter'scodexErrorInfocategories come from app-server and are not available fromcodex exec.Scope and approval
This is a very small, focused fix for an obvious bug, so there is no prior issue. It is the follow-up named in #26073 for the problem diagnosed in #26033. It changes one function in one file, with one test. Overlap search: the local PR index plus GitHub searches for "codex stderr" and "CodexTextGeneration". Open PRs #29607, #26979, and #14217 touch Codex text generation but not this error path.
Verification
codex-cli 0.160.0unauthenticated with an isolatedCODEX_HOME. It exited 1. Human-mode stderr had the banner, the echoed prompt,ERROR: Reconnecting... N/5, and then a finalERROR: unexpected status 401 Unauthorized: ….--jsonmode gave the same message-onlyturn.failedevent shown above.keeps Codex's banner, prompt, and error text out of the failure detailinCodexTextGeneration.test.tsasserts three things: the detail is exactlyCodex CLI command failed with code 1., it does not contain the provider text, andcauseholds the final 401 message. On the previous head it failed withReceived: "Codex CLI command failed: unexpected status 401 Unauthorized: Missing bearer authentication". Full file: 15/15 pass.vp run check:changed: format, lint, knip, graphql, typecheck (3 packages), and tests (16/16) all pass.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code