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
fix(server): serialize teardown against input; escalate only a delivered SIGTERM
CodeRabbit review on PR #157, server-side findings.
Serialize input with teardown (#10). `closeSession` left `closed === false` with
the live adapter installed while awaiting `adapter.close()` and `kill()`, so a
concurrent `send.message` could pass `ensureLiveForInput` and prompt an agent
mid-reap — the turn lost or errored. Teardown is now published as a per-session
promise: concurrent closes collapse onto one, and `ensureLiveForInput` awaits it
before reopening.
Drop queued input on close (#7). An adapter's `close()` cancels its turn and
reports `idle`, which is exactly the signal `flushNext()` waits for — so a queued
mid-turn message was prompted into the process about to be reaped. Closing now
clears the queue first, matching `cancel`'s "stop means stop" (SPEC-35).
Escalate only a delivered SIGTERM (#6). `ChildProcess.kill()` returns false when
the signal was not delivered (the child is already gone); scheduling the SIGKILL
anyway could fire it at a pid the OS had since recycled, hitting an unrelated
process. The test double now reports delivery like Node does, and covers the
false path.
Correct the close() contract in subprocess-adapter's doc (#8): it said "must
never throw", contradicting `AgentAdapter.close`, which states the opposite now
that the manager owns bounding and swallowing.
Cover the reaper's untested paths (#9): the default sweep interval and its 30s
floor (which stops a short window busy-looping), and the overlapping-sweep guard.
Both races are red-then-green: each new test reproduces the interleaving before
the fix. 1304 server tests pass.
0 commit comments