Repository navigation
fix(runtime): wait out Codex 0.157's startup screen, and stop at Codex's startup dialogs, before typing a worker brief - #23745
Conversation
Codex 0.157 draws a provisional startup screen (header reads model: loading) and discards typed input while it starts its shared daemon behind it; a fresh Codex home makes that window seconds long, so worker-start pasted briefs that were truncated or never submitted. Codex 0.158 dropped the header labels Orca matched, so worker-start stopped seeing Codex as ready at all. Readiness now requires Codex's live chat on both layouts: the provisional header vetoes a text match unless the live status row is already painted, and 0.158's greeting layout counts once that status row appears. Codex 0.158's model announcement dialog is reported as a blocked prompt instead of receiving the brief.
… and the screen probe Live worker-start on a fresh Codex 0.157 home still typed during the daemon start: Codex leaves its alternate screen for that window, so the live screen showed no header and the screen-based veto never fired. The text copy keeps the provisional header until the live chat paints its status row, so the veto now reads it there. The tui-idle visible-screen probe used the bare text rule on the rendered screen; it now goes through the same body rule.
Live QA: fresh-profile
|
| Build | Codex | Result |
|---|---|---|
| main 409462a | 0.157.0 | 5 of 5 rounds: the task was pasted at about 1.9 s, while Codex was installing its background server (Installing daemon… at 0.5 s), and the input was flushed. Codex received the task with its first ~1 KB missing: 4172 characters, starting mid-sentence at "cceeded when the…". Orchestration still recorded ready / turn observed. |
| main 409462a | 0.158.0 | failed at agent_readiness: the greeting layout never matched. |
| this PR 8219b0a | 0.157.0 | ready. The paste went at 21.6 s, just after Codex's live chat set its first title (21.5 s); the server install on this loaded machine took about 19 s. Codex received the complete task: 5188 characters, starting "You are working inside Orca…". |
| this PR 8219b0a | 0.158.0 | ready. The paste went at 7.8 s, after the live chat's first title (6.8 s). Codex received the complete task: 5188 characters. |
The PR's first commit alone still pasted too early on 0.157 (at 9.7 s). That's how the second commit's two fixes were found: the text-copy check, and the visible-screen probe now using the Codex-aware check. The PR rows above ran on the second commit; the branch build was confirmed by grepping the built main bundle for the new function. The real ~/.codex on the remote Mac was unchanged after every round.
…gences The serialize round-trip replay picks up every fixture under runtime/__fixtures__, and the three new Codex 0.157/0.158 captures showed 48/9/8 "new-fail" checkpoints against an expected 0, turning CI red. They are the existing live-pen colour leak on restored cells, the same class as the other Codex and DSH entries; this branch changes no serializer code.
…nbacked row filter - The tui-idle visible-screen probe now classified Qoder panes with isQoderComposerReady, which skips the working veto evaluateTuiIdle applies first. Qoder paints its composer mid-turn, so an adopted Qoder pane whose hooks said "working" settled the wait immediately. Only Codex and unknown panes take the body rule there; every other agent keeps its old verdict. - The live status-row check skipped rows containing "waiting for startup", a string Codex 0.157/0.158's TUI never prints. The line-folded text copy keeps a whole screen on one line, so the filter could only ever veto the real status row. It is now a bounded includes() with no split. - Lowercase the wait text once in isKnownReadyPromptBody. - Restore the per-frame "screen never takes a settled header away" check, guarded on the provisional veto, instead of checking the final frame only.
… is answered The announcement's choices stay in the text copy after the user answers it, and the existing dismissal check needed the model:/directory: labels that 0.158's header lacks, so tui-idle waits and the agent-status query kept reporting codex-model-migration-prompt over a live chat. Codex repaints its whole screen, header included, when a startup dialog closes, so the header after the dialog now marks it answered. Also corrects the live-chat marker comments: the middle dot also comes from the daemon session's agents hint row and the warnings notice, not only the status row.
… they really print Codex 0.157 and 0.158 no longer print `Press enter to continue/confirm` on their startup dialogs; they print key rows instead (`enter continue · esc skip`, `enter confirm · esc skip`, `enter/esc continue · ctrl+c quit`). The update, hooks-review and model-migration matchers still required the old wording, so none of these dialogs was reported as blocked. On 0.157 the dialog's `·` also satisfied the live-footer check, so a tui-idle wait read the update dialog as ready and worker-start would type the brief into it, where Enter picks "Update now" (npm install -g, Codex exits). On 0.158 the wait timed out instead of reporting blocked. The matchers now accept the old wording or the new row, tolerating the spaces the line-folded text copy drops around `·`. Each one matches from the dialog's first `·` (for the update dialog that is its title row, `Update available · 0.157.0 → …`), so the dialog is blocked from the same character that would otherwise make the provisional header read as live. The retired-model notice without choices has a catalog-supplied heading (`GPT-5.4 is no longer available`), so it is matched by its own key row. No new blocked-reason value. The startup-dialog matchers move to startup-dialog-blocked-signals.ts to keep terminal-wait-detection.ts under the line limit. Backed by six real captures (update available, hooks review, retired model without choices, each on 0.157.0 and 0.158.0), replayed frame by frame and through a tui-idle wait; the serializer round-trip replay registers their existing live-pen colour divergences.
…aunch in the same pane The retired-model notice is matched by its key row alone, and the matcher took the first `enter/esc continue ·` in the live window while every other startup-dialog matcher takes the last. Quitting Codex from the notice and relaunching it in the same pane leaves the old copy ahead of the new launch's header, so the header read as having dismissed the new notice: 0.157 then read ready and a worker brief would be typed into the dialog. Take the last key row, and replay each captured dialog quit-and-relaunched to pin all six.
Review status: ready for a maintainer look (still draft, not merged)Verdict: the fix does what it says on Codex 0.157 and 0.158, live and in replay. Head: What the user gets:
Red CI is not caused by this PR. Every failing job (typecheck, static analysis, persistence, native smoke) fails with What review changed (all pushed)
Live QA (dev build, remote Mac)Each round used a fresh Orca profile and a throwaway Codex home; the model endpoint fails by design. Every round's terminal recording was checked for what was typed. The real Codex install and config on that machine were unchanged after every round.
Codex 0.157, main: the task arrives cut off, starting mid-word at "cceeded when the". Codex 0.157, this PR: the complete task, starting "You are working inside Orca". Codex 0.158, main: Codex is ready, but Codex 0.158, this PR: the complete task. Codex 0.158 model announcement, this PR: stopped, with nothing typed. Codex 0.157 "Update available", this PR: stopped, and "Update now" is untouched. Codex 0.158 "Update available", this PR: stopped, with nothing typed. After one Esc ("skip") on that question: Codex's live chat, and the pane is no longer reported as blocked. Codex 0.158 "Hooks need review", this PR: stopped, with nothing typed. Replay checks
Known limits (listed in the PR body)
Cherry-pick note
Found during QA, not caused by this PR (same on main)
|
|
Warning Review limit reachedNext included review available in 21 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (28)
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 |
|
| const modelNoticeIndex = lastMatchIndex(normalized, CODEX_MODEL_NOTICE_KEY_ROW_RE) | ||
| if (modelNoticeIndex !== -1) { | ||
| candidates.push({ reason: 'codex-model-migration-prompt', index: modelNoticeIndex }) |
There was a problem hiding this comment.
Quoted shortcut blocks terminal waits If an agent includes
enter/esc continue · in a reply or transcript excerpt, this matcher treats that row alone as an active model-migration dialog. While it remains in the last 12 nonblank terminal lines, a tui-idle wait can report codex-model-migration-prompt even though there is no question to answer. Require dialog context before treating the row as blocked.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Codex readiness extracted to a dedicated module —
codex-terminal-readiness.tsnow ownsfindCodexReadyPromptIndex, the newfindCodexHeaderIndex,isCodexProvisionalStartupText, and the screen header/compact-header rules, with the provisionalmodel: loadingscreen refused as ready. - Startup dialogs matched by the rows Codex actually prints —
startup-dialog-blocked-signals.tsrecognizesupdate available ·,enter continue ·,enter confirm ·,enter/esc continue ·, and the 0.158 model announcement's two fixed choices, keeping the legacypress enter to …wording as a fallback. - Blocked signal now suppresses the text readiness path —
isKnownReadyPromptBodyrequires codex/unknown panes to be non-provisional for the text rule, and the dismissed-modal check gainedfindCodexHeaderIndexso a repainted header clears a dialog. - Visible-screen probe uses the body rule for Codex/unknown panes — the one-shot pre-poll read no longer settles on the provisional screen; Qoder and other agents keep their prior rule.
- Coverage: new captures and replay suites — 10 fresh-home/startup-dialog transcripts, a shared replay harness, and tests for text-only readiness, provisional refusal, dialog reporting/clearing/relaunch, and the runtime tui-idle paths; the serializer divergence registry carries the new captures' exact counts.
I re-ran the new and adjacent readiness, wait-detection, tui-idle, and Qoder suites (all green), plus pnpm tc:node and pnpm run check:code-quality:changed (clean). I also verified the findCodexHeaderIndex dismissal path is genuinely covered: removing it from findDismissedStartupModalIndex fails 5 tests rather than passing on the 12-line live window alone.
Technical details
# Review notes
## Scope verified
- Read the complete 28-file diff, the new `codex-terminal-readiness.ts`,
`startup-dialog-blocked-signals.ts`, `terminal-wait-detection.ts`,
`orca-runtime-start-tui-idle-visible-read-probe.ts`, and the replayed fixtures/tests.
- Confirmed no other callers of the moved Codex helpers were left stale
(`grep` for `findCodexReadyPromptIndex` / `findCodexScreenReadyPromptIndex` / `findCodexHeaderIndex`).
- Mixed-version safety: no new `RuntimeTerminalWaitBlockedReason` value is introduced
(`agent-update-prompt`, `agent-hooks-review-prompt`, `codex-model-migration-prompt` reused), so the
remote wire vocabulary is unchanged.
## Tests are non-vacuous
- `isKnownReadyPromptBody`'s provisional guard is pinned by the 80x24 equivalence case and the
per-fixture "never ready while provisional" case; the author's own presence preconditions
(`sawLoadingHeader`, `sawTextOnlyReadiness`, `settledFrames > 0`) fail loudly if the fixtures stop
exercising the guarded window.
- The dialog suites assert both directions (reports while up, clears after the repaint, still reports
after a relaunch in the same pane), and empirically depend on the new `findCodexHeaderIndex`.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Build on #23765's Codex readiness module instead of a parallel one: - Take main's codex-terminal-readiness.ts, replay harness and quiet composer lane; drop this branch's 0.158 greeting-header screen rule and its tests, which the quiet lane replaces (0.158 worker-start). - Keep the refusal of Codex's provisional `model: loading` header as isKnownReadyPromptSettled, used by tier 1 and the visible-screen probe; main's tier-1 text rule still settles on it (0.157 daemon start drops the typed brief). Agent presence keeps the plain rule. - Keep the 0.157/0.158 startup-dialog matchers; fold the 0.158 model announcement tests into codex-startup-dialog-transcripts.test.ts. - Drop the visible-probe agent routing and its Qoder guard test: the probe now uses the same settled text rule for every agent.
…eeps intact Codex 0.157+ paints each startup dialog over its startup screen by cell diff, so Orca's line-folded text copy can drop letters and spaces from a heading: #23765's 0.157.1 capture reads `Updat available`. The update matcher needed `update available`, so on that capture tier 1 read the dialog's own `·` as the live chat's footer and a tui-idle wait settled ready on the update dialog, whose Enter picks "Update now". Match each dialog from its first `·` by rows Codex prints as fixed literals: `available · <version>` and `enter continue · esc skip` (update), `enter confirm ·` (hooks review), `enter/esc continue|confirm ·` (model notices, which also covers 0.158's new-model announcement, so its choice-text matcher goes). Legacy `Press enter to …` wording still matches. Add the new rows to the blocked-signal prefilter, and replay #23765's 0.157.1 update capture in the dialog suite.
Codex's rate-limit reset popup (and its other pickers) end their key row with `enter confirm · esc back`, which the hooks-review row matched now that it no longer needs the heading. Exclude `esc back` instead of requiring `esc skip`, so a half-painted hooks-review row still blocks.
Status after the rework onto #23765 (still draft, not merged)Verdict: ready for a maintainer look. This PR is now built on #23765 and fixes only what is still broken on main. Head is What changed in the rework:
Claims re-checked against current main
Live QA round 3 (remote Mac; main
|
| Scenario | main | This PR |
|---|---|---|
| 0.157 plain | Pasted at 1.6 s during model: loading; 4172/5188 characters, starting "cceeded when the"; reported ready |
Pasted 0.5–1.2 s after the live chat; 5188/5188 (2 of 2) |
| 0.158 plain | Ready; 5188/5188 (2 of 2) | Ready; 5188/5188 |
| 0.157 "Hooks need review" | Enter answered the question and opened Codex's hooks page; reported ready, "turn observed"; no task submitted |
Stopped in 3.97 s: agent-hooks-review-prompt; 0 bytes typed |
| 0.158 "Hooks need review" | timeout after 59.9 s; 0 bytes typed |
Stopped in 3.89 s: agent-hooks-review-prompt; 0 bytes typed |
| 0.157 "Update available" | not run (main would answer "Update now") | Stopped in 3.69 s: agent-update-prompt; 0 bytes typed; Codex not updated |
| 0.158 "Update available" | not run | Stopped in 3.89 s: agent-update-prompt; 0 bytes typed |
Main, Codex 0.157: the task arrives cut off.
This PR, Codex 0.157: the complete task.
Main, Codex 0.157 "Hooks need review": Orca's Enter answered the question.
This PR, Codex 0.157 "Hooks need review": untouched.
This PR, Codex 0.157 "Update available": untouched.
Interaction with open #23805
#23805 moves the Codex header rule into the 3 s quiet lane. That alone does not fix 0.157: the server install is silent for 3 s or more in 8 of 11 recorded fresh launches, so the provisional screen still settles. Whichever of the two PRs lands second needs one line: #23805's quiet-lane header check must also require !isCodexProvisionalStartupText(...). Verified in a scratch merge: both suites pass, 84 tests.
Found in QA, not caused by this PR (same on main)
- Slow 0.158 fresh start: on a fresh Codex 0.158 home,
worker-starttakes about 24 s. Codex plays a greeting animation for about 15 s, and fix(runtime): settle a quiet Codex composer as ready on every version #23765's 3 s quiet rule waits it out. - "Turn observed" with no task: main reported it on 0.157 "Hooks need review" although no task was submitted. This PR prevents that case, because it stops first.
- Blocked reason only in error text:
worker-startputs the blocked reason only inside its error text (lastError), with a genericfailedstate. - No sidebar row for a blocked worker: a blocked or failed worker gets no row in the left sidebar.
…3745, #23783, #22971, #22565, #22846, #23724, #23721, #23693, #23810) into #23059 #23671 (group chat rows by the turn that produced them) is ported onto #23059's turn-scope model, so there is one grouping mechanism, not two: - A host that states each row's turn scope groups by that scope, as before. #23671's journal-order derivation (rows between one turn record and the next belong to it) moves from the timing selector into src/shared/native-chat-turn-grouping.ts and runs only for a host that states no scope, replacing the positional fallback there. - #23671's anchor rules live in structuredAgentTurnAnchors, which membership, settled timing and the live clock all read: a turn whose opener key nothing resolves yet takes the send still in flight ahead of its record (Codex before its echo), else its own record. - The live turn is one key again. #23671 made row liveness follow the owning turn, so the bar key and the liveness key are always the same; nativeChatTurnMembership now returns only liveTurnKey (barTurnKey, activeTurnOpenedBy and turnKeysByItemId are gone). - A turn with no user bubble draws its bar above its first row (nativeChatTurnBarRows, desktop and mobile), and a turn's diff rollup goes under its last row. - The Codex full-history restore writes each record ahead of its items; that also fixes the derived turn scope on #23059's journal. #23026 (Stop from the moment a message is sent) is ported onto #23059's command turns: the cancel paths ask the translator for a command's provider turn instead of the removed compaction tracker, and a Stop that names no turn still ends a running /compact through its child. performCancel moved to structured-agent-session-turns-cancel.ts to keep the turns module under the line limit. #22090's awaitingInput replaces showTurnStatus/showLiveTurnActivity; the waiting-behind-/compact rows are kept.















ELI5
#23765 fixed Codex 0.158 workers failing to start. Two things are still broken on main when Orca starts a Codex worker and types its task:
worker-startwaits 60 seconds and fails with a bare "timeout".This PR makes Orca wait for Codex's real chat screen on 0.157, and stop within seconds with a named reason when Codex shows one of those questions.
What Changed
Still broken on main (after #23765), measured live on a remote Mac:
worker-startpasted the task 1.6 s after launch, while Codex's header still readmodel: loadingand Codex was installing its background server. Codex received 4172 of 5188 characters, starting mid-word at "cceeded when the". Orca reportedready.worker-startreportedreadyand "turn observed", though no task was ever submitted.worker-startfailed after 59.9 s withtimeout, without naming the question.With this PR:
worker-startstops in about 4 s withAgent startup blocked: agent-update-prompt/agent-hooks-review-prompt/codex-model-migration-prompt. It types nothing and leaves the question for the user. Once the user answers it, the pane is no longer reported as blocked.Mechanism:
model: loadingplus a working-looking input box. Codex 0.157 starts its shared background server behind that screen, turns keyboard input off meanwhile, and discards what was typed.OpenAI Codex+model:+directory:in Orca's line-by-line copy of the output, the "text copy") already matches the provisional screen. fix(runtime): settle a quiet Codex composer as ready on every version #23765 left that rule unchanged and added a separate quiet-screen rule for the empty input box. The provisional screen still settles on the header rule within milliseconds.isKnownReadyPromptSettled(terminal-wait-detection.ts) is the header rule minus Codex's provisional screen. It does not count while the text copy showsmodel: loadingwith no·after it. The live chat always draws a·below its input box: the status row,← for agents · ? for shortcuts, or⚠ N warning · f2 to view.isKnownReadyPromptBodyand thetui-idlevisible-screen probe use it.isKnownReadyPromptPreview, which detects that an agent is present, keeps the plain rule.·too, in their key-hint rows, so they have to be recognized as blocked first. The update, hooks-review and model-notice matchers only knew the oldPress enter to continue/confirmwording, which 0.157 and 0.158 no longer print. They now match the rows Codex actually draws, which are fixed strings in Codex:Update available · <version>,enter continue · esc skip,enter confirm ·andenter/esc continue|confirm ·. The legacy wording still matches.Updat available).enter confirm · esc back, which Codex's mid-session pickers print.startup-dialog-blocked-signals.ts.Credit and scope:
worker-start, which this PR originally also fixed. This PR's 0.158 greeting rule and its tests were dropped in favor of fix(runtime): settle a quiet Codex composer as ready on every version #23765's quiet-screen rule, and it now builds on fix(runtime): settle a quiet Codex composer as ready on every version #23765'scodex-terminal-readiness.tsand replay harness.Why
!isCodexProvisionalStartupText(...)guard (a one-line change; verified in a scratch merge, both suites pass).Known limits (planned follow-up):
·. It then depends on Orca's in-process screen, and without oneworker-starttimes out instead of typing.worker-start) still uses the old wording rule.Linked Issue
Related: #23657 (fixed by #23765), #23765, #23805
Visual Proof
No Orca UI change; the difference is what reaches Codex's worker pane. From the live runs (details in the QA comment):
Main, Codex 0.157: the task arrives cut off, starting mid-word at "cceeded when the".
This PR, Codex 0.157: the complete task, starting "You are working inside Orca".
Main, Codex 0.157 "Hooks need review": Orca's Enter answered the question and opened Codex's hooks page; no task was submitted.
This PR, Codex 0.157 "Hooks need review":
worker-startstopped in 4 s; the question is untouched.This PR, Codex 0.157 "Update available":
worker-startstopped in 3.7 s; "Update now" is untouched.Testing
Captured screens: 13 real captures recorded on a remote Mac at 120x40 in fresh throwaway Codex homes, with no keys sent (details in each
.meta.json):They are replayed with fix(runtime): settle a quiet Codex composer as ready on every version #23765's harness alongside fix(runtime): settle a quiet Codex composer as ready on every version #23765's own fixtures.
Red on main, green here:
tui-idlewait does not settle while 0.157 installs its server, including from the visible-screen probe.tui-idlewait as blocked, stops being reported once the chat repaints after it, and is not hidden by a copy left over from an earlier launch in the same pane.enter confirm · esc backpicker is not called a hooks review.Each fix removed in turn fails its tests: provisional refusal 9, probe 1, dialog rows 24, answered header 4, prefilter 12, last-match 8; the dialog suite fails 24 of 34 on main's code.
Suites and gates:
src/main/runtime+src/main/daemon: 11,883 passed, 0 failed.tc-gate pnpm tc:node,oxlint, andcheck:code-quality:changed -- origin/main: pass.Live
worker-start(main2d358df8afvs this PR82fcca49ed3): dev builds on a remote Mac, fresh Orca profile and throwaway Codex home per round, a model endpoint that fails by design. The real Codex install and config were unchanged after every round.model: loadingand delivered 4172/5188 characters. The PR pasted 0.5–1.2 s after the live chat, delivering 5188/5188 (2 of 2 rounds).ready; the PR stopped in 3.97 s withagent-hooks-review-prompt, and 0 bytes were typed.agent-update-prompt, 0 bytes typed, and Codex was not updated.Earlier rounds on this branch: an Esc ("skip") on the 0.158 update question brought up the chat, and the next
tui-idlewait settled.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
tui-idlewait or a delivery check is active. They cover the last 12 lines, or one scan of the already-built text copy.worker-starttakes about 24 s on main and on this PR alike. Codex plays a greeting animation for about 15 s, and fix(runtime): settle a quiet Codex composer as ready on every version #23765's quiet rule waits it out.worker-startreports a blocked reason only inside its error text.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)