Skip to content

fix: distinguish startup activity from completed turns - #2753

Merged
yansfil merged 5 commits into
mainfrom
fix/startup-completion
Nov 21, 2026
Merged

yansfil merged 5 commits into
mainfrom
fix/startup-completion

Conversation

@yansfil

@yansfil yansfil commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2751

Summary

Problem

A fresh Codex pane could show Done before the user asked anything.
MCP startup animates the terminal title, and Hide interpreted the animation stopping as a completed answer.
The fix uses the program's explicit lifecycle report to distinguish startup readiness from a finished turn.
Visible setup and selection menus keep their input gate, and failed turns still finish.
Existing screen inference remains available when the program does not report its state.

Before → After

Before After
What the user gets A completion appears during startup. Startup waits; a real completed answer creates the completion.
Screen Reported startup completion Fresh startup waits
Flow Start → title animation stops → Done before a prompt Start → Idle → first prompt → answer → Done

Review the absence of a startup completion and the actual first-answer completion below.

Not verified

  • Physical connected-device and mixed-version binary journeys were not run locally; optional-field and negotiation tests cover compatibility.
  • Native UI verification was run on macOS; Linux and Windows are covered by CI, not local native captures.
  • Earlier attempts hit Windows fixture compilation and runner-wide startup delays. The exact stall cause remains unidentified; all first-failure evidence is retained and compiler repair is tracked separately in fix: preserve each Windows fixture build stage budget #2053.
  • Retained completion can survive a session replay, and closing a menu after an engine-only completion can repeat unread news. These minor read-ownership limitations remain follow-ups.
  • An earlier broad node run failed an SSH ended-process test; its focused rerun passed. The original failure is retained; the subsequent complete affected-library suite passed.
Evidence
  • A private candidate app launched real Codex 0.169.0 without a prompt, stayed idle, then completed the first real answer, startup-ok.
  • Exact native window captures were inspected after a candidate redraw; renderer captures and PID/window identity were recorded separately.
  • The installed app and operator's running panes were left untouched.
  • Actual PTY/watch and node transport scenarios each passed ten iterations, 20/20 total with zero retries, including coalesced Error → Idle reports.
  • Two independent-review regressions failed before the correction: a failed turn remained Working, and a visible blocker was replaced by Idle. Both pass after the correction, and follow-up review closed both serious findings with no new blocking findings.
  • CI caught a reduced legacy-name count missing from its allowlist; the count was lowered to match the document, and the exact checker plus its twenty tests passed locally.

The first real answer creates a completion

Tests
  • Layer: Unit tests cover state ownership and bounded parsing; protocol tests cover negotiated frame compatibility; actual PTY/watch and node integration tests cover transport and retirement.
  • Catches: Startup Working → Idle creating a completion, Done/Error → Idle arriving in one output write losing a real completion, failed turns remaining Working without a Stop hook, and startup settling into a visible menu. Routing explicit Idle through screen inference made the startup regression fail; restoring the fix passed.
  • Repeat: Two changed integration scenarios passed ten iterations each without retries. CI repeat results will be checked separately.
  • Waits: Existing state-driven fixture waits observe holder facts and node events; no new production timer or sleep.
Risky files
  • hide-holder-protocol/src/lib.rs: negotiated wire extension stays absent for an old watch, before the existing package extension.
  • hide-holder/src/osc.rs: one bounded report per pane; retain Done/Error across same-app Idle before facts coalescing; clear on lifecycle retirement.
  • hide-node-link/src/holders.rs and hide-node/src/terminal/holder/watch.rs: optional device facts default absent and clear on watch loss.
  • hide-core/src/engine/own/agents.rs: visible blockers win, then matching explicit state takes priority; core keeps completion sequencing and read ownership.
  • Existing OSC parsing and changed-facts publication carry the report; no additional process, worker, polling loop or notification fan-out.

Human review focus: check negotiated compatibility and retained completion boundaries, and judge the captured startup/first-answer states.

Verification record
  • PRD: agents/prd/startup-completion/prd.md (sha256 eb430870da1721f75277b379a15b3f51c3486c566ea1ac10be8cda5b4d9dae63)
  • Base 84d6aeb → head 6ec8140, verified 2026-11-21T00:29:48.146Z: PASS
  • Verification report: agents/runs/startup-completion/verification-report.json and agents/runs/startup-completion/verification-report.md; source fingerprint 0f9bcf784299a80f50843c02059096e83ad57c62b24ff280a3c8bfc736ecc2bd
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test-scoped -p hide-holder-protocol -p hide-node-link -p hide-node -p hide-holder -p hide-core --lib (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh build -p hided -p hide-agent-hooks -p hide-holder (exit 0)
    • S3: GREEN bash scripts/verify-cargo.sh clippy -p hide-holder-protocol -p hide-node-link -p hide-node -p hide-holder -p hide-core --all-targets -- -D warnings (exit 0)
  • Fidelity review at 6ec8140: B1-B6 match the implementation; no Fix now findings; author-produced runtime evidence and sealed PASS inspected in a same-head addendum.
  • Code review at 6ec8140: all six required perspectives covered; Error/hook closure and visible-blocker gates confirmed; earlier coalesced-completion defect closed; no current Fix now findings.
  • Additional independent review at 6ec8140: two serious findings (Error stranding Working, and explicit readiness overriding screen Blocked) closed after predicted failing-before/passing-after regressions; no new blocking findings. Fixed wire vocabulary accepted; replay retention and engine-only menu-close unread news remain minor follow-ups.
  • Review limits: read-only reviews of source and author logs/captures, not independent runtime execution; actual refused provider turn and numbered menu were not exercised natively.
  • Remote CI at 6ec8140: attempt 3 is SUCCESS; all 42 successful jobs complete. Windows E2E shard 3/3 passed all 30 tests without a flaky retry. The unchanged Windows npm spawn journey also passed 10/10 repetitions in run 44845843818.
  • Windows development exception: latest main run 44797207758 failed only Windows jobs and aggregation; all planned non-Windows checks passed. Compiler diagnosis and repair are owned by fix: preserve each Windows fixture build stage budget #2053. Independent review classified the startup-job stall as unrelated to this lifecycle-report change, which changes neither the failing fixture compiler nor the start journey. This PR's own latest required Windows lanes passed. The unidentified runner stall remains a diagnostic follow-up, not a claimed product fix.
  • Local totals: 5,290 affected-library tests passed (20 existing ignored), 6 holder OSC tests passed, 25 core-agent tests passed, and 20/20 actual PTY/node stress runs passed without retries.
  • Evidence: 11 registered (9 log, 2 screenshot); paths are local to the run directory
    • agents/runs/startup-completion/native-pass.log
    • agents/runs/startup-completion/holder-watch-final.log
    • agents/runs/startup-completion/defect-check.log
    • agents/runs/startup-completion/coalesced-repeat.log
    • agents/runs/startup-completion/native-final-head.log
    • agents/runs/startup-completion/opus-regressions-before.log
    • agents/runs/startup-completion/opus-core-after.log
    • agents/runs/startup-completion/opus-repeat.log
    • agents/runs/startup-completion/native-opus-fixed.log
    • agents/runs/startup-completion/startup-ready.png
    • agents/runs/startup-completion/first-answer.png
  • Changed paths: 13 (see Files changed)
  • Delivery: verified local candidate, user-authorized PR update, branch fix/startup-completion, base main

@yansfil
yansfil added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit cb0a3fc Nov 21, 2026
156 of 162 checks passed
@yansfil
yansfil deleted the fix/startup-completion branch November 21, 2026 01:11
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.

Fresh Codex appears as an unread completed turn before its first prompt

1 participant