From 07a767e2ebd3e4ff3480fd5a6f246ed71b7931f5 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Fri, 7 Aug 2026 03:41:38 -0400 Subject: [PATCH] test(terminal): tighten host restart evidence --- config/reliability-gates.jsonc | 17 +++++++++++++---- src/main/ipc/pty.test.ts | 1 + ...erminal-host-restart-background-sync.spec.ts | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 71fe2e2c8c0..8bae28c8f87 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -4409,13 +4409,22 @@ ], "evidenceRuns": [ { - "date": "2026-08-06", + "date": "2026-08-07", + "runner": "local", + "platform": "macos", + "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/pty.test.ts", + "result": "passed", + "durationSeconds": 5.84, + "summary": "The full PTY IPC file passed 449 tests, including one first-observation foreground sync after handler recreation and deduplication of the repeated presence signal." + }, + { + "date": "2026-08-07", "runner": "local", "platform": "macos", "command": "SKIP_BUILD=1 pnpm exec playwright test tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1", "result": "passed", - "durationSeconds": 12.8, - "summary": "The isolated headed host and separate paired desktop client retained the daemon PID and PTY ID across host relaunch, emitted one target foreground transition, and delivered target plus post-relaunch control input/output. The byte-identical run with only the unknown-state fix reverted failed at the missing target foreground transition." + "durationSeconds": 12.5, + "summary": "With the parking override captured by both host launches, the isolated headed host and separate paired desktop client retained the daemon PID and PTY ID across host relaunch, emitted one target foreground transition, and delivered target plus post-relaunch control input/output. The byte-identical run with only the unknown-state fix reverted failed at the missing target foreground transition." }, { "date": "2026-08-02", @@ -4545,7 +4554,7 @@ }, "redGreenEvidence": { "status": "complete", - "evidence": "The six-PTY ordinary-parking oracle was red in two independently observed stages: the parked paired remount first used detached attach and restored only rows 5,963–5,999, then the requested snapshot still lost to the current-screen replay until park reveals explicitly entered the capability-gated reattach coordinator. The candidate is green on headed and headless hosts, while disabling terminal.paired-parking.v1 makes the byte-identical oracle fail at its capability precondition and leaves the separately tested legacy lossy fallback green. The 64-PTY decorative-title control delivered 576 client events after convergence on unmodified main; the candidate delivers zero while preserving all 640 local frames, one current frame to a late client, and bell/idle transitions to both clients. The legacy no-output-pause control failed to request a reveal snapshot and kept hidden bytes on the xterm path; the candidate gates those bytes locally and restores one authoritative snapshot before live output. With stalled-stream recovery disabled, the host cursor advanced but the client remained frozen; enabling it repainted the marker with the same PTY and tab. The sequence-gap unit and headed paired oracle are red on current main and with only the new probe decision reverted: the authoritative host advances while the client stays stale after a successful probe. The candidate replaces the stream, repaints the marker, preserves PTY identity, and resumes I/O. Reverting the active-stream limit to 64 makes the exact 128-stream contract fail at 64; restoring 128 admits every intended stream, rejects 129, and reattaches it after one slot releases." + "evidence": "The six-PTY ordinary-parking oracle was red in two independently observed stages: the parked paired remount first used detached attach and restored only rows 5,963–5,999, then the requested snapshot still lost to the current-screen replay until park reveals explicitly entered the capability-gated reattach coordinator. The candidate is green on headed and headless hosts, while disabling terminal.paired-parking.v1 makes the byte-identical oracle fail at its capability precondition and leaves the separately tested legacy lossy fallback green. The 64-PTY decorative-title control delivered 576 client events after convergence on unmodified main; the candidate delivers zero while preserving all 640 local frames, one current frame to a late client, and bell/idle transitions to both clients. The legacy no-output-pause control failed to request a reveal snapshot and kept hidden bytes on the xterm path; the candidate gates those bytes locally and restores one authoritative snapshot before live output. With stalled-stream recovery disabled, the host cursor advanced but the client remained frozen; enabling it repainted the marker with the same PTY and tab. The sequence-gap unit and headed paired oracle are red on current main and with only the new probe decision reverted: the authoritative host advances while the client stays stale after a successful probe. The candidate replaces the stream, repaints the marker, preserves PTY identity, and resumes I/O. Reverting the active-stream limit to 64 makes the exact 128-stream contract fail at 64; restoring 128 admits every intended stream, rejects 129, and reattaches it after one slot releases. The host-relaunch oracle fails when unknown delivery state is coerced to foregrounded or a layout version becomes an output high-water; the candidate foregrounds the preserved daemon PTY once and resumes same-PTY input/output." }, "performanceBudget": { "required": true, diff --git a/src/main/ipc/pty.test.ts b/src/main/ipc/pty.test.ts index fd3348315dc..678cc877465 100644 --- a/src/main/ipc/pty.test.ts +++ b/src/main/ipc/pty.test.ts @@ -15648,6 +15648,7 @@ describe('registerPtyHandlers', () => { registerPtyHandlers(mainWindow as never, nextRuntime as never) nextRuntime.registerRawTerminalViewSubscriber(result.id) + // Repeated presence signals must remain deduplicated. nextRuntime.onRemoteTerminalViewPresenceChanged?.(result.id) expect(daemon.setPtyBackgrounded).toHaveBeenCalledOnce() diff --git a/tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts b/tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts index 80c7698e321..2d0eb5a9acd 100644 --- a/tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts +++ b/tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts @@ -307,11 +307,11 @@ test('foregrounds a preserved daemon PTY after the paired host relaunches', asyn test.setTimeout(360_000) const repoPath = seededRepoPathOrSkip() writeFileSync(backlogPath, '') + const previousParkDelay = process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS + process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS = String(PARK_DELAY_MS) const session = createRestartSession(testInfo, { ORCA_DAEMON_STREAM_BACKLOG_FILE: backlogPath }) - const previousParkDelay = process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS - process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS = String(PARK_DELAY_MS) let firstHost: ElectronApplication | null = null let secondHost: ElectronApplication | null = null let client: PairedElectronClient | null = null