Repository navigation
test(e2e): mount-authority spec polls through the host's "can't answer yet" terminal list - #30743
Conversation
…terminal list First-mount adoption briefly makes terminal.list refuse with terminal_surface_ownership_unavailable. Thrown out of an expect.poll callback, that ended the poll instead of retrying it, so the spec failed whenever a slow runner's probe landed in that window.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
One end-to-end test asks Orca for its terminal list again and again until the list looks right. For a split second while a workspace first opens, Orca answers "I can't say yet", which is on purpose. The test treated that answer as a crash and stopped asking, so it failed on slow CI machines. The test now waits through that answer and keeps asking.
What Changed
live-background-terminal-mount-authority.spec.ts› "adopts runtime-owned agent and Setup PTYs on first mount" failed at random withError: terminal_surface_ownership_unavailable. It failed twice in the advisory "layout owner (switch on) / changed e2e specs" job, on PRs fix(projects): removing a project on this computer stops its chats, pages and every terminal on the host #30728 and refactor(pane-layout): retire the unread intent tag; renamedLeafIds is the one layout delta #30734 (runs 39252973854 attempt 1 and 39256965951). Neither PR touched terminals, and a re-run passed.The mechanism, confirmed by instrumenting a local build: when the workspace is first activated, the renderer publishes its newly mounted tabs before their panes have attached, so every leaf carries
ptyId: null. The host's remount guard (isLeafRemountingLivePty, from #29252) keeps an existing binding only whenptyController.hasPtyalready knows the PTY, and at that moment it doesn't yet. For one graph update (about 10–60 ms locally) every terminal in the workspace, including the untouched canary, reads as unbound. While the adoption spawns are in flight,terminal.listrefuses withterminal_surface_ownership_unavailable(pty-terminal-summary.ts:60) instead of reporting them as orphans. Playwright'sexpect.pollretries failed matchers but ends immediately when the polled callback throws, so a single refusal failed the test.The change:
tests/e2e/helpers/terminal-inventory-observation.ts:readFreshTerminalInventoryalready treatedterminal_liveness_unavailableas "no observation yet". It now treatsterminal_surface_ownership_unavailablethe same way.readWorktreeTerminalsgoes through that helper. All three of its callers are polls whose matchers reject an empty or undefined read.Why
Is main broken? No. On current main (36913fd) the spec passed 6 of 6 and 8 of 8 locally with the layout-owner switch on, and 6 of 6 with it off. The job that failed is advisory (not in
verify.needs) and was added today (#30582), which is why this test, which has always been timing-dependent, has only now started showing up on unrelated PRs. No recent merge caused it.Linked Issue
N/A (CI flake found on #30728 and #30734)
Visual Proof
N/A: test-only change, with no UI or behavior change.
Testing
On macOS, with headless Electron and
ORCA_BACKGROUND_LAUNCH=1:terminal_surface_ownership_unavailablerefusals intoterminal.listright after activation. The spec as it is on main fails with exactly the CI error. With this fix, the same injection passes.terminal.listloop across activation. In both switch modes, all three terminals readORPHANfor about 10 ms right after the first-mount graph publish, and the host loggedknows: falsefromhasPtyfor every leaf.terminal-inventory-observation.unit.test.ts: it fails on main for the ownership refusal and passes with the fix.AI Disclosure
Review
Agent skill upstream boundary
Notes
Test-only change. It has no security, platform, SSH, mobile or wire impact.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)