You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Two signal tests in passthrough.test.ts fail when the tool starts more than 600 ms late #1994
src/cli/passthrough.test.ts:82 and :104 wait a fixed 600 ms from the spawn, then signal a node tool that must have installed its handlers by then. A slower start fails both tests with the product correct. Not seen on a real run. Shown by making the tool wait 900 ms before its first statement:
AssertionError: expected 130 to be 40 src/cli/passthrough.test.ts:87:26
AssertionError: piped stdin: SIGINT forwarded: expected 130 to be 40 src/cli/passthrough.test.ts:113:81
Seen on: test output with a slowed tool. Not seen on a real run; spawnPassthrough is correct.
Both reported failures are confirmed. On bug/1994-repro the two tests end their title with "when the tool starts late" and delay the tool 900 ms. They fail every run (4 of 4):
pnpm exec vitest run --project unit src/cli/passthrough.test.ts
AssertionError: expected 130 to be 40 src/cli/passthrough.test.ts:90:26
AssertionError: piped stdin: SIGINT forwarded: expected 130 to be 40 src/cli/passthrough.test.ts:116:81
Tests 2 failed | 5 passed (7)
Root cause
Defect in the tests. src/cli/passthrough.test.ts:83 and :102 on main sleep 600 ms from the spawn instead of waiting for the tool's handlers. A signal sent before they exist kills the tool: 128 + SIGINT = 130. The tool's own setTimeout(exit 0, 1500) (:76, :97) is a second race: the signal must arrive within it.
Simplest fix
In this test file only: the tool writes a ready file after installing its handlers, and the test waits for it before the signal. The test then removes the file, which replaces the 1500 ms timer: the tool exits 0, 200 ms after it sees the file gone, unless a signal ended it first.
// tool, after its two handlersfs.writeFileSync(ready,"");setTimeout(()=>process.exit(1),15000);// orphan guardconstpoll=setInterval(()=>{if(fs.existsSync(ready))return;clearInterval(poll);setTimeout(()=>process.exit(0),200)},20);// test, in bothawaitvi.waitFor(()=>expect(existsSync(ready)).toBe(true),{interval: 10,timeout: 10_000});/* call our listeners */rmSync(ready);
fix: 7 passed, 5 of 5; tool 0, 300, 3000 ms late: 7 passed
src/cli 531 passed; pnpm test:changed 7 passed; pnpm typecheck clean
broken spawnPassthrough, with the fix:
no recordVideo translation expected 41 to be 40
always forwards SIGINT terminal stdin: expected 40 to be +0
never forwards SIGINT piped stdin: expected +0 to be 40
never forwards SIGTERM expected +0 to be 40; terminal stdin: expected +0 to be 41
no SIGINT listener on a tty expected [] to have a length of 1
Alternatives rejected
A longer sleep: still a race with the host, and slower on every run.
The ready file alone, keeping the 1500 ms timer: the signal still races the tool's exit.
Risk
Remove the temp folder in afterEach, so a failed test's tool ends too.
A wrongly forwarded SIGINT must be handled within the 200 ms, or the terminal case passes.
The commit hook was not run on the fix. Windows skips both tests.
Activity
V3RON commentedon Nov 30, 2026
Reproduction
Seen on: test output with a slowed tool. Not seen on a real run;
spawnPassthroughis correct.Both reported failures are confirmed. On
bug/1994-reprothe two tests end their title with "when the tool starts late" and delay the tool 900 ms. They fail every run (4 of 4):Root cause
Defect in the tests.
src/cli/passthrough.test.ts:83and:102on main sleep 600 ms from the spawn instead of waiting for the tool's handlers. A signal sent before they exist kills the tool: 128 + SIGINT = 130. The tool's ownsetTimeout(exit 0, 1500)(:76,:97) is a second race: the signal must arrive within it.Simplest fix
In this test file only: the tool writes a
readyfile after installing its handlers, and the test waits for it before the signal. The test then removes the file, which replaces the 1500 ms timer: the tool exits 0, 200 ms after it sees the file gone, unless a signal ended it first.Alternatives rejected
readyfile alone, keeping the 1500 ms timer: the signal still races the tool's exit.Risk
afterEach, so a failed test's tool ends too.Fast track
Side findings
Written by an agent.
V3RON commentedon Nov 30, 2026
Delivery run
Merged: #1997 (#1994)
Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(test): passthrough signal tests wait for the tool's ready file (c…