Skip to content

fix(cli-lifecycle): the Windows pipe-leak check runs alone in its own process, so a sibling test's child cannot hold its writer (card 64ca188f) - #4556

Merged
joelteply merged 1 commit into
canaryfrom
fix/windows-launch-pipe-flake
Sep 28, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/windows-launch-pipe-flake

Conversation

@joelteply

@joelteply joelteply commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Card 64ca188f. This Windows flake is now blocking deploys.

The failure

continuum-cli-lifecycle windows_launch::tests::detached_child_closes_unrelated_pipe_and_preserves_launch_contract fails intermittently at windows_launch.rs:477 with "the detached child retained the unrelated pipe writer" (left 1, right 0). On 2026-09-28 it hit four heads: #4540, #4550, #4551, and the canary tip a0c43bf. A red tip makes the deploy tracker RefuseRed, so no deploy reaches the nodes until a rerun happens to pass.

The cause

The test makes an inheritable duplicate of a pipe writer on purpose, to prove spawn_logged does not pass unrelated inheritable handles to the detached child. The module's own header says why that matters: std's Command::spawn inherits every inheritable handle. That same fact is what breaks the test. cargo test runs the crate's tests on parallel threads in one process, and when a sibling test spawns a process (the other windows_launch tests re-exec the binary as a fixture, and several tests shell out) while the inheritable writer exists, that child inherits the writer and keeps the pipe open. The check then fails because of a process that isn't the one under test. Fable pinned the concrete sibling: installer_failure_carries_powershell_diagnostics (supervisor_install.rs, cfg windows) spawns powershell.exe three times through plain std Command, with bInheritHandles=TRUE.

The fix

The test runs alone. In a normal run it re-execs the test binary with --exact <itself> --test-threads=1 and a marker env var (CONTINUUM_PIPE_LEAK_CHECK_ISOLATED), and asserts that run succeeds. Only the isolated run does the check, and since nothing else runs in that process, nothing can spawn during the window. The check itself, its fixture and its assertions are unchanged. The module already uses the same re-exec pattern for its fixture child.

Evidence

This is Windows-only code (the module is cfg(windows)), so the IntelMac can't compile it. The windows-msvc CI job compiles it and runs it. A single green run can't prove an intermittent failure gone, so the argument is the mechanism: the leak window now exists only in a process whose only test is this one. Please watch the next several Windows runs; a recurrence would mean the cause is elsewhere (for example, the fixture's own grandchild).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

… process, so a sibling test's child cannot hold its writer (card 64ca188f)

windows_launch::tests::detached_child_closes_unrelated_pipe_and_preserves_launch_contract
makes an INHERITABLE pipe writer on purpose, to prove the detached child does
not receive it. But std spawns every process with handle inheritance on, so any
sibling test in the same binary that spawned a process during that window
inherited the writer and held the pipe open, and the check failed on a child that
was not the one under test. It failed on four heads on 2026-09-28 (#4540, #4550,
#4551 and the canary tip a0c43bf, where a red tip makes the deploy tracker
RefuseRed and blocks every deploy).

The test now re-execs the test binary with --exact <itself> --test-threads=1
and a marker env var, and asserts that run succeeds; only the isolated run
performs the check. Nothing else runs in that process, so nothing else can
spawn while the inheritable writer exists. The check itself is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply merged commit a891bc2 into canary Sep 28, 2026
8 checks passed
@joelteply
joelteply deleted the fix/windows-launch-pipe-flake branch September 28, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant