Files
rhema-claw/crates
vhaudiquet b5ecc1268c fix(daemon): shut down on SIGTERM instead of being killed
The daemon is PID 1 in its container and the loop watched only ctrl-c.
SIGTERM is what a rollout, a `kubectl delete` and a node drain send, and
the kernel drops a signal whose init has no handler: `kill -TERM 1`
inside the pod left the daemon running. So nothing ever asked the live
turns to stop, and however the process ended, it ended with them
mid-step: the client's stream dead without an end frame, the record
holding a dangling call for the next boot to repair.

The loop watches SIGTERM beside ctrl-c now, and the signal can land
mid-pass: the pass is a future the loop holds across the select instead
of awaiting it bare, so the shutdown arm answers while a turn is still
running. It cuts every live turn through the abort registry, which all
three handlers listen on, so each turn closes its dangling calls and
writes its session back before releasing, the same end the abort route
gives it. The pass then has ten seconds to return, and the forge and
jobs lanes, which run as tasks off the tick, share that deadline.

The binary takes both signals: SIGTERM and SIGINT exit 0 in 25 ms with
"shutting down" in the log. The registry's new signal_all is
unit-tested across two live keys.
2026-12-02 12:36:59 +01:00
..