Repository navigation
fix(native-chat): a failed Codex turn shows its error, not a raw thread-status row - #23704
Conversation
…ad-status row
Codex reports `thread/status/changed` {systemError} just before the `error`
frame of a failed turn. The translator read it for session state, then let it
fall through to the generic-frame fallback, whose payload check reads
`systemError` as a failure and printed "codex · notification:thread/status/changed"
in red above the real error row.
The translator now owns the notification: it reads the stopped-running verdict
exactly as before, then journals nothing for any arm (idle, active, notLoaded,
systemError). The error row that follows still carries Codex's sentence and
still fails the turn.
…yped-translator registry The translator already reads every thread status for session state. Listing the kind beside Claude's background-task frames makes that ownership visible where the fallback consults it, instead of a second method check in the translator.
…atus-no-row # Conflicts: # src/main/codex/codex-structured-journal-provider-verdicts.ts # src/main/codex/codex-structured-journal-translation.ts
…nst the provider table A mistyped provider key compiled and silently brought the row back. Also retire the renamed constant from a Claude test comment and say which path the classifier-only fallback test covers.
…atus it read The covered flag means this exact frame was handled; passing it for every notification would silently hide any Codex kind later added to the registry. Also say why a state-only kind may be listed, and retitle the cross-provider coverage test now that Codex has entries.
|
Review status for head ea9c3e1 (still a draft). Problem this fixes: a failed Codex turn in a structured chat showed a meaningless red "codex · notification:thread/status/changed" row right above Codex's real error. After this PR only the real error row appears; the turn still ends as failed and the chat still takes the next message. Live check with a real Codex 0.157.0, two failed turns per build (a 401 because the test profile had no sign-in). Before is main fed1eca, after is this PR at e4535e9; both builds also carried #23552 so the test Codex could not touch the machine's real Codex settings. Journal counts: before 2 thread-status rows, 2 error rows, 2 failed turns; after 0, 2, 2. Before: the red thread-status row sits directly above the 401 error row. After: the retries go straight to the 401 error row. Review since the last update:
|
|
There was a problem hiding this comment.
ℹ️ No critical issues — one minor test-quality suggestion inline.
Reviewed changes
- Per-provider typed-translator registry —
CLAUDE_TYPED_TRANSLATOR_KINDSbecomesTYPED_TRANSLATOR_KINDS, aReadonlyMapkeyed by provider, with Claude's five background-task kinds preserved and Codex'snotification:thread/status/changedadded, typed againstCodexAppServerNotificationMethod. - Codex translator tags the frame as covered — the notification fallback path now passes
{ coveredByTypedTranslator: event.method === 'thread/status/changed' }, so the fallback's pre-classification early return suppresses all four status arms beforehasProviderErrorcan promotesystemError. appendUnhandledoption passthrough —CodexJournalGenericFrames.appendUnhandledgains an optional options parameter and forwards it (with an explicitDEFAULT_JOURNAL_PAYLOAD_LIMITS) tounhandledProviderFrameJournalItem.- Tests — parametrized no-row coverage for the four status arms, a failed-turn test asserting exactly one error status row and a failed turn, and registry tests for the covered and uncovered paths. Four changed suites pass locally (88 tests) plus
pnpm tc:node.
The mechanism is sound: the fallback's coverage check runs before classifyProviderFrame, which is what stops the systemError promotion. The state read (codexThreadStoppedRunning / reportPrimaryThreadStoppedRunning) is untouched and still runs first. Well-formed status notifications only travel the notification path, so the untagged appendUnhandled callers do not reopen the row.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| }) | ||
| }) | ||
|
|
||
| it('covers a kind only for its own provider — a Claude kind from Codex still falls back', () => { |
There was a problem hiding this comment.
This test's name promises provider scoping, but it never passes { coveredByTypedTranslator: true }. The fallback's early return at unhandled-provider-frame.ts:95 requires that flag, so hasTypedProviderFrameTranslator is never consulted here and the assertion would still pass if codex wrongly listed a Claude kind. Assert hasTypedProviderFrameTranslator('codex', 'message:system:task_notification') === false, or call with the covered flag and expect a non-null result.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughCodex Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change removes raw Codex thread-status rows while preserving error messages and failed-turn outcomes. No actionable merge-blocking risk is identified; merge after normal checks pass. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description is detailed and covers the user impact, mechanism, rationale, visual proof, testing, and compatibility considerations. However, the required Linked Issue section explicitly states “None,” although the template requires an actual issue link.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



ELI5
When a turn in a structured Codex chat failed, the chat showed a red row reading "codex · notification:thread/status/changed" directly above the row with Codex's real error message. That row meant nothing to a person: it was Codex telling Orca "this thread has stopped running", which is bookkeeping. It no longer appears. The real error row, and the turn ending as failed, are unchanged.
What Changed
The problem: every failed Codex turn in a structured chat (the chat view, not a terminal pane) put a red "codex · notification:thread/status/changed" row into the transcript. You saw it when you expanded the failed turn's "Worked for …" group, right above Codex's own error sentence (for example "unexpected status 401 Unauthorized …"). It looked like a second, unexplained failure.
Why it happened: just before a failed turn's
errornotification, Codex sendsthread/status/changedwith the statussystemError. Orca's Codex translator (the code that turns Codex's messages into chat rows and session state) already read this notification for state: it is how Orca learns the thread stopped running, which releases messages still waiting on that turn. But after reading it, the translator also handed the notification to Orca's catch-all for messages it does not render. That catch-all turns anything that looks like a failure into a red row showing the raw message name, so that an unknown failure is never silently hidden. It sawsystemErrorand printed the row.What is different for you: a failed Codex turn now shows only Codex's error row. The turn still ends as failed, and the chat still accepts your next message. Nothing changes for turns that succeed. Chats saved before this change keep any of these rows they already recorded; only new rows are affected.
Mechanism: Orca already has a registry of message kinds that a provider's translator fully handles, so the catch-all must not print them. Until now it only listed Claude's background-task messages. This PR turns it into one list per provider and adds Codex's
thread/status/changedto the Codex list. After reading athread/status/changednotification for state, the Codex translator tells the catch-all that this frame is covered, the same way the Claude translator does for each background-task message it handles. The catch-all then writes nothing for this notification, for every status value (idle,active,notLoaded,systemError). The translator's state handling, including the "thread stopped running" report, runs before the catch-all and is untouched. The Codex list is type-checked against Codex's own notification names, so a misspelled entry fails to compile.Why
Every value of this notification describes thread state: loaded, running, idle, or stopped by an error. None carries text meant for a reader. When a turn really fails, Codex's sentence arrives on the separate
errornotification, which already writes its row and fails the turn.Registering the notification reuses the one place Orca already declares "this translator handles this message; don't print it", instead of adding a second filter beside it. Alternatives considered: hiding only
systemErrorkeeps a special case for a notification whose values are all state; weakening the catch-all's failure check would hide real failures from messages Orca does not know yet; an early return inside the Codex translator (this PR's first version) worked but put the rule in a place no other provider uses.Interaction with #23684 (still open; it shows a run of Codex stream retries as one warning row that updates in place): that PR treats any other row the chat draws as the end of a retry run. On #23684's branch alone, the red thread-status row sits between the last retry and Codex's error, so it is what ends the run. With this PR that row is gone, and Codex's error row, which comes right after, ends the run instead. The visible result is the same: one retry row, then the error. The two branches conflict only in the import block at the top of
codex-structured-journal-generic-frames.ts; whichever merges second keeps both sets of imports.Differences from the common pattern
Other Codex clients treat this notification as state only and never show it as a transcript row; Orca now does the same.
Linked Issue
None; reported internally.
Visual Proof
Checked live in the desktop app with a real Codex (0.157.0) in a structured Codex chat, two failed turns per build. The turns failed for a real reason: Codex's request came back
401 Unauthorizedbecause the test profile's Codex had no sign-in. The chat's model was set to an id that does not exist, which is why a "Model metadata … not found" warning appears. Before ismainat fed1eca; after is this PR at e4535e9 (later commits only tighten a type, narrow the covered flag to the thread-status notification, and fix comment and test wording). Both builds also carried #23552 (still open), which the test setup needs so a test Codex cannot change the real Codex settings on the machine; apart from that, the two builds differ only by this PR's five files. The separate red "Reconnecting… N/5" rows are Codex's retries and are what #23684 addresses; they are not part of this PR.Before: the expanded failed turn shows a red "codex · notification:thread/status/changed" row directly above Codex's 401 error row.
After: the retries go straight to Codex's 401 error row, with no thread-status row.
Before: after a second message, the first turn still shows the thread-status row above its error.
After: the chat accepts a second message after the failure; neither failed turn has a thread-status row.
Chat journal counts across the two failed turns: before has 2 thread-status rows, 2 error rows, and 2 turns ending as failed. After has 0, 2, and 2.
Testing
codex-structured-journal-translation-streams.test.ts: no row for each of the four status values, and a failed turn (statussystemError, thenerrorwithwillRetry: false, then a failedturn/completed) journals exactly one status row with Codex's message, ends the turn as failed, and reports the thread stopped running. These replace a test that asserted the old row.provider-frame-disposition.test.ts: the registry covers Codex'sthread/status/changed; a covered frame writes nothing; the same frame without the covered flag still reaches the catch-all as a failure, so the catch-all's own check is unchanged for everything else.Written first against the unmodified code: the
systemErrorcase and the failed-turn case failed with the exact red row. Reverting only the fix turns the same tests red; restoring it turns them green.The existing "thread stopped running" tests in
codex-structured-journal-translation.test.tspass unchanged, so the state effects are the same.14 explicit test files (all Codex structured-journal translation suites, the provider-frame registry and catch-all suites, the Codex turn-wait and goal-row suites, and the Claude background-task and retry-row suites): 213 tests pass. Removing only the Codex registry entry turns 3 of them red.
The registry's provider keys are type-checked against the provider table, so a misspelled provider fails to compile instead of silently bringing the row back.
Forcing the covered flag off turns 2 of the stream tests red.
oxlint on the changed files and
tc:node.Live desktop QA with a real Codex; see Visual Proof.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Main process only; no wire, renderer, or mobile change. It behaves the same on local, SSH, and WSL hosts, because the translator runs where the Codex app server's messages are recorded. Subagent threads lose the same meaningless row; their
errorrows are unchanged. In every captured Codex run, asystemErrorstatus is followed by anerrornotification carrying the reason; if Codex ever reportedsystemErrorwith noerrorafter it, the chat would now show no row for it, where before it showed only the raw message name.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)