Skip to content

fix(runtime): wait out Codex 0.157's startup screen, and stop at Codex's startup dialogs, before typing a worker brief - #23745

Merged
brennanb2025 merged 11 commits into
mainfrom
brennanb2025/codex-058-readiness
Sep 29, 2026
Merged

brennanb2025 merged 11 commits into
mainfrom
brennanb2025/codex-058-readiness

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Codex 0.157 loses the start of the task. On a fresh Codex setup, Orca types while Codex still shows its temporary "loading" screen. Codex is starting its background server at that moment and throws away everything typed, so the worker gets a task missing its first ~1 KB, and Orca still reports it as delivered.
  • Codex startup questions are typed into, or waited on for a minute. These are "Update available", "Hooks need review", the retired-model notice, and 0.158's "Try new model" announcement. On 0.157, Orca types the task into the question: on "Hooks need review" its Enter opens the hooks page, and on "Update available" Enter picks "Update now", which updates Codex and closes it. On 0.158, worker-start waits 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:

  • Codex 0.157, fresh Codex home: worker-start pasted the task 1.6 s after launch, while Codex's header still read model: loading and Codex was installing its background server. Codex received 4172 of 5188 characters, starting mid-word at "cceeded when the". Orca reported ready.
  • Codex 0.157 "Hooks need review": the paste was discarded and Orca's Enter answered the question ("Review hooks"), opening Codex's hooks page. worker-start reported ready and "turn observed", though no task was ever submitted.
  • Codex 0.158 "Hooks need review": nothing typed, and worker-start failed after 59.9 s with timeout, without naming the question.
  • Replay of the captured screens shows the same for "Update available" and the retired-model notice on both versions, and for 0.158's model announcement. Main was not run live on "Update available", because it would have answered "Update now".

With this PR:

  • Codex 0.157: the task is pasted only after Codex's live chat is up, and arrives complete (5188 of 5188 characters, 2 of 2 rounds).
  • Startup questions, 0.157 and 0.158: worker-start stops in about 4 s with Agent 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.
  • Codex 0.158 plain launches behave as on main (fix(runtime): settle a quiet Codex composer as ready on every version #23765's fix).

Mechanism:

  • Codex first draws a provisional startup screen: header model: loading plus 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.
  • Main's tier-1 Codex header rule (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.
  • New isKnownReadyPromptSettled (terminal-wait-detection.ts) is the header rule minus Codex's provisional screen. It does not count while the text copy shows model: loading with 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. isKnownReadyPromptBody and the tui-idle visible-screen probe use it. isKnownReadyPromptPreview, which detects that an agent is present, keeps the plain rule.
  • The text copy is used rather than the rendered screen because Codex 0.157 leaves its full-screen view while it starts the server, so the rendered screen shows no header during exactly that window.
  • Startup questions draw a · 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 old Press enter to continue/confirm wording, 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 · and enter/esc continue|confirm ·. The legacy wording still matches.
    • Headings aren't matched, because Codex paints them over its startup screen and the text copy can drop letters (Updat available).
    • The hooks-review row excludes enter confirm · esc back, which Codex's mid-session pickers print.
    • The matchers live in the new startup-dialog-blocked-signals.ts.
  • A startup question counts as answered once Codex's header is drawn after it. Codex repaints its whole screen when a question closes, and 0.158's header has no labels, so the header alone marks it answered.

Credit and scope:

Why

  • Why not rely on fix(runtime): settle a quiet Codex composer as ready on every version #23765's input-box rule for 0.157: the tier-1 header rule answers first and ranks above it, and it already matches the provisional screen. Moving the header into the quiet lane (open PR fix(runtime): stop a busy Codex 0.150-0.157 pane reading as tui-idle #23805) is not enough either. The 0.157 server install can be silent for 1.2–16.9 s, 3 s or more in 8 of 11 recorded fresh launches, so a 3 s quiet rule still settles on the provisional screen. If fix(runtime): stop a busy Codex 0.150-0.157 pane reading as tui-idle #23805 lands, its quiet-lane header check needs the same !isCodexProvisionalStartupText(...) guard (a one-line change; verified in a scratch merge, both suites pass).
  • Why a blocked report for the questions, rather than relying on "every dialog replaces the input box" (fix(runtime): settle a quiet Codex composer as ready on every version #23765): that holds for fully drawn frames. On 0.157 the header rule settles regardless of the input box, and on 0.158 the result is a silent 60 s timeout. A named, immediate stop tells the coordinator what to answer. It also never types into "Update available", where Enter changes the user's installed Codex.
  • Why rows, not headings: each rule reads what Codex paints, and each one is pinned to a captured transcript on both versions.
  • Alternatives considered:
    • Passing the task on Codex's command line: the task includes the worker's terminal handle and a capability that exist only after the terminal is created.
    • Deciding both "ready" and "blocked" for Codex from Orca's in-process screen, and confirming the task landed before pressing Enter: sturdier, and planned as a follow-up, but too large for this fix.

Known limits (planned follow-up):

  • The checks still depend on the order text appears in the text copy. The follow-up above removes this class of edge case.
  • A Codex 0.157 session without the shared background server, with no warnings and a status line of 0–1 items, draws no ·. It then depends on Orca's in-process screen, and without one worker-start times out instead of typing.
  • A future startup question with new wording isn't recognized until it is captured.
  • Codex's working-directory question (resume and fork only, not 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".

main, Codex 0.157: task arrives cut off

This PR, Codex 0.157: the complete task, starting "You are working inside Orca".

PR, Codex 0.157: complete task

Main, Codex 0.157 "Hooks need review": Orca's Enter answered the question and opened Codex's hooks page; no task was submitted.

main, Codex 0.157: Enter answered the hooks question

This PR, Codex 0.157 "Hooks need review": worker-start stopped in 4 s; the question is untouched.

PR, Codex 0.157: hooks question untouched

This PR, Codex 0.157 "Update available": worker-start stopped in 3.7 s; "Update now" is untouched.

PR, Codex 0.157: update question 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):

    • 0.157 while it installs its server
    • the 0.158 greeting
    • the 0.158 model announcement
    • "Update available", "Hooks need review" and the retired-model notice, each on 0.157 and 0.158

    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:

    • Every 0.157 capture (and fix(runtime): settle a quiet Codex composer as ready on every version #23765's 0.150.1 and 0.155.1) is not ready while the provisional header is up, and ready at the end. A tui-idle wait does not settle while 0.157 installs its server, including from the visible-screen probe.
    • Each startup-question capture is never ready while up. It reports its reason from its first key row on, stops a tui-idle wait 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.
    • Codex's enter confirm · esc back picker 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.
    • Targeted readiness suites: 306 passed.
    • tc-gate pnpm tc:node, oxlint, and check:code-quality:changed -- origin/main: pass.
  • Live worker-start (main 2d358df8af vs this PR 82fcca49ed3): 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.

    • 0.157 plain: main pasted at 1.6 s during model: loading and delivered 4172/5188 characters. The PR pasted 0.5–1.2 s after the live chat, delivering 5188/5188 (2 of 2 rounds).
    • 0.158 plain: both ready with 5188/5188.
    • 0.157 hooks review: main answered the question and reported ready; the PR stopped in 3.97 s with agent-hooks-review-prompt, and 0 bytes were typed.
    • 0.158 hooks review: main timed out after 59.9 s; the PR stopped in 3.89 s, and 0 bytes were typed.
    • "Update available", this PR: 0.157 stopped in 3.69 s and 0.158 in 3.89 s with 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-idle wait settled.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: the rules read terminal text only. The captures are from macOS.
  • SSH: the checks run where the terminal wait runs, on that runtime's text copy and emulator; no wire change.
  • Mixed versions: no new blocked-reason value; all three already exist.
  • Performance: the new checks run only while a tui-idle wait or a delivery check is active. They cover the last 12 lines, or one scan of the already-built text copy.
  • Not caused by this PR, seen in QA:

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Live QA: fresh-profile worker-start on a remote Mac

Setup for every round:

  • A fresh Orca profile and a throwaway Codex home.
  • Codex run by its full binary path, with the update check off.
  • A dummy API key and an unreachable model endpoint, so the model call fails by design after the task is submitted.
  • The terminal byte stream recorded with macOS script -r, which timestamps input and output.
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.
@brennanb2025 brennanb2025 changed the title fix(runtime): wait for Codex's live chat before typing a worker brief fix(runtime): wait for Codex's live chat, and stop at its startup dialogs, before typing a worker brief Sep 29, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

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: 255d7ce5dec.

What the user gets:

  • Codex 0.157: worker-start delivers the complete task. On main it arrives missing its first ~1 KB.
  • Codex 0.158: worker-start works. On main it fails at agent_readiness after 60 s.
  • Startup questions: when Codex shows one ("Update available", "Hooks need review", a model notice or announcement), worker-start stops within seconds with the reason and types nothing. On main, 0.157 could type the task into "Update available", where Enter picks "Update now" and updates Codex; 0.158 timed out without a reason.

Red CI is not caused by this PR. Every failing job (typecheck, static analysis, persistence, native smoke) fails with Could not resolve "./codex-structured-journal-provider-verdicts" in src/main/codex/codex-background-task-frames.ts. That file isn't touched here. Main itself is broken: #23682 removed that module while code merged earlier from #22553 still imports it. #23783 fixes it; re-run CI once it lands. Locally on this head: tc:node, the changed-code quality gate, oxlint and the readiness, transcript and serializer-replay suites all pass.

What review changed (all pushed)

  • Serializer replay test: registered the new captures in it. CI was red on the original head because of this.
  • Other agents' readiness unchanged: the visible-screen check keeps Qoder, and every agent other than Codex, on its previous rule. The first version sent Qoder to its input-box check without the "agent is working" guard.
  • Removed a filter no capture backed from the live-chat check, and lowercase the text once instead of twice.
  • 0.158 model announcement clears once answered. Before, a pane stayed reported as blocked after the user answered it.
  • Startup questions matched by what 0.157 and 0.158 really print. The update, hooks-review and model-notice matchers only knew the old Press enter to continue/confirm wording. They now also match the rows these versions really print, written against six new captures: each question on each version, recorded in a throwaway Codex home with no keys sent.
  • A question left over from an earlier launch in the same pane no longer hides a new one.

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.

Scenario main This PR
Codex 0.157, first launch Task pasted during startup; Codex got 4172 of 5188 characters, starting mid-word (2 of 2) Pasted after the live chat; 5188 of 5188 (3 of 3, plus a second launch with the server already installed, plus one on the final head)
Codex 0.158, first launch Failed at agent_readiness after about 60 s 5188 of 5188 (3 of 3, plus one on the final head)
0.158 "Try new model" announcement Timed out after 60 s with no reason Stopped in 5.8 s with codex-model-migration-prompt; nothing typed
"Update available" (0.157 and 0.158) not run live (typing into it would update Codex) Stopped in about 4 s with agent-update-prompt; nothing typed
"Hooks need review" (0.158) not run live Stopped in 4 s with agent-hooks-review-prompt; nothing typed
Answering the 0.158 update question with Esc ("skip") not run live Chat came up, and the next tui-idle wait settled instead of reporting blocked

Codex 0.157, main: the task arrives cut off, starting mid-word at "cceeded when the".

main, Codex 0.157: task arrives cut off

Codex 0.157, this PR: the complete task, starting "You are working inside Orca".

PR, Codex 0.157: complete task

Codex 0.158, main: Codex is ready, but worker-start timed out and typed nothing.

main, Codex 0.158: worker-start timed out

Codex 0.158, this PR: the complete task.

PR, Codex 0.158: complete task

Codex 0.158 model announcement, this PR: stopped, with nothing typed.

PR, Codex 0.158: model announcement untouched

Codex 0.157 "Update available", this PR: stopped, and "Update now" is untouched.

PR, Codex 0.157: update question untouched

Codex 0.158 "Update available", this PR: stopped, with nothing typed.

PR, Codex 0.158: update question untouched

After one Esc ("skip") on that question: Codex's live chat, and the pane is no longer reported as blocked.

PR, Codex 0.158: live chat after skipping the update

Codex 0.158 "Hooks need review", this PR: stopped, with nothing typed.

PR, Codex 0.158: hooks review untouched

Replay checks

  • Every capture, before and after: all captured transcripts in the repo (44, every agent) were replayed frame by frame on main and on this head. No non-Codex agent's verdict changed on any frame. The only changes are Codex frames that now read "not ready" on the provisional screen, "ready" on the 0.158 greeting, or "blocked" on a startup question.

Known limits (listed in the PR body)

  • Text-order checks remain: the checks still depend on the order text appears in Orca's text copy of the output. A follow-up is planned to decide "ready" and "blocked" for Codex from Orca's in-process screen, and to confirm the task landed in Codex's input box before pressing Enter.
  • Some sessions have no footer dot: a Codex session without the shared background server, with no warnings, and with a status line of 0 or 1 items draws no ·. worker-start then relies on Orca's in-process screen, and times out without one.
  • New wording isn't recognised: a future startup question with new wording isn't recognised until it's captured.

Cherry-pick note

Found during QA, not caused by this PR (same on main)

  • Blocked reason only in error text: when worker-start stops at a startup question, the reason appears only inside its error text (lastError: "Agent startup blocked: agent-update-prompt"), with a generic failed state. terminal wait --for tui-idle does return it as a separate blockedReason field.
  • Blocked worker has no sidebar row: a worker that failed or stopped at a startup question gets no row in the left sidebar. To see and answer the waiting question, you have to open the workspace and pick the worker's tab.

@brennanb2025
brennanb2025 marked this pull request as ready for review September 29, 2026 04:36
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6b6954c0-645d-4961-bce8-35d2578f66ba

📥 Commits

Reviewing files that changed from the base of the PR and between bd5dca4 and 255d7ce.

📒 Files selected for processing (28)
  • src/main/daemon/serialize-grid-transcript-replay.test.ts
  • src/main/runtime/__fixtures__/codex-0157-fresh-home-daemon-install.meta.json
  • src/main/runtime/__fixtures__/codex-0157-fresh-home-daemon-install.txt
  • src/main/runtime/__fixtures__/codex-0157-hooks-review-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0157-hooks-review-dialog.txt
  • src/main/runtime/__fixtures__/codex-0157-model-retired-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0157-model-retired-dialog.txt
  • src/main/runtime/__fixtures__/codex-0157-update-available-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0157-update-available-dialog.txt
  • src/main/runtime/__fixtures__/codex-0158-fresh-home-greeting.meta.json
  • src/main/runtime/__fixtures__/codex-0158-fresh-home-greeting.txt
  • src/main/runtime/__fixtures__/codex-0158-hooks-review-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0158-hooks-review-dialog.txt
  • src/main/runtime/__fixtures__/codex-0158-model-announcement-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0158-model-announcement-dialog.txt
  • src/main/runtime/__fixtures__/codex-0158-model-retired-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0158-model-retired-dialog.txt
  • src/main/runtime/__fixtures__/codex-0158-update-available-dialog.meta.json
  • src/main/runtime/__fixtures__/codex-0158-update-available-dialog.txt
  • src/main/runtime/agent-transcript-replay-test-harness.ts
  • src/main/runtime/codex-0158-readiness-transcripts.test.ts
  • src/main/runtime/codex-header-readiness-transcripts.test.ts
  • src/main/runtime/codex-startup-dialog-transcripts.test.ts
  • src/main/runtime/codex-terminal-readiness.ts
  • src/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.ts
  • src/main/runtime/qoder-transcripts.test.ts
  • src/main/runtime/startup-dialog-blocked-signals.ts
  • src/main/runtime/terminal-wait-detection.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Adds test fixtures for terminal startup dialogs.

The PR appears safe to merge, with the previously reported quoted-shortcut false block remaining as non-blocking feedback.

Findings

  1. P2 Quoted shortcut blocks terminal waits ▶

Summary

This PR delays Codex worker input until the startup screen has given way to a ready chat and identifies startup dialogs as blocked instead of typing into them.

  • Adds captured Codex 0.157/0.158 transcripts and replay tests for provisional screens, dialogs, and ready chats.

Reviews (2) · Last reviewed commit: "fix(runtime): don't name Codex's mid-ses..."

Comment on lines +58 to +60
const modelNoticeIndex = lastMatchIndex(normalized, CODEX_MODEL_NOTICE_KEY_ROW_RE)
if (modelNoticeIndex !== -1) {
candidates.push({ reason: 'codex-model-migration-prompt', index: modelNoticeIndex })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Codex readiness extracted to a dedicated module — codex-terminal-readiness.ts now owns findCodexReadyPromptIndex, the new findCodexHeaderIndex, isCodexProvisionalStartupText, and the screen header/compact-header rules, with the provisional model: loading screen refused as ready.
  • Startup dialogs matched by the rows Codex actually prints — startup-dialog-blocked-signals.ts recognizes update available ·, enter continue ·, enter confirm ·, enter/esc continue ·, and the 0.158 model announcement's two fixed choices, keeping the legacy press enter to … wording as a fallback.
  • Blocked signal now suppresses the text readiness path — isKnownReadyPromptBody requires codex/unknown panes to be non-provisional for the text rule, and the dismissed-modal check gained findCodexHeaderIndex so 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`.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025
brennanb2025 marked this pull request as draft September 29, 2026 06:31
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.
@brennanb2025 brennanb2025 changed the title fix(runtime): wait for Codex's live chat, and stop at its startup dialogs, before typing a worker brief fix(runtime): wait out Codex 0.157's startup screen, and stop at Codex's startup dialogs, before typing a worker brief Sep 29, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

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 82fcca49ed3. CI: 19 checks pass, 17 skipped, 0 failed. The red checks under the previous head came from main's broken build (a module #23682 removed was still imported), and main has since fixed that (#23801).

What changed in the rework:

Claims re-checked against current main

Claim Current main (with #23765) This PR
Codex 0.157 first launch loses the start of the task Still broken, live and in replay: the header rule settles on the provisional screen Fixed: pasted after the live chat, complete
Codex 0.158 worker-start fails Fixed by #23765, live: ready, complete Unchanged (#23765's rule)
Startup questions Still broken: 0.157 types into them (live: Enter answered "Hooks need review" and reported ready); 0.158 times out after 60 s without naming them (live: hooks review) Stops in about 4 s with the named reason, types nothing
One-frame spinner title counted as a turn Code: a single working title after the pre-Enter baseline counts as the turn starting. In the recorded runs the startup spinner frame lands before Enter, so the truncated-task run's "observed" was a real turn. But live round 3 showed main report "turn observed" on 0.157 "Hooks need review" with no task submitted Not changed here; with this PR, that run is stopped as blocked before anything is typed

Live QA round 3 (remote Mac; main 2d358df8af vs this PR 82fcca49ed3)

Builds and rig were created for this round only. Each round used a fresh Orca profile and a throwaway Codex home, and the model endpoint fails by design. The real Codex install and config were unchanged after every round.

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.

main, Codex 0.157: task arrives cut off

This PR, Codex 0.157: the complete task.

PR, Codex 0.157: complete task

Main, Codex 0.157 "Hooks need review": Orca's Enter answered the question.

main, Codex 0.157: Enter answered the hooks question

This PR, Codex 0.157 "Hooks need review": untouched.

PR, Codex 0.157: hooks question untouched

This PR, Codex 0.157 "Update available": untouched.

PR, Codex 0.157: update question 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-start takes 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-start puts the blocked reason only inside its error text (lastError), with a generic failed state.
  • No sidebar row for a blocked worker: a blocked or failed worker gets no row in the left sidebar.

@brennanb2025
brennanb2025 marked this pull request as ready for review September 29, 2026 08:16
@brennanb2025
brennanb2025 merged commit 36c473e into main Sep 29, 2026
36 checks passed
brennanb2025 added a commit that referenced this pull request Sep 29, 2026
…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.
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.

1 participant