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 EXEC_TIMEOUT-over-stalled-delivery test in dispatcher-exec.test.ts passes against a broken dispatcher when its child starts more than 200 ms late #2000
src/daemon/dispatcher-exec.test.ts:729 ("reports EXEC_TIMEOUT, not the stalled-delivery error it provokes, ...") waits a fixed 200 ms (line 750), then expires the exec timeout. If its child starts later than that, no chunk was delivered, nothing is stalled, and the test proves only a plain timeout. The product is correct; not seen on a real run.
Shown by breaking src/daemon/dispatcher-exec.ts:239 (await waited.catch(() => undefined) becomes await waited), with the child waiting before its first statement:
Seen on: test output with a slowed child, not a real run. The dispatcher is correct.
Confirmed, with the reporter's two outputs. On bug/2000-repro the existing test, now titled "reports EXEC_TIMEOUT, not the stalled-delivery error it provokes, when the child starts late and a consumer that stopped reading is why the command outran its timeout", delays its child 700 ms and also asserts that the command's own outcome was the stalled delivery. It failed 3 of 3 runs:
pnpm exec vitest run --project unit src/daemon/dispatcher-exec.test.ts
AssertionError: promise resolved "{ code: null, signal: 'SIGTERM' }" instead of rejecting
❯ src/daemon/dispatcher-exec.test.ts:763:33
Tests 1 failed | 33 passed (34)
Root cause
Defect in the test. src/daemon/dispatcher-exec.test.ts:750 on main sleeps 200 ms from the dispatch, whether or not the child has written. A late child is killed before any chunk is pending, so wait() resolves, dispatcher-exec.ts:239 has no rejection to swallow, and the only assertion (:753) holds for any timeout.
Simplest fix
In this test file only: expire the timeout once the test has the chunk. Keep the reproduction's wait() assertion, drop its 700 ms delay and restore main's title.
// child: process.stdout.write('x'); setTimeout(() => process.exit(1), 15_000); (orphan guard)
onOutput: (_stream,chunk)=>{seen.push(chunk);returnnewPromise<void>(()=>{/* why: unchanged */});},// instead of the 200 ms sleep:awaitvi.waitFor(()=>expect(seen).toEqual(["x"]),{interval: 10,timeout: 10_000});
reproduction with the fix: 34 passed, 3 of 3; child 0 and 3000 ms late: 34 passed
fix, delay dropped: 34 passed, 3 of 3
src/daemon 898 passed; pnpm test:changed 34 passed; pnpm typecheck clean
event loop blocked 1500 ms, child 0 and 700 ms late: passed
broken code, with the fix:
dispatcher `await waited`, child 0, 700, 3000 ms late expected ExecOutputDeliveryStalledError … to match { code: 'EXEC_TIMEOUT' }
runner settles with a delivery pending promise resolved "{ code: null, signal: 'SIGTERM' }" instead of rejecting
Alternatives rejected
A longer sleep: still a race with the host.
The wait without the wait() assertion: a runner that stops reporting the stall would hollow the test out again.
A scripted runner: it cannot model an exit with a delivery outstanding (the comment at main's :643).
Risk
The child ends itself after 15 s, past the 10 s wait; before, it ran until killed.
Activity
V3RON commentedon Nov 30, 2026
Reproduction
Seen on: test output with a slowed child, not a real run. The dispatcher is correct.
Confirmed, with the reporter's two outputs. On
bug/2000-reprothe existing test, now titled "reports EXEC_TIMEOUT, not the stalled-delivery error it provokes, when the child starts late and a consumer that stopped reading is why the command outran its timeout", delays its child 700 ms and also asserts that the command's own outcome was the stalled delivery. It failed 3 of 3 runs:Root cause
Defect in the test.
src/daemon/dispatcher-exec.test.ts:750on main sleeps 200 ms from the dispatch, whether or not the child has written. A late child is killed before any chunk is pending, sowait()resolves,dispatcher-exec.ts:239has no rejection to swallow, and the only assertion (:753) holds for any timeout.Simplest fix
In this test file only: expire the timeout once the test has the chunk. Keep the reproduction's
wait()assertion, drop its 700 ms delay and restore main's title.Alternatives rejected
wait()assertion: a runner that stops reporting the stall would hollow the test out again.:643).Risk
Fast track
Written by an agent.
test: the EXEC_TIMEOUT stalled-delivery test also asserts the command…
V3RON commentedon Nov 30, 2026
Delivery run
Merged: #2002 (#2000)
Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(test): the EXEC_TIMEOUT-over-stalled-delivery test waits for the …