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 more process-runner.test.ts tests fail when a child or grandchild starts late #1990
Two tests in src/ports/process-runner.test.ts, not among the four of #1985. Not seen on a real run. Shown by making the process wait before its first statement:
"keeps waiting while output is still arriving after the process exits" (line 874): the 300 ms grace starts at the child's exit, and the grandchild's node start must fit in it. Grandchild 400 ms late:
AssertionError: capture was cut off while the pipe was still delivering: expected '74916\n' to contain 'chunk-5'
"settles wait() when a detached grandchild keeps the stdio pipe open after the process exits" (line 821): its 4 s test timeout (line 872) includes the child's start. Child 4.2 s late:
Seen on: test output with slowed processes. Not seen on a real run.
Both reported failures are confirmed. On bug/1990-repro the two existing tests of src/ports/process-runner.test.ts have "starts late" in their title and delay the child 4.2 s and the grandchild 400 ms. They fail every run (2 of 2):
pnpm exec vitest run --project unit src/ports/process-runner.test.ts
:830 the test's own timeout ends before the late child has started: expected 4000 to be greater than 4200
:921 capture was cut off while the pipe was still delivering: expected '44590\n' to contain 'chunk-5'
Tests 2 failed | 44 passed (46)
The first assertion names the cause; without it the test fails as reported (Test timed out in 4000ms). New: that timeout also leaves the endless grandchild running.
Root cause
Defect in the tests. Real clocks include a process start. On main, src/ports/process-runner.test.ts:872 (4 s test timeout) starts before the child does. At :875 the 300 ms grace starts at the child's exit, before the grandchild's node is up.
Simplest fix
Drop both test timeouts (20 s default) and run the grace on a fake clock (setTimeout, clearTimeout, Date):
Both: read the pid line, wait until the runner has armed its grace timer, then advance.
First test: unsettled at 99 ms, settled at 100 ms.
Second test: the grandchild prints chunk-n once the test creates file n. Per chunk: create, read the line, advance 300 ms, still unsettled. Then unsettled at 299 ms, settled at 300 ms.
Grandchildren exit on their own after 30 s.
fix: 46 passed, 3 of 3 runs; 6 of 6 side by side (these tests)
src/ports: 438 passed | 11 skipped; typecheck and commit hook clean
diff to main: +100 -86, this file only
7 s late child, 6.5 s late grandchild: passed
broken runner, six ways (no rearm, default grace, never settles, always rearms,
settles at exit, grace + 1 ms): fails each time on a named assertion
Alternatives rejected
IPC handshake before the child exits, timeouts dropped: shorter, but 300 ms stays a real-time bound (testing rule 5).
Longer grace and timeouts: the start still races them.
Risk
bug/1985-repro adds the same startsLateBy helper: the later fix rebases.
Waiting for the armed timer has no bound but the test's 20 s: a runner that arms none fails by timeout.
Done:bug/1990 at 719a010, draft PR #1992 (test only). Implement and audit report 46/46 passing. The audit did not check CI.
Not done: a complete review, the three fixes below, the gate.
Findings: review round 1, all blocking and open, in src/ports/process-runner.test.ts:
R1, line 873-880: flaky. With 12 runs side by side, 3 failed with "wait() did not settle once the exit grace ended". Cause unknown; line 888 may share it.
R2, line 824: the comment "exit on their own after 30 s" is false for the second test; an early failure leaks its grandchild.
R3, line 826: if the grace is never armed, the tests only time out, with no named error.
bug/1985-repro adds the same startsLateBy helper.
Blocked on: the maintainer: review round 1 is incomplete (R1's cause not isolated). Re-add bug:ready, then /deliver #1990 with --restart --fix.
Done:bug/1990 pushed at e02fee1, draft PR #1992 (test only). Fixes for R1, R2, R3; the implementer reports 12 runs side by side of the whole file with no failure.
Not done: any review of e02fee1, or a complete one before it; the gate. CI was still running.
Findings:
R1's cause (a pid chunk captured after exit re-arms the grace) was read from the code, never captured in a failure.
Before the fix, side-by-side runs also failed "settles wait() on the pipe's close"; left alone.
--restart --fix after an incomplete round 1 goes to fix-check, which has no reviewed commit to start from. A plain --restart repeats that.
Blocked on: the maintainer: in #1992's State: line set both "round":"fix-check" values to "1" (tried offline: it prints review r1), re-add bug:ready, then /deliver #1990 with --restart.
Activity
V3RON commentedon Nov 30, 2026
Reproduction
Seen on: test output with slowed processes. Not seen on a real run.
Both reported failures are confirmed. On
bug/1990-reprothe two existing tests ofsrc/ports/process-runner.test.tshave "starts late" in their title and delay the child 4.2 s and the grandchild 400 ms. They fail every run (2 of 2):The first assertion names the cause; without it the test fails as reported (
Test timed out in 4000ms). New: that timeout also leaves the endless grandchild running.Root cause
Defect in the tests. Real clocks include a process start. On main,
src/ports/process-runner.test.ts:872(4 s test timeout) starts before the child does. At:875the 300 ms grace starts at the child's exit, before the grandchild'snodeis up.Simplest fix
Drop both test timeouts (20 s default) and run the grace on a fake clock (
setTimeout,clearTimeout,Date):chunk-nonce the test creates filen. Per chunk: create, read the line, advance 300 ms, still unsettled. Then unsettled at 299 ms, settled at 300 ms.Alternatives rejected
Risk
bug/1985-reproadds the samestartsLateByhelper: the later fix rebases.Fast track
Written by an agent.
fix(test): startsLate comment keeps its 600 ms (#1990)
V3RON commentedon Nov 30, 2026
Handoff
Done:
bug/1990at 719a010, draft PR #1992 (test only). Implement and audit report 46/46 passing. The audit did not check CI.Not done: a complete review, the three fixes below, the gate.
Findings: review round 1, all blocking and open, in
src/ports/process-runner.test.ts:bug/1985-reproadds the samestartsLateByhelper.Blocked on: the maintainer: review round 1 is incomplete (R1's cause not isolated). Re-add
bug:ready, then/deliver #1990with--restart --fix.Written by an agent.
V3RON commentedon Nov 30, 2026
Delivery run
Merged: none
Parked: #1990 — review round 1 incomplete, the cause of a flaky failure (R1) was not isolated
Waiting: none
Written by an agent.
fix(test): the detached-grandchild test exits its child after the pid…
V3RON commentedon Dec 1, 2026
Handoff
Done:
bug/1990pushed at e02fee1, draft PR #1992 (test only). Fixes for R1, R2, R3; the implementer reports 12 runs side by side of the whole file with no failure.Not done: any review of e02fee1, or a complete one before it; the gate. CI was still running.
Findings:
exitre-arms the grace) was read from the code, never captured in a failure.--restart --fixafter an incomplete round 1 goes to fix-check, which has no reviewed commit to start from. A plain--restartrepeats that.Blocked on: the maintainer: in #1992's
State:line set both"round":"fix-check"values to"1"(tried offline: it prints review r1), re-addbug:ready, then/deliver #1990with--restart.Written by an agent.
V3RON commentedon Dec 1, 2026
Delivery run
Merged: none
Parked: #1990 — the three fixes are pushed, but the fix-check has no reviewed commit to start from, so no review ran
Written by an agent.
chore(agents): deliveries stop for a person only when a person is nee…
fix(test): the exit-grace wait has no real-time bound, the child is k…
V3RON commentedon Dec 2, 2026
Delivery run
Merged: #1992 (#1990)
Parked: none
Waiting: none
Written by an agent.