fix: address Copilot review round 4 (#2339)

Handle SIGQUIT (Ctrl-\) on the same tree-shutdown path as SIGINT, SIGTERM
and SIGHUP. The gate runs in its own process group, so a signal the wrapper
does not handle ends the wrapper alone and orphans the gate behind a lease
that then goes stale under it. The signal test is parametrized over SIGTERM
(143) and SIGQUIT (131).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsmUAZ6aLUAFqenjJKSSRp
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-12 22:57:30 -04:00
commit 17e85a8745

View file

@ -468,7 +468,11 @@ export async function runUnderLease({
);
};
const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
// Every signal a terminal or a supervisor sends to end a run: Ctrl-C, a
// plain kill, a closed terminal, and Ctrl-\ — the child is in its own
// group, so any of these left unhandled would end this process and
// orphan the gate behind a lease that then goes stale under it.
const signals = ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"];
let stoppedBy = null;
let escalation = null;
let handlers = [];