test(rescue): signal the drill's stand-in group instead of relying on GNU timeout

91f25a35f2 drove the budget-kill drills through `timeout -k GRACE 0` and sent it SIGALRM at the deadline, relying on GNU timeout treating that signal as its own expiry: TERM to the stand-in's process group, KILL GRACE seconds later. The ubuntu-26.04 runner ships coreutils from uutils (`9.5-1ubuntu2+0.0.0~ubuntu25`), whose timeout does not handle SIGALRM that way, so the stand-in's `sleep 1000` outlived the driver, kept the captured pipes open and both drills hit their 120 s subprocess timeout (CI run 40869769501, test_window.py:191 and :204). Production code uses neither `kill -ALRM` nor `timeout … 0`; only the drill did.

The driver now starts the stand-in as its own process group (`set -m`), keeps the armed FIFO from 91f25a35f2, sends TERM to the group at the deadline and KILL after GRACE seconds if it is still alive, and exits 124 or 137 like GNU timeout did. It no longer depends on any timeout implementation; all eight drills pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-29 13:53:36 +01:00
1 parent ec0fde6561
commit 3346049481
1 file changed
+15 -3
@@ -45,8 +45,10 @@ if [ "${EPOCHS}" = true ]; then
fi
echo "kill_epoch=$((deadline + GRACE))"
mkfifo "${SANDBOX}/armed"
timeout -k "${GRACE}" 0 bash "${SANDBOX}/stand-in.sh" "$@" &
set -m
bash "${SANDBOX}/stand-in.sh" "$@" &
deploy="$!"
set +m
read -r _ <"${SANDBOX}/armed"
left="$((deadline - $(date +%s)))"
sleep "$((left > 0 ? left : 0))" &
@@ -54,8 +56,18 @@ clock="$!"
status=0
wait -n -p first "${deploy}" "${clock}" || status="$?"
if [ "${first}" = "${clock}" ]; then
kill -ALRM "${deploy}"
wait "${deploy}" || status="$?"
kill -TERM -- "-${deploy}"
sleep "${GRACE}" &
grace="$!"
wait -n -p first "${deploy}" "${grace}" || true
if [ "${first}" = "${grace}" ]; then
kill -KILL -- "-${deploy}"
wait "${deploy}" || true
status=137
else
kill "${grace}"
status=124
fi
else
kill "${clock}"
fi