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
The SIGKILL escalation test passes without escalation when its child starts later than 100 ms #1986
src/ports/process-runner.test.ts, "escalates to SIGKILL when a timed-out process ignores SIGTERM, within the configured grace": run sends SIGTERM 100 ms after the spawn. A child that has not installed its SIGTERM handler by then dies from SIGTERM. Line 808 asserts code: null and no signal, so that passes too.
Shown by removing the SIGKILL in src/ports/node-process-runner.ts (run):
child as it is: 1 failed expected 'still running after 2 s' to match object { code: null, ... }
child waits 300 ms first: 1 passed
Seen on: test output with a slowed child, not a real run. The runner is correct.
Confirmed, with both of the reporter's outputs. On bug/1986-repro the existing test, now titled "escalates to SIGKILL when a timed-out process that starts late ignores SIGTERM, within the configured grace", delays its child 600 ms and asserts the signal. It fails every run (5 of 5):
pnpm exec vitest run --project unit src/ports/process-runner.test.ts
AssertionError: expected { code: null, … } to match object { code: null, signal: 'SIGKILL', … }
- "signal": "SIGKILL",
+ "signal": "SIGTERM",
❯ src/ports/process-runner.test.ts:821:23
Tests 1 failed | 45 passed (46)
Root cause
Defect in the test. src/ports/process-runner.test.ts:811 on main starts timeoutMs: 100 at the spawn, so SIGTERM can precede the child's handler; :818 accepts code: null from either signal. On Windows any signal ends the child, so by reading the code the test never escalates there; the branch skips it on win32.
Simplest fix
In this test file only: fake setTimeout, advance it once the child has logged that it is ready, then that it handled SIGTERM. Straddle the 100 ms grace and assert the signal. waitUntil polls on the real timer. The real-time bound goes (testing rule 5).
vi.useFakeTimers({toFake: ["setTimeout","clearTimeout"]});constoutcome=runner.run(/* child appends "ready", then " SIGTERM", to log */);awaitwaitUntil(()=>readFileSync(log,"utf8")==="ready");vi.advanceTimersByTime(100);awaitwaitUntil(()=>readFileSync(log,"utf8")==="ready SIGTERM");vi.advanceTimersByTime(99);expect(killSpy.mock.calls.map(([,signal])=>signal)).toEqual(["SIGTERM"]);vi.advanceTimersByTime(1);expect(awaitoutcome).toMatchObject({code: null,signal: "SIGKILL",stderr: "",stdout: ""});
fix: 46 passed, 5 of 5; child 0, 300, 3000 ms late: passed
src/ports 438 passed | 11 skipped; pnpm typecheck clean
broken runner, with the fix:
no SIGKILL, or the default grace → code: 0, expected signal: 'SIGKILL'
grace 1 ms short → [ 'SIGTERM', 'SIGKILL' ], expected [ 'SIGTERM' ]
SIGKILL first → timed out waiting for a process condition
Alternatives rejected
Assert the signal only: a slow start then fails instead of passing, a flake.
A longer timeoutMs: still a race with the host.
Risk
waitUntil gives up after 5 s, and the child exits by itself 4 s after its start.
Restore the timers, the process.kill spy and the log folder in finally.
Windows and the commit hook were not run on the fix.
Activity
V3RON commentedon Nov 30, 2026
Reproduction
Seen on: test output with a slowed child, not a real run. The runner is correct.
Confirmed, with both of the reporter's outputs. On
bug/1986-reprothe existing test, now titled "escalates to SIGKILL when a timed-out process that starts late ignores SIGTERM, within the configured grace", delays its child 600 ms and asserts the signal. It fails every run (5 of 5):Root cause
Defect in the test.
src/ports/process-runner.test.ts:811on main startstimeoutMs: 100at the spawn, so SIGTERM can precede the child's handler;:818acceptscode: nullfrom either signal. On Windows any signal ends the child, so by reading the code the test never escalates there; the branch skips it onwin32.Simplest fix
In this test file only: fake
setTimeout, advance it once the child has logged that it is ready, then that it handled SIGTERM. Straddle the 100 ms grace and assert the signal.waitUntilpolls on the real timer. The real-time bound goes (testing rule 5).Alternatives rejected
timeoutMs: still a race with the host.Risk
waitUntilgives up after 5 s, and the child exits by itself 4 s after its start.process.killspy and the log folder infinally.Fast track
Side findings
Written by an agent.
fix(test): the SIGKILL escalation test sets a grace that differs from…
V3RON commentedon Nov 30, 2026
Delivery run
Merged: #1995 (#1986)
Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(test): the SIGKILL escalation test no longer passes without SIGKI…