Skip to content

Agent status C3: distinguish ready from merely visible - #21055

Closed
brennanb2025 wants to merge 15 commits into
mainfrom
brennanb2025/agent-status-c3-readiness
Closed

brennanb2025 wants to merge 15 commits into
mainfrom
brennanb2025/agent-status-c3-readiness

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Orca should not call an agent ready just because its terminal is quiet or still shows an old prompt. This draft separates four different facts: the agent can accept input, Orca wrote the prompt, the provider started the requested turn, and that turn finished.

The branch improves startup recovery and makes unsupported evidence explicit, but it is not safe to merge yet. The current head still has a reproduced high-severity false positive: after a real Working report becomes old, an unrelated terminal byte can make a newly captured copy of the same old ready screen count as fresh readiness.

Files Added Deleted Net
Test 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1013 $\color{#cf222e}{\Huge{\mathbf{−}}}$​199 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​814
Prod 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1500 $\color{#cf222e}{\Huge{\mathbf{−}}}$​479 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1021

User-facing before / after

Before this PR: a quiet screen, a matching title, or a successful terminal write could be used as proof of several different events. Slow startup could be reported as failure even while the agent kept running; a prompt sitting unsubmitted in a composer could look delivered; and an unsupported provider could be treated as ready.

After this PR, where the new paths are correct: readiness is reported as ready, busy, unsupported, or unknown; prompt acceptance is separate from provider turn start; uncertain local and paired-worker startup keeps the live terminal and recovery commands instead of discarding control; and automation completion waits for a new observed start before accepting a later finish.

Still broken at this head: terminal screen capture order is still being used as proof of a provider state change. A retained ready screen can therefore satisfy terminal wait --for tui-idle after Working expires even though no new ready transition occurred. This can submit the next action while the agent is still busy. Passing unit tests do not disprove this reproduced case.

Issue records

No issue is fully closed by this draft.

Partially addressed by the implemented startup, receipt, and recovery changes:

  • STA-3844, STA-4674, and STA-5615 — readiness uncertainty no longer has to discard a live worker, terminal, dispatch identity, or recovery path.
  • STA-4495 — bytes accepted, prompt submitted, and provider turn started are separate observations; ambiguous acknowledgement does not trigger an automatic resend.
  • STA-6432 — a fresh automation requires a new observed start before a later completion can settle it; dispatch-bound turn settlement still depends on C1/C2.
  • STA-2380, STA-5065, STA-6815, and STA-4353 — the relevant readiness, blocked-start, mail, and screen-read paths were reworked, but the stale-screen false positive prevents a closure claim.

Still open or assigned to dependent work:

  • STA-5095 and STA-7143 — Antigravity readiness remains deliberately unsupported because captured screens do not cover every startup/account/mode case; this PR does not make running Antigravity status accurate.
  • STA-3950, STA-2889, and STA-4675 — OpenCode, Claude, and Pi still need real provider signals for questions or permission waits.
  • STA-4973, STA-5196, STA-6600, and STA-7285 — WSL discovery, orphaned-pane presentation, remote synthetic completion, and unbound remote input need host/transport work outside this slice.
  • STA-6980 needs chat submission and transcript delivery work. STA-1180 remains diagnosis-first, and STA-1224 is a support/documentation question rather than proof of this failure mechanism.

Why this mechanism

A terminal write can succeed without the agent consuming it, and a visible prompt can be old while the agent is working elsewhere. The design therefore keeps readiness, input acceptance, provider turn start, pending interaction, and completion as separate observations tied to the same live terminal process. When the provider cannot prove one of them, the result is unknown and the user keeps the ability to inspect, type, cancel, or explicitly abandon the worker.

The alternatives considered were title-only detection, quiet-time detection, process presence, and treating every fresh screen capture as fresh readiness. The first three answer the wrong question. The fourth is the remaining defect in this branch: transport activity only proves that Orca read another frame, not that the provider became ready. The required correction is a provider-owned ready/turn transition for the specific operation, or an honest unknown result when no such signal exists—not another clock or sequence guard around stale text.

Scope, dependencies, and remaining work

  • Implemented: provider/launch capability table; explicit readiness results; terminal process and screen-capture fencing; bounded wait results; local and paired startup recovery; distinct prompt receipts; fresh-start automation observation; focused regression coverage.
  • Known blocker: the stale retained-screen false positive reproduced on this exact head must be removed and independently re-reviewed.
  • Evidence gaps: captured vendor transcripts beyond the current set, fresh authenticated provider flows, paired reconnect, direct SSH, mixed-version behavior, WSL, Windows/Linux, headless/daemon, and folder-workspace coverage.
  • Dependencies: C4 supplies real provider integration facts; C5 supplies committed execution identity; C1/C2 settle attributable turns; C7 publishes host results and removes synthetic reader behavior; C10 uses the same execution binding for membership. C5's earlier foundation overlaps the combined C5/C10 branch, so those two should not be recommended for independent merge without consolidation.
  • GitHub's current checks are red for static analysis and multiple test shards. Those failures remain blockers even though the focused local checks below pass.
  • The first conflict audit used fetched origin/main at 383c543e0f6651a6c2d99ecca5ab43fbedd1bee8. A final merge simulation was also clean after the shared fetched ref advanced to descendant 36cdb34097a7075718abe41c29d559101841166a; no unnecessary merge commit was added.

Validation at this revision

Freshly run at 21b8a14d03a4a42b2c7fb2af94b609745090e032:

  • Four focused readiness/receipt test files — 50 tests passed.
  • Node TypeScript check — passed.
  • Changed-file code quality — passed with zero new findings across 60 changed files.
  • Merge-tree, git diff --check, and conflict-marker checks against the fetched baseline — clean.

Earlier hidden/background Electron QA was run at 47ba36daffcd73dad12010491088bc011370dd94, not at this head. No fresh Electron or mobile QA was run here, and the stale-screen counterexample at the current head remains the controlling result. These checks establish only that the covered paths still pass; they are not independent review or acceptance.

Draft status

Draft / not merge-ready. Keep the reproduced semantic-readiness false positive, red hosted checks, missing provider/remote evidence, and lack of current-head independent review/QA visible. Conflict resolution did not fix any of those blockers.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review and validation handoff — 2026-09-16

Draft / not merge-ready. Published at the user's request before review/QA completion. Published head: 21b8a14d03a4a42b2c7fb2af94b609745090e032.

What has been done

Multiple independent reviews and correction rounds were performed. At current head, the adversarial reviewer reproduced the real runtime emulator/parser/capture/matcher/wait failure described below. A focused 50-test run, node typecheck and changed-code quality passed separately; passing tests did not disprove the bug. Earlier hidden Electron testing covered real provider transitions at 47ba36d, NOT this head.

These are recorded worker/reviewer results from the stated revisions, not a fresh coordinator rerun, CI result, or blanket approval of today's PR head. Recovery/review workers used GPT-5.6 Sol xhigh; provider interruptions prevented some follow-up stages from finishing.

What still needs to be done

KNOWN HIGH-SEVERITY BUG: retained ready text can satisfy terminal.wait after a Working fact expires and unrelated escape/title bytes advance output sequence. Replace recency-as-readiness with verified semantic readiness or bounded unknown; do not add another clock/sequence guard. The new correction worker stopped on a provider disconnect before producing a correction. Vendor transcript proof, fresh-auth cases, paired/SSH/mixed-version coverage, independent re-review and fresh exact-head Electron QA remain.

Before marking ready: address proven findings, reconcile current main and cross-batch overlap, complete independent review of the final diff, rerun relevant tests/typechecks/quality, and perform fresh manual Electron QA against that exact head. Use background/hidden CDP validation; unavailable auth/platform scenarios remain explicitly unverified. No successful final-head review or QA should be inferred from old report filenames or task completion labels.

Related batch PRs

C1: #21053 · C10: #21054 · C2: #21056 · C3: #21055 · C4: #21057 · C5: #21058 · C6: #21059 · C7: #21060

The remaining full-batch work stays open; opening this draft does not mark those requirements complete.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Conflict/description update: head remains 21b8a14d03a4a42b2c7fb2af94b609745090e032; fetched integration baseline is origin/main at 383c543e0f6651a6c2d99ecca5ab43fbedd1bee8.

GitHub reports this PR mergeable, and a local merge-tree check was clean, so there were no conflict files or resolution commits; I did not add another merge from main. I rewrote the title/body in plain language, linked all verified C3 records, separated partially implemented behavior from routed/still-open work, and kept the reproduced stale-screen readiness false positive prominent.

Fresh checks: four focused readiness/receipt files (50 tests), node typecheck, changed-file quality (0 new findings across 60 changed files), git diff --check, and conflict-marker scan. Remaining blockers: the current-head high-severity retained-screen false positive; red hosted static-analysis/test checks; incomplete vendor/remote/cross-platform evidence; and no current-head independent re-review or Electron QA (the prior hidden QA was at 47ba36daff).

Readiness evidence must be provider-initiated. A first-party status frame and
an OSC title are bytes the provider chose to emit; a screen capture is a read
Orca chose to perform, so it can re-read a pre-turn screen but can never show
that the provider left the turn.

hasEvidenceAfterFirstPartyStatus compared a capture's outputSequence against
the working frame's, so after the status aged out any unrelated byte (a cursor
move, a title repaint) plus a fresh capture of the SAME retained ready prompt
scored as a new ready transition, and `terminal wait --for tui-idle` settled
into a busy agent. Drop that branch: only a later provider fact clears an
unfinished turn, and a title does not vouch for retained screen text either.
A done frame replaces the row outright, so the normal turn end is unaffected.

Ageing out now loses the evidence that a turn was open rather than supplying
evidence that it closed, so the result is an honest unknown.

Also fix the initial synchronous tui-idle read, which passed an evidence
cursor derived from the same record it was testing. hasEvidenceAfter requires
strictly-newer, so that read demanded a transition that had already happened
and an already-idle terminal could never satisfy it; the wait then ran to
timeout and deadlocked orchestration mail delivery to an idle recipient. The
fence still guards every deferred decision, where it belongs.

The screen-recapture test asserted the defect under a name claiming the
opposite; invert it and cover the done-frame and title-does-not-unlock cases.
…e waits

This branch added `does not let a retained explicit title satisfy a new wait
operation`, which fenced the initial synchronous tui-idle read against the
operation performing it. That fence broke a contract that predates the branch:
`notifyMessageArrived` to an already-idle recipient (#12536) must push without
waiting for another agent-status transition. An idle, silent agent emits
nothing new, so the wait never settled and mail delivery deadlocked.

The intent behind the added test is right — a retained idle title must not
settle a wait an automation just started — but transport recency is the wrong
instrument for it, and it is the same read-versus-transition conflation the
screen branch had. The protection now comes from the provider: once a turn is
open and unretracted, a retained idle title cannot clear it, which is exactly
the case the fence was defending.

Replace the test with the two halves it was conflating: an already-idle
terminal settles, and a retained idle title does not settle while a provider
turn is still unfinished.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing this draft from the September 14 agent-status plan. That plan was re-examined against current main and replaced.

This branch conflicts with main, and its central work duplicated contracts that had already merged (the canonical status store and the child-work contract landed on 15–16 September). The replacement work is being done as smaller root-cause PRs, each planned, challenged and reviewed first.

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