Skip to content

fix(daemon): close #16924 review P2s — degrade warn, reap comment, Windows claim-reap CI - #16979

Closed
brennanb2025 wants to merge 6 commits into
brennanb2025/daemon-pid-atomic-publish-r1from
brennanb2025/pid-publish-p2-closures-r1
Closed

brennanb2025 wants to merge 6 commits into
brennanb2025/daemon-pid-atomic-publish-r1from
brennanb2025/pid-publish-p2-closures-r1

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​44 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32

ELI5

Its parent PR made Orca's terminal helper write its "I'm running, here's my id" note in one
all-or-nothing move, so a crash mid-write can't leave half a note behind. That trick needs a
filesystem feature that a few setups don't have — network drives and some container filesystems —
and on those Orca quietly went back to the old, interruptible way of writing. Quietly is the problem:
nobody could tell which mode they were in.

This PR makes Orca say so in its log when it has to fall back, corrects a comment that described the
wrong failure, and makes the existing safety check for leftover scratch files actually run on Windows
in CI. Nothing you click behaves differently.

User-facing before / after

Before After
Your Orca data directory sits on a filesystem without hard links (a network mount, some container overlays) Orca silently used the old, interruptible way of writing its helper record. If you later hit the crash-corruption problem, there was no way to tell why Orca logs a warning naming the exact filesystem error, so the fallback is visible when you go looking
Everything else about starting, using, or closing terminals — Unchanged. The remaining changes are a corrected code comment and running an existing safety test on Windows in CI

When it bites

Only people whose Orca data directory is on a filesystem that refuses hard links — network home
directories and some container/VM setups. Everyone else sees no change at all; this PR adds a
diagnostic, not a behaviour.

Follow-up to #16924 closing the three P2s from its review (comment 5447786752). Stacked on brennanb2025/daemon-pid-atomic-publish-r1 because the code under change exists only there; after #16924 merges this needs a manual retarget onto main.

  • P2a — the reap rationale comment in daemon-pid-publish-claim-reap.ts claimed deleting a live publisher's claim "would fail that publish". It actually knocks the publish off the atomic path: the link fails non-EEXIST and degrades to the exclusive direct write, which succeeds but reopens the torn-write window. Comment now says exactly that.
  • P2b — the no-hardlink degrade path in publishDaemonPidFile was silent. It now console.warns with the errno, so an operator on a filesystem without hard links (network mounts, container overlays) can tell the atomic path is not in use. Pinned by the atomicity test: warn fires exactly once on the degrade path (ablation-proven failing-first — reverting the production hunk fails the test), and the normal atomic path asserts no warn.
  • P2c — the reaper's proven-dead gate (process.kill(pid, 0) / ESRCH) was untested on Windows CI, and Windows process-existence probing is a different mechanism (OpenProcess, not POSIX signals). daemon-pid-publish-claim-reap.test.ts already asserts with real fs and real processes that the reaper does NOT reap a claim whose owner is alive and DOES reap one whose owner is gone; it is now wired into the package (windows) job the same way fix(daemon): make pid-record publish atomic via claim-then-link #16924 wired the disk-contract test — added to BOTH the pr.yml "Test Windows-specific boundaries" vitest list AND WINDOWS_PACKAGE_TESTS in config/scripts/pr-code-change-scope.mjs. Editing those two files is GLOBAL_FORCE, so this PR's own CI run executes the file on windows-2022 as the proof.

No change to the link-vs-rename design (the three EEXIST-dependent call sites are untouched). Local: 37/37 daemon pid tests green, pnpm tc:node clean, oxlint clean, both CI-wiring pin suites green (25/25).

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Independent exact-head review — f6e57229fa7ff57e71e0669a7e9d1acad9f7907e

Review loop for this follow-up's own evidence (previously it lived only on #16924). Scope reviewed: the full stacked diff vs the #16924 branch head e0b44cdd6f (5 files, +31/−3). Verdict at the end.

P2a — reap-rationale comment (daemon-pid-publish-claim-reap.ts)

Verified against the actual control flow in publishDaemonPidFile (daemon-spawner.ts): deleting a LIVE publisher's claim between its write and its link makes linkSync fail ENOENT (non-EEXIST), which lands in the degrade branch — the exclusive direct writeFileSync succeeds but skips the fsync-before-visible discipline, reopening the torn-write window. The corrected comment states exactly that; the old claim ("would fail that publish") was indeed wrong. EEXIST still rethrows before the degrade, so the three EEXIST-dependent ownership call sites are untouched, as the body says.

P2b — degrade warn + failing-first pin (ablation RE-RUN at this head)

  • daemon-pid-publish-atomicity.test.ts, -claim-reap.test.ts, -disk-contract.test.ts: 17/17 pass at this head.
  • Ablation: removing ONLY the console.warn production hunk from publishDaemonPidFile fails degrades to the exclusive direct write when the filesystem cannot hard-link with expected "warn" to be called 1 times, but got 0 times (1 failed | 6 passed); restoring the hunk returns 17/17 green. The pin is live, not vacuous.
  • The normal atomic path asserts zero warns, so the warning cannot train operators to ignore it.
  • Warn placement is correct: it fires only in the non-EEXIST degrade branch, once per publish, with the errno interpolated (describeErrnoCode has no unsafe cast; falls back to 'no errno').

P2c — Windows claim-reap CI wiring

Both lists carry the file at this head: .github/workflows/pr.yml ("Test Windows-specific boundaries" vitest list) and WINDOWS_PACKAGE_TESTS in config/scripts/pr-code-change-scope.mjs. Execution proof on THIS PR's own CI: job 98768843276 (windows-2022) logs ✓ daemon-pid-publish-claim-reap.test.ts (6 tests) 203ms. Both CI-wiring pin suites pass locally (pr-code-change-scope.test.mjs 23/23 + client-hosted-browser-package-coverage.test.mjs 2/2 = 25/25).

CI / state

Head f6e57229fa unchanged during review (ls-remote verified), mergeState CLEAN, rollup 35 pass / 0 fail / 4 skipped on a fresh post-#16946 base.

Verdict: merge-ready as the #16924 follow-up — with the standing stacking constraint: #16924 merges first, then this retargets to main. No merge, approval, or close performed.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review loop — round 1

Reviewed at f6e57229fa. Pushed one fix as 4ef5c77e6c.

Stacking is intact. #16924's head e0b44cdd6f is an ancestor of this branch with zero drift — this PR is exactly one commit on top of it. (#16924 shows a later updatedAt, but that is not a head move.) Worth noting another lane is reviewing #16924 concurrently.

The question this review had to answer: are the three P2 fixes each independently pinned? Two were. One was not.

P2a — the degrade warning: pinned, but its ordering was not

The warn sits in the linkSync catch below the isExistingFileError rethrow, so a routine ownership conflict stays quiet and only a genuine non-atomic degrade warns. The test file says exactly that ("warning on it would train operators to ignore the degrade warning below") — but nothing asserted it.

Ablating each gate individually, which is the discipline #16926 asked for:

ablation result
delete console.warn entirely 1 red — degrades to the exclusive direct write
move console.warn above the EEXIST rethrow 0 red — all 7 passed

The second row is the hole. Emitting the warn on every link failure, including a routine lost publish race, kept the whole suite green — the EEXIST test only asserts toThrow(/EEXIST/) and the record is untouched, so it never noticed. 4ef5c77e6c adds expect(warnSpy).not.toHaveBeenCalled() to that test.

After the fix the two arms fail independently, which is the point:

ablation result
delete console.warn 1 red — degrades to the exclusive direct write
warn above the EEXIST rethrow 1 red — still refuses to replace an existing record

Each ablation reds exactly one distinct test. The existing toHaveBeenCalledTimes(1) plus two stringContaining assertions are fine as written — times(1) forces both substrings onto the same single call.

P2b — the reap comment: correct, and structurally unpinnable

The daemon-pid-publish-claim-reap.ts change is comment-only, so no test can pin it; the right check is whether the corrected claim is true. It asserts that deleting a live publisher's claim between write and link "knocks that publish off the atomic path: the link fails non-EEXIST and degrades to the exclusive direct write, which succeeds." Verified empirically:

linkSync errno after claim reaped = ENOENT
degraded exclusive write => SUCCEEDS

ENOENT is non-EEXIST, so it degrades, and the wx write succeeds. The comment is accurate.

P2c — dual-list wiring: correct, but the two lists are unenforced

daemon-pid-publish-claim-reap.test.ts exists at this head and is Windows-safe: it mints a dead pid via spawnSync(process.execPath, ['-e','']), builds every path with join(), and matches claims on filename only — no hard links, no POSIX-only errno assumptions, no hardcoded separators. Its direct node:child_process import is fine; the import-boundary ratchet exempts .test.ts by design.

The gap: WINDOWS_PACKAGE_TESTS lives in config/scripts/pr-code-change-scope.mjs, the same list is duplicated in .github/workflows/pr.yml, and nothing diffs them. This PR correctly updated both by hand, but the next person will update one. Pre-existing, so I have not expanded this 31-line PR to fix it — flagging it as the obvious follow-up.

Gates

oxfmt on the changed file only. Full src/main/daemon/ suite: 149 files / 1691 tests pass, 2 files + 3 tests skipped. git diff --check clean. Nothing here weakens an existing gate — the one change adds an assertion.

Not verified

CI on this branch last ran against a base 45 commits behind current origin/main. The merge is textually clean, but a clean merge-tree is not a green composed tree — recommend gh pr update-branch for a fresh run before merging. I also did not execute the Windows leg on real windows-2022; the claim-reap test is Windows-safe by inspection only.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Round 1 addendum — the degrade warning could not reach an operator

Follow-up to the review above. Pushed as 9b4e9bf17b.

Chasing whether console.warn was the right channel turned up something more than a style question: on the production path this warning reaches nobody, which defeats the P2a fix's entire stated purpose ("an operator on such a volume should be able to tell the atomic path is not in use").

The chain, all from this repo:

  • publishDaemonPidFile is invoked from inside the detached daemon — daemon-entry.ts:277, via publishEndpointOwnership.
  • daemon-file-log.ts:1-4 states the constraint in its own header: "The daemon runs out-of-process with stdio 'ignore', so console output goes nowhere; this writes lifecycle events to a rotated file under the app's logs directory so they land in diagnostic bundles."
  • daemon-init.ts:612 spawns it stdio: ['ignore', 'ignore', 'pipe', 'ipc'], and releaseStderr() (:639-643) calls child.stderr?.destroy() once the daemon reports ready. The startup tail it collects is only printed inside fail(). On a successful launch — which is when a publish degrade actually happens — the warning is written to a destroyed pipe.

The convention for this exact situation is already in the file three lines from the call site. daemon-endpoint-lifecycle.ts:68-69 handles the sibling endpoint degrade by doing both:

this.options.log.log('endpoint-publish-declined', { reason: outcome.status })
console.warn(`[daemon] Endpoint unavailable at startup: reason=${outcome.status}`)

…and :75 is the publishEndpointOwnership() call this PR's warning lives inside.

publishDaemonPidFile now takes an optional log and emits both. daemonLog was already in scope at daemon-entry.ts (it is threaded into startDaemon({ log: daemonLog }) at :252), so the call site just passes it; the in-process daemon-spawner.ts call site passes nothing and is unchanged.

Ablation — both new gates load-bearing and independent

ablation result
remove log?.log('pid-publish-degraded', …) 1 red — records the degrade on the daemon file log
also log on the atomic path 2 red — records the degrade… and leaves the daemon file log untouched

The second gate exists for the same reason as the warnSpy one: a degrade signal that also fires on the happy path is not a signal. The test double is a real log(event, details) function asserted with toEqual on the full entry list, not a substring match, so an extra or renamed event fails it.

Gates

tsc -p config/tsconfig.node.json --noEmit → exit 0, 0 errors. Full src/main/daemon/ suite: 149 files / 1693 tests pass (up 2), 2 files + 3 tests skipped. oxfmt on changed files only, oxlint clean, git diff --check clean.

Still outstanding from the review above

  • CI here last ran against a base 45 commits behind origin/main — recommend gh pr update-branch.
  • The WINDOWS_PACKAGE_TESTS list in config/scripts/pr-code-change-scope.mjs and the duplicate in .github/workflows/pr.yml are still unenforced against each other.
  • I did not execute the Windows leg on real windows-2022.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Round 1 final — stack base moved, plus a false-alarm fix

Head now 51fda2e9f6.

⚠️ #16924 moved out from under this PR mid-review

When I started, #16924's head was e0b44cdd6f and this branch sat exactly one commit on top of it. It is now c7eb8e3f06 — it gained "fix(daemon): restore claimed pid records by hard link, not a streaming copy", which touches daemon-spawner.ts (+35/-11), the same file this PR modifies. c7eb8e3f06 is not an ancestor of this branch.

The merge is textually clean, but a clean merge-tree is not a green composed tree, so I built and ran the composed tree rather than assuming:

  • git merge c7eb8e3f06 into this head — clean
  • composed src/main/daemon/ suite: 150 files / 1700 tests pass, 2 files + 3 skipped
  • composed tsc -p config/tsconfig.node.json --noEmit — 0 errors
  • verified my additions were not silently dropped by the merge (a keep-ours deletion in a reworked function stays green): log?.log('pid-publish-degraded', …) present at daemon-spawner.ts:210, both not.toHaveBeenCalled gates present, and all 9 tests enumerated as passing by name

So the stack composes correctly today. Flagging it because this PR should be rebased onto c7eb8e3f06 before merge so CI validates what will actually land.

The degrade warning could fire for a publish that wrote nothing

The warning was emitted before the degraded writeFileSync(..., 'wx') — but that write throws EEXIST when a daemon loses an ownership race. On a hard-link-incapable volume, the loser logged "torn-write protection is off for this record" for a record it never wrote. That is a false alarm on the same signal the P2a fix exists to make trustworthy.

Moved the announcement below the write, so it only claims a degrade that happened. Also pinned describeErrnoCode's no-code branch, which exists for exactly the exotic-volume error this arm handles and was never exercised.

ablation result
warn back above the degraded write 1 red — stays silent when the degraded write itself loses the ownership race
strip describeErrnoCode's guard 1 red — names the errno even when the link error carries none

Each reds exactly one distinct test — combined with the two tables above, all six assertions added across this review fail independently.

Gates

tsc 0 errors. src/main/daemon/: 149 files / 1695 tests pass. oxfmt on changed files only, oxlint clean, git diff --check clean.

Carried forward, not fixed

  • deadPid() in daemon-pid-publish-claim-reap.test.ts:13-18 is a PID-reuse race. It returns the pid of a just-exited spawnSync and relies on process.kill(pid, 0) throwing ESRCH. Windows recycles PIDs more aggressively, and this PR is what puts that test on Windows CI — so while the race is inherited from fix(daemon): make pid-record publish atomic via claim-then-link #16924, this PR is where it becomes a flake risk. One green windows-2022 run is not evidence of stability.
  • WINDOWS_PACKAGE_TESTS in config/scripts/pr-code-change-scope.mjs and the duplicate list in .github/workflows/pr.yml remain unenforced against each other.
  • Not verified: no execution on a real hard-link-incapable volume (the degrade is fault-injected), and no windows-2022 run of my own.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

CI note: native-smoke (windows-latest) failed on 51fda2e9f6 with Test timed out in 15000ms in src/main/ssh/ssh-remote-cli-launcher.test.ts > preserves a multiline argument through the compiled remote launcher — an SSH launcher compile test with no connection to pid publishing. Re-ran the failed job against identical code: SUCCESS. Confirmed timing flake on a slow Windows runner, not a regression from this PR.

Still recommend rebasing onto #16924's current head c7eb8e3f06 before merge, per the stack note above — CI here has not yet validated the composed tree, though I did locally (150 files / 1700 tests, tsc 0 errors).

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Gate-level ablation audit — 4 unpinned arms now pinned (tests only)

Standing audit for "is any conservative arm only jointly pinned?". Every guard, early return, errno check, and individual conjunct on the publish/reap path was reverted alone, with all others left intact, against 51fda2e9f6 and re-verified after rebasing onto current main.

Before this commit, 8 of 18 arms could each be deleted with the whole src/main/daemon suite (1691 tests) still green. Four of those were real; four are strictly dominated.

Newly pinned (each test fails with its own arm reverted, passes with it restored, and is not triggered by any other arm's ablation)

Arm Input that isolates it Why it matters
claimOwnerIsProvenDead — ESRCH only kill(pid, 0) throws EPERM A live publisher owned by another user (root-launched daemon, shared machine) was read as dead. Reaping its claim between its write and its link knocks that publish off the atomic path onto the degraded write — the exact exposure this discipline exists to close.
the rmSync swallow in the reap loop a claim name occupied by a non-empty directory The throw escaped into ensureRunning and blocked daemon launch. The reap is hygiene on the launch funnel; no failure in it may stop a launch.
the EEXIST rethrow in publishDaemonPidFile link reports EEXIST while the canonical path is free Without the rethrow the fallback exclusive write succeeds and silently takes the ownership the EEXIST exists to deny. The existing conflict test could not see this — it leaves a real record on disk, so the fallback write fails EEXIST too and the same error surfaces either way.
the finally-unlink swallow claim write fails outright (ENOSPC), so no claim exists The cleanup's ENOENT replaced the original error. An operator debugging a full disk was handed "no such file".

Left in place as defence-in-depth — genuinely unpinnable

These four are strictly dominated: on every input the regex can produce, the outcome is identical with or without them, so any test would pass for the wrong reason.

  • !Number.isSafeInteger(claimOwnerPid) — the capture is \d+, so the only failing values exceed 2^53; process.kill then throws ERR_OUT_OF_RANGE, which is not ESRCH, so the claim is skipped anyway.
  • claimOwnerPid <= 0 — \d+ cannot produce a negative; pid 0 makes kill(0, 0) succeed, so the owner reads as alive and the claim is skipped anyway.
  • claimOwnerPid === process.pid — kill(self, 0) succeeds, so the ESRCH check skips our own claim regardless.
  • the claim write's wx flag — the claim path carries process.pid and a randomUUID(), so the exclusive-create can only differ from w on a path that cannot collide.

All four are cheap and correct, and each becomes load-bearing the moment the ESRCH check or the claim-name shape changes. Recommendation: keep them. Flagging rather than testing them is deliberate — a test here would assert an unreachable branch.

Notes

@brennanb2025
brennanb2025 force-pushed the brennanb2025/pid-publish-p2-closures-r1 branch from 4a48655 to f4c07f1 Compare August 28, 2026 14:31
…e warning

The EEXIST rethrow sits above the non-atomic degrade warning precisely so a
lost publish race stays quiet, but nothing pinned that order: moving the warn
above the rethrow left all seven atomicity tests green. Assert the conflict
path warns zero times so the two arms fail independently.
…mon keeps

The degrade warning exists so an operator on a volume without hard links can
tell torn-write protection is off, but publishDaemonPidFile runs inside the
detached daemon: daemon-init spawns it with stdio 'ignore' and destroys the
startup stderr pipe once it reports ready, so console alone reaches nobody on
exactly the path the warning was written for -- the constraint daemon-file-log
states in its header comment.

Take an optional log and emit both, matching daemon-endpoint-lifecycle's
handling of the sibling endpoint degrade three lines from this call site.
…ublished

The warning sat above the degraded exclusive write, but that write can itself
throw EEXIST: a daemon losing an ownership race on a hard-link-incapable volume
announced 'torn-write protection is off for this record' for a record it never
wrote. Announce after the write lands, so the claim is true when it is made.

Also pin describeErrnoCode's no-code branch, which existed for exactly the
exotic-volume error the degrade handles and was never exercised.
Gate-level ablation of the publish/reap path found four conservative arms
that could each be reverted alone with the whole src/main/daemon suite
(1695 tests) still green:

- claimOwnerIsProvenDead's ESRCH-only check: accepting any errno as death
  reaps a LIVE foreign-owned publisher's claim, knocking that publish off
  the atomic path onto the degraded write
- the rmSync swallow in the reap loop: an unremovable claim escaped into
  ensureRunning and blocked the launch the reap is only hygiene for
- the EEXIST rethrow in publishDaemonPidFile: modelled with the canonical
  path free, so the fallback write succeeds and silently takes ownership
  the EEXIST exists to deny
- the finally-unlink swallow: a failed claim write leaves no claim, so the
  cleanup's ENOENT replaced the real ENOSPC in the caller's error

Each new test fails with its own arm reverted and passes with it restored;
the other arms' ablations do not trigger it. No production change.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/pid-publish-p2-closures-r1 branch from f4c07f1 to 91281c4 Compare August 28, 2026 15:06
The Windows lane now runs daemon-pid-publish-claim-reap.test.ts, but its only
foreign-owner gate injected EPERM — the POSIX errno. Windows reports a live
but unsignalable process as EACCES (isPermissionError in win32-utils treats
EACCES and EPERM as one), so the errno that lane can actually see had no gate.

The fence is already correct there: it reaps only on ESRCH, so every other
errno reads as alive. No production change — this pins that for EACCES too,
so a later broadening to "any kill() error means dead" cannot land unnoticed
and delete a live publisher's claim on Windows.
brennanb2025 added a commit that referenced this pull request Aug 29, 2026
`native-smoke (windows-latest)` fails ~4.5% of runs on
`preserves a multiline argument through the compiled remote launcher`
with "Test timed out in 15000ms" — on unrelated PRs, for reasons that
have nothing to do with them. Across 176 sampled attempts it is the only
red that job produced, and it hit seven different PRs in two days:
#16900, #16904, #16915, #16955 (twice), #16979, #17014, #17085.

The test is six process creations: powershell.exe forks csc.exe, then
the freshly compiled orca.exe forks node.exe, twice. Hosted Windows
runners periodically slow process creation down, and this test amplifies
that far harder than anything else in the job. Comparing the 80 attempts
where it ran under 3s against the 12 where it ran over 12s, its own
median goes 2198ms -> 15917ms (7.2x) while the same file's
powershell-only test moves 556 -> 686ms (1.2x), the cmd.exe and Git Bash
process tests in the neighbouring file move 1.4x, and the other 35 files
put together move 1.5x.

Measured across those 176 attempts: 1881ms to 35438ms, p50 4264ms,
correlation +0.881 with the job's total Vitest duration. 8 of 176 (4.5%)
exceeded the 15s cap; 2 of 176 (1.1%) also exceeded the shared 30s
testTimeout, so deleting the override and inheriting the config is not
enough on its own. 60s clears all 176 with 1.7x headroom on the worst.

This is slow, not hung. Every body here is synchronous spawnSync, so
Vitest cannot interrupt one — the timer fires only after the body
returns and the reported duration is real elapsed time. That is why a
failure reads `× ... 22464ms` under `Test timed out in 15000ms`. The
work finished; the stopwatch was short. Seven reruns at one identical
head measured 2053 / 4680 / 5551 / 8732 / 13506 / 14868 / 21937ms — the
last of those would have been red on code that had not changed.

The 15s came from #8897, which raised this test off Vitest's built-in 5s
default because the job then ran bare `pnpm vitest run`. #8909 landed
3h27m later and pointed the job at config/vitest.config.ts, which is the
real fix for that. The constant stayed behind and has been the binding
budget ever since.
brennanb2025 added a commit that referenced this pull request Aug 30, 2026
`native-smoke (windows-latest)` fails ~4.5% of runs on
`preserves a multiline argument through the compiled remote launcher`
with "Test timed out in 15000ms" — on unrelated PRs, for reasons that
have nothing to do with them. Across 176 sampled attempts it is the only
red that job produced, and it hit seven different PRs in two days:
#16900, #16904, #16915, #16955 (twice), #16979, #17014, #17085.

The test is six process creations: powershell.exe forks csc.exe, then
the freshly compiled orca.exe forks node.exe, twice. Hosted Windows
runners periodically slow process creation down, and this test amplifies
that far harder than anything else in the job. Comparing the 80 attempts
where it ran under 3s against the 12 where it ran over 12s, its own
median goes 2198ms -> 15917ms (7.2x) while the same file's
powershell-only test moves 556 -> 686ms (1.2x), the cmd.exe and Git Bash
process tests in the neighbouring file move 1.4x, and the other 35 files
put together move 1.5x.

Measured across those 176 attempts: 1881ms to 35438ms, p50 4264ms,
correlation +0.881 with the job's total Vitest duration. 8 of 176 (4.5%)
exceeded the 15s cap; 2 of 176 (1.1%) also exceeded the shared 30s
testTimeout, so deleting the override and inheriting the config is not
enough on its own. 60s clears all 176 with 1.7x headroom on the worst.

This is slow, not hung. Every body here is synchronous spawnSync, so
Vitest cannot interrupt one — the timer fires only after the body
returns and the reported duration is real elapsed time. That is why a
failure reads `× ... 22464ms` under `Test timed out in 15000ms`. The
work finished; the stopwatch was short. Seven reruns at one identical
head measured 2053 / 4680 / 5551 / 8732 / 13506 / 14868 / 21937ms — the
last of those would have been red on code that had not changed.

The 15s came from #8897, which raised this test off Vitest's built-in 5s
default because the job then ran bare `pnpm vitest run`. #8909 landed
3h27m later and pointed the job at config/vitest.config.ts, which is the
real fix for that. The constant stayed behind and has been the binding
budget ever since.
nwparker pushed a commit that referenced this pull request Aug 31, 2026
`native-smoke (windows-latest)` fails ~4.5% of runs on
`preserves a multiline argument through the compiled remote launcher`
with "Test timed out in 15000ms" — on unrelated PRs, for reasons that
have nothing to do with them. Across 176 sampled attempts it is the only
red that job produced, and it hit seven different PRs in two days:
#16900, #16904, #16915, #16955 (twice), #16979, #17014, #17085.

The test is six process creations: powershell.exe forks csc.exe, then
the freshly compiled orca.exe forks node.exe, twice. Hosted Windows
runners periodically slow process creation down, and this test amplifies
that far harder than anything else in the job. Comparing the 80 attempts
where it ran under 3s against the 12 where it ran over 12s, its own
median goes 2198ms -> 15917ms (7.2x) while the same file's
powershell-only test moves 556 -> 686ms (1.2x), the cmd.exe and Git Bash
process tests in the neighbouring file move 1.4x, and the other 35 files
put together move 1.5x.

Measured across those 176 attempts: 1881ms to 35438ms, p50 4264ms,
correlation +0.881 with the job's total Vitest duration. 8 of 176 (4.5%)
exceeded the 15s cap; 2 of 176 (1.1%) also exceeded the shared 30s
testTimeout, so deleting the override and inheriting the config is not
enough on its own. 60s clears all 176 with 1.7x headroom on the worst.

This is slow, not hung. Every body here is synchronous spawnSync, so
Vitest cannot interrupt one — the timer fires only after the body
returns and the reported duration is real elapsed time. That is why a
failure reads `× ... 22464ms` under `Test timed out in 15000ms`. The
work finished; the stopwatch was short. Seven reruns at one identical
head measured 2053 / 4680 / 5551 / 8732 / 13506 / 14868 / 21937ms — the
last of those would have been red on code that had not changed.

The 15s came from #8897, which raised this test off Vitest's built-in 5s
default because the job then ran bare `pnpm vitest run`. #8909 landed
3h27m later and pointed the job at config/vitest.config.ts, which is the
real fix for that. The constant stayed behind and has been the binding
budget ever since.
nwparker added a commit that referenced this pull request Aug 31, 2026
* fix(ssh): fence stale kills and retired pane replay

* fix(ssh): support cancellable interactive authentication

* fix(ssh): await remote catalog before snapshot adoption

* fix(pty): contain Windows ConPTY input failures

* fix(power): avoid redundant macOS display blocking

* perf(editor): narrow markdown override subscriptions

* fix(quick-open): close directory handles after reads

* refactor(linux): remove unused proc socket scanner

* fix(usage): apply flat Sonnet 4.6 pricing

* ci: prime Node next native test cache

* docs(skills): resolve snapshot cleanup data path

* fix(ssh): recover install locks after host reboot

* test(ssh): recognize boot-aware install locks

* test(ssh): prove previous-boot lock recovery live

* test(wire): pin pre-metadata release coverage

* fix(terminal): preserve remote tab ownership through recovery races

* test(runtime): fence replaced terminal handles in agent guard

* fix(ssh): preserve remote snapshot authority across polls

* fix(pty): contain late ConPTY output EPIPE

* test(pty): register Windows exit watcher before kill

* fix: close SSH and tab readiness race gaps

* fix(tabs): retain headless order and placeholder titles

* fix(build): avoid parallel electron-vite config race

* test(windows): avoid MSYS temp path rewriting

* test(windows): avoid killing exited PTY

* fix(pty): avoid late ConPTY input teardown race

* fix(terminal): sync reconnect error ownership after commit

* fix(runtime): use canonical worktree identity comparison

* test(ssh): assert complete cold-hydration baseline

* test(windows): invoke quoted retention fixture via PowerShell

* test(windows): read ConPTY grid through mode con

* fix(terminal): publish PTY replacements atomically

* fix(terminal): infer stale identity on reattach

* fix(terminal): fence stale pane PTY callbacks

* fix(terminal): fence stale pane binds after rebind

* fix(terminal): reject stale pane transport callbacks

* fix(terminal): fence mirrored reattach spawn callbacks

* fix(terminal): replace stale pane PTYs on remount

* fix(ci): size the Windows launcher-compile test budget from measurement

`native-smoke (windows-latest)` fails ~4.5% of runs on
`preserves a multiline argument through the compiled remote launcher`
with "Test timed out in 15000ms" — on unrelated PRs, for reasons that
have nothing to do with them. Across 176 sampled attempts it is the only
red that job produced, and it hit seven different PRs in two days:
#16900, #16904, #16915, #16955 (twice), #16979, #17014, #17085.

The test is six process creations: powershell.exe forks csc.exe, then
the freshly compiled orca.exe forks node.exe, twice. Hosted Windows
runners periodically slow process creation down, and this test amplifies
that far harder than anything else in the job. Comparing the 80 attempts
where it ran under 3s against the 12 where it ran over 12s, its own
median goes 2198ms -> 15917ms (7.2x) while the same file's
powershell-only test moves 556 -> 686ms (1.2x), the cmd.exe and Git Bash
process tests in the neighbouring file move 1.4x, and the other 35 files
put together move 1.5x.

Measured across those 176 attempts: 1881ms to 35438ms, p50 4264ms,
correlation +0.881 with the job's total Vitest duration. 8 of 176 (4.5%)
exceeded the 15s cap; 2 of 176 (1.1%) also exceeded the shared 30s
testTimeout, so deleting the override and inheriting the config is not
enough on its own. 60s clears all 176 with 1.7x headroom on the worst.

This is slow, not hung. Every body here is synchronous spawnSync, so
Vitest cannot interrupt one — the timer fires only after the body
returns and the reported duration is real elapsed time. That is why a
failure reads `× ... 22464ms` under `Test timed out in 15000ms`. The
work finished; the stopwatch was short. Seven reruns at one identical
head measured 2053 / 4680 / 5551 / 8732 / 13506 / 14868 / 21937ms — the
last of those would have been red on code that had not changed.

The 15s came from #8897, which raised this test off Vitest's built-in 5s
default because the job then ran bare `pnpm vitest run`. #8909 landed
3h27m later and pointed the job at config/vitest.config.ts, which is the
real fix for that. The constant stayed behind and has been the binding
budget ever since.

* fix(terminal): fence stale remount reattach ownership

* fix(terminal): reconcile mounted pane identity after replacement

* fix(terminal): fence stale reattach fallback ownership

* fix(terminal): fence deferred SSH reattach ownership

* fix(terminal): fence stale split pane ownership callbacks

* fix(terminal): keep stale spawns from consuming startup

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(ssh): fence stale kills and retired pane replay

* fix(ssh): support cancellable interactive authentication

* fix(ssh): await remote catalog before snapshot adoption

* fix(pty): contain Windows ConPTY input failures

* fix(power): avoid redundant macOS display blocking

* perf(editor): narrow markdown override subscriptions

* fix(quick-open): close directory handles after reads

* refactor(linux): remove unused proc socket scanner

* fix(usage): apply flat Sonnet 4.6 pricing

* ci: prime Node next native test cache

* docs(skills): resolve snapshot cleanup data path

* fix(ssh): recover install locks after host reboot

* test(ssh): recognize boot-aware install locks

* test(ssh): prove previous-boot lock recovery live

* test(wire): pin pre-metadata release coverage

* fix(terminal): preserve remote tab ownership through recovery races

* test(runtime): fence replaced terminal handles in agent guard

* fix(ssh): preserve remote snapshot authority across polls

* fix(pty): contain late ConPTY output EPIPE

* test(pty): register Windows exit watcher before kill

* fix: close SSH and tab readiness race gaps

* fix(tabs): retain headless order and placeholder titles

* fix(build): avoid parallel electron-vite config race

* test(windows): avoid MSYS temp path rewriting

* test(windows): avoid killing exited PTY

* fix(pty): avoid late ConPTY input teardown race

* fix(terminal): sync reconnect error ownership after commit

* fix(runtime): use canonical worktree identity comparison

* test(ssh): assert complete cold-hydration baseline

* test(windows): invoke quoted retention fixture via PowerShell

* test(windows): read ConPTY grid through mode con

* fix(terminal): publish PTY replacements atomically

* fix(terminal): infer stale identity on reattach

* fix(terminal): fence stale pane PTY callbacks

* fix(terminal): fence stale pane binds after rebind

* fix(terminal): reject stale pane transport callbacks

* fix(terminal): fence mirrored reattach spawn callbacks

* fix(terminal): replace stale pane PTYs on remount

* fix(ci): size the Windows launcher-compile test budget from measurement

`native-smoke (windows-latest)` fails ~4.5% of runs on
`preserves a multiline argument through the compiled remote launcher`
with "Test timed out in 15000ms" — on unrelated PRs, for reasons that
have nothing to do with them. Across 176 sampled attempts it is the only
red that job produced, and it hit seven different PRs in two days:
stablyai#16900, stablyai#16904, stablyai#16915, stablyai#16955 (twice), stablyai#16979, stablyai#17014, stablyai#17085.

The test is six process creations: powershell.exe forks csc.exe, then
the freshly compiled orca.exe forks node.exe, twice. Hosted Windows
runners periodically slow process creation down, and this test amplifies
that far harder than anything else in the job. Comparing the 80 attempts
where it ran under 3s against the 12 where it ran over 12s, its own
median goes 2198ms -> 15917ms (7.2x) while the same file's
powershell-only test moves 556 -> 686ms (1.2x), the cmd.exe and Git Bash
process tests in the neighbouring file move 1.4x, and the other 35 files
put together move 1.5x.

Measured across those 176 attempts: 1881ms to 35438ms, p50 4264ms,
correlation +0.881 with the job's total Vitest duration. 8 of 176 (4.5%)
exceeded the 15s cap; 2 of 176 (1.1%) also exceeded the shared 30s
testTimeout, so deleting the override and inheriting the config is not
enough on its own. 60s clears all 176 with 1.7x headroom on the worst.

This is slow, not hung. Every body here is synchronous spawnSync, so
Vitest cannot interrupt one — the timer fires only after the body
returns and the reported duration is real elapsed time. That is why a
failure reads `× ... 22464ms` under `Test timed out in 15000ms`. The
work finished; the stopwatch was short. Seven reruns at one identical
head measured 2053 / 4680 / 5551 / 8732 / 13506 / 14868 / 21937ms — the
last of those would have been red on code that had not changed.

The 15s came from stablyai#8897, which raised this test off Vitest's built-in 5s
default because the job then ran bare `pnpm vitest run`. stablyai#8909 landed
3h27m later and pointed the job at config/vitest.config.ts, which is the
real fix for that. The constant stayed behind and has been the binding
budget ever since.

* fix(terminal): fence stale remount reattach ownership

* fix(terminal): reconcile mounted pane identity after replacement

* fix(terminal): fence stale reattach fallback ownership

* fix(terminal): fence deferred SSH reattach ownership

* fix(terminal): fence stale split pane ownership callbacks

* fix(terminal): keep stale spawns from consuming startup

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Obsolete: this follows up an unmerged parent PR whose code never reached main.

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