Skip to content

fix(orchestration): say why a worker's brief went unsubmitted, and never press Enter into a dialog - #47087

Merged
Jinwoo-H merged 9 commits into
mainfrom
codex-start-unconfirmed-evidence
Nov 22, 2026
Merged

Jinwoo-H merged 9 commits into
mainfrom
codex-start-unconfirmed-evidence

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca types a task into a worker's terminal and never sees the work start, the message it sends now explains what happened when it pressed Enter. Orca also no longer presses Enter when a dialog is on the worker's screen.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74
Prod 21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​557 $\color{#cf222e}{\Huge{\mathbf{−}}}$​120 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​437

What Changed

When a worker start types the brief but never sees the turn begin, the coordinator's "Worker's brief may not have been submitted" message now says what happened at Enter time, so a person (or the coordinator) can tell the three causes apart: the Enter was lost, a dialog took it, or the turn ran but wasn't seen.

Before, after a lost Enter:

Your worker's brief may not have been submitted; check it. Orca typed task … into worker term_…, but never saw its turn start: the brief may still be waiting in its prompt.
If the brief is still in its prompt, submit it with … `terminal send --terminal term_… --enter`.
…
Worker's screen: …
Text waiting in its prompt: [Pasted Content 13457 chars]

After, same forced lost Enter (isolated rig, Codex 0.169):

Your worker's brief may not have been submitted; check it. …
Orca typed the brief 0.0 s after the agent was ready and pressed Enter 1.5 s later once its screen went quiet.
Since the Enter, no turn start has been seen; its last status report was at rest, 1.5 s before the Enter.
If the brief is still in its prompt, submit it with … `terminal send --terminal term_… --enter`.
…

A worker brief is also never submitted into a dialog. If, after the paste, the screen shows a dialog (the existing exact detectTerminalWaitBlockedReason check) or a permission prompt, Orca leaves the brief unsent and the start stays open:

Orca typed the brief 0.0 s after the agent was ready, but did not press Enter: a dialog showed on its screen (agent-interactive-prompt).
An Enter now would answer that dialog: tell the user to answer it in that terminal, then submit the brief with … `terminal send --terminal term_… --enter`.
Worker's screen:
<the dialog>

Before this, the same screen failed the start (agent_prompt_blocked, "Worker lost without reporting", Dispatch closed as failed) with the brief left in the terminal. A dialog the permission state didn't flag got the Enter.

Orca also holds the Enter, and says so, if someone typed into the worker's terminal after the paste (driving input since the paste that is not pointer or focus reports), because Enter would submit their text along with the brief. The check runs twice: once on the caught-up screen, and again after the write guard on the live grid, with no await before the Enter.

A withheld start is stored as stage submit_withheld. If Orca restarts before the alert goes out, the alert still says not to press Enter yet.

A start-blocked prompt seen before the brief went in no longer counts as proof that the turn ran. Before, it marked an unconfirmed start ready and the alert was never sent.

No extra Enter or retry is added.

Mechanism

  • writeTerminalAgentPrompt records when the paste and the Enter were written and what ended the render wait (quiet / exact draft / cap). These ride on the prompt receipt as an optional submit field.
  • Only worker-start briefs opt in, through withholdSubmitOnDialog. Before Enter they read the caught-up screen once. Other senders (mailbox pointers, coordinator dispatch, external messages) are unchanged.
  • At alert time, reportUnconfirmedWorkerStart reads the agent's prompt activity and its last status report (the newer of its hook status and the status it printed into the terminal) once (readTerminalAgentPromptAftermath). It adds the lines above. After a restart there is no delivery record, so the alert is the same as before.
  • Pre-write guards move into terminal-agent-prompt-guards.ts, and two report-id helpers move next to stopReportId. Both are moves, made to stay within the file-size limit.

Why

A brief left unsent in a worker's prompt can have three causes: the Enter was lost, a dialog took it, or the turn ran but Orca missed it. In each case the alert gave the same advice: press Enter. These facts tell the three apart, and they cost one read at alert time. Pressing Enter into a dialog answers it with its default choice, so for a dialog Orca waits for a person instead. An automatic second Enter was considered and not chosen.

Linked Issue

None.

Compatibility

submit is optional on the receipt, and old readers ignore it. Stored presence reports gain an optional startEvidence, so older stored reports still render.

Testing

  • I manually tested these changes locally (macOS, isolated rig)

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

  • Every added test fails without this change and avoids the test anti-patterns

  • dispatch-submit-withhold.test.ts drives the real runtime write path. With a dialog drawn over the paste, no \r is written and the receipt names the dialog. Without one, exactly one Enter is written. The dialog case fails with the change reverted (agent_prompt_blocked).

  • pnpm tc:node, tc:cli, tc:web, oxlint and oxfmt on the touched files, plus the terminal-input, worker and worker-start suites: all pass.

  • Live before/after in an isolated orca serve rig with a private profile:

    • forced lost Enter on a real Codex worker;
    • a stand-in agent that opens a dialog after the paste. On the after build it received no Enter. Normal Codex starts were still ready / observed in about 2 s.
  • Perf (see below): one caught-up screen read and one blocked-text scan before Enter, worker starts only. One activity read per unconfirmed alert. In the rig, Enter landed 1.6 s after the paste with the 1.5 s quiet gate.

Visual Proof

N/A for UI: no UI changes. The before and after alert text above is from the live rig.

Performance

None, because the only new work is one caught-up screen read and one blocked-text scan before the Enter of a worker-start brief, once per start, plus one activity read per unconfirmed-start alert. Other prompt senders skip it. In the rig, Enter still landed 1.5 s after the paste, set by the existing 1.5 s quiet wait.

Risk

Level: Low.

A worker start whose screen shows a dialog after the paste now stays open and alerts, where before it failed with agent_prompt_blocked. Revert is a plain revert. Older stored alerts and receipts read as before.

Known limits

  • Follow-up: the continuation prompt that resumes a terminal worker after a restart is a separate sender and does not use this dialog check yet.

  • Output that arrives after the final synchronous check is not seen; the write follows that check with no await in between.

  • Pointer reports (hover, clicks, wheel), focus reports and terminal replies don't count as typing. Anything else sent to the terminal after the paste does: keystrokes, pastes, terminal send, plugins.

  • The dialog check runs only when the composer shows no draft, so a brief shown inline can't hold itself back because its text reads like a dialog.

  • A restart in the moment between holding the Enter and recording submit_withheld leaves no record of the withheld Enter, so that alert gives the default advice.

…ver press Enter into a dialog

A start Orca never saw begin now tells the coordinator when the brief and its Enter went in, the agent's last status report, and whether a turn or permission prompt followed. A worker brief whose screen shows a dialog after the paste is left unsent and reported, instead of failing the start.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

Terminal prompt delivery now records paste timing, render-wait outcomes, and whether Enter was sent or withheld because of a dialog. Worker-start observation and reporting carry this delivery information and prompt aftermath into terminal stop evidence. Stop wording includes that evidence and gives dialog-specific next steps when Enter was withheld.

Merge Risk: Low · previous review 440ca

When a dialog blocks a worker's brief, the brief is now withheld and the alert explains why. Two small gaps remain: a dialog row that resembles the end of the brief could still receive Enter, and the alert may describe a dialog as current after it was dismissed. Both are edge cases and mergeable with owner awareness.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: the unconfirmed-start alert now explains why a worker's brief went unsubmitted, and Orca no longer presses Enter into a dialog. Both match the changeset (withhold…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template closely. It covers ELI5, What Changed, Why, Testing, Performance, Risk, and Compatibility, with concrete before/after alert text and a mechanism section…
Full details: Title check

Explanation

The title names the two main changes: the unconfirmed-start alert now explains why a worker's brief went unsubmitted, and Orca no longer presses Enter into a dialog. Both match the changeset (withholdSubmitOnDialog, start evidence, and the alert wording). The title is specific and follows conventional commit form. It is 98 characters, which is long, but it stays readable.

Full details: Description check

Explanation

The description follows the repository template closely. It covers ELI5, What Changed, Why, Testing, Performance, Risk, and Compatibility, with concrete before/after alert text and a mechanism section. Several template items are weak or missing: the Linked Issue section says 'None.' even though the template says there should always be one for outside contributors, and the AI Disclosure, Review, Agent skill upstream boundary, and Checklist items are not addressed. The Visual Proof section is N/A with a reason, which is acceptable. The Performance section is filled in. Because the core sections are substantive and the gaps are mainly administrative, the description is mostly complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Actionable comments posted: 4

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 94c0e861-da10-4835-9c2d-3e14d62d144e
Commits

Reviewing files that changed from the base of the PR and between e695e40 and 1cdb13e.

Files selected for processing: 19

  • src/main/runtime/orchestration/terminal-authority/legacy-worker-runtime-recovery.ts
  • src/main/runtime/orchestration/turn-delivery/send-agent-turn.ts
  • src/main/runtime/orchestration/workers/approvals/terminal-helper-approval-hold.ts
  • src/main/runtime/orchestration/workers/turn-stops/unconfirmed-start-evidence.ts
  • src/main/runtime/orchestration/workers/turn-stops/unconfirmed-worker-start.ts
  • src/main/runtime/orchestration/workers/turn-stops/worker-presence-report.ts
  • src/main/runtime/orchestration/workers/turn-stops/worker-turn-stop-report.ts
  • src/main/runtime/orchestration/workers/turn-stops/worker-turn-stop-wording.ts
  • src/main/runtime/rpc/methods/orchestration/worker/start/readiness/deliver-worker-dispatch-preamble.ts
  • src/main/runtime/rpc/methods/orchestration/worker/start/readiness/worker-start-readiness-settlement.ts
  • src/main/runtime/rpc/methods/orchestration/worker/start/readiness/worker-start-turn-observation.ts
  • src/main/runtime/terminal/input/agent-prompt-aftermath.ts
  • src/main/runtime/terminal/input/agent-prompt-write-options.ts
  • src/main/runtime/terminal/input/dispatch-submit-withhold.test.ts
  • src/main/runtime/terminal/input/orca-runtime-agent-prompt-request-correlation.ts
  • src/main/runtime/terminal/input/terminal-agent-prompt-guards.ts
  • src/main/runtime/terminal/input/terminal-agent-prompt-render.ts
  • src/main/runtime/terminal/input/terminal-agent-prompt.ts
  • src/shared/terminal/runtime/runtime-terminal-send-contract.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 108e7e13-83ce-41fe-aaca-c00e820c9504
Commits

Reviewing files that changed from the base of the PR and between d12eb8c and 19be71c.

Files selected for processing: 3

  • src/main/runtime/orchestration/workers/turn-stops/unconfirmed-start-evidence.ts
  • src/main/runtime/terminal/input/terminal-agent-prompt-guards.ts
  • src/main/runtime/terminal/input/terminal-agent-prompt.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd2f31a9-d795-42bd-a2bb-9745192d2ec5
Commits

Reviewing files that changed from the base of the PR and between 1874ebc and 440cab0.

Files selected for processing: 5

  • src/main/runtime/orchestration/terminal-authority/legacy-worker-runtime-recovery.ts
  • src/main/runtime/orchestration/workers/turn-stops/unconfirmed-start-evidence.ts
  • src/main/runtime/orchestration/workers/turn-stops/unconfirmed-worker-start.ts
  • src/main/runtime/orchestration/workers/turn-stops/worker-turn-stop-wording.ts
  • src/main/runtime/rpc/methods/orchestration/worker/start/readiness/worker-start-readiness-settlement.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Jinwoo-H and others added 4 commits November 22, 2026 15:55
…t, and hold it for typed input

After the screen read and the write guard, the write checks the live grid, permission state and input someone typed since the paste, synchronously before Enter. A start-blocked prompt seen before the brief no longer confirms the start.
…g a worker's Enter

Codex turns on any-motion mouse tracking and xterm sends its reports as the user's input, so a hover over a worker pane held the brief and told the coordinator someone typed. Only input that can change the program's text now counts. The alert also says Orca has seen no status report, rather than that the agent sent none.
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