Handle Heartbeat shutdown signals cleanly

This commit is contained in:
Meta Vens 2026-08-10 12:23:42 +01:00
commit bfb92cbb96
4 changed files with 112 additions and 8 deletions

View file

@ -3135,3 +3135,28 @@ three. Exact live replay remains the package acceptance boundary.
package inspection; copied active-attempt settlement; actual corrupted-state
intervention; two bounded actual Heartbeat pulses with brake present and grant
absent.
# Heartbeat graceful shutdown authority map — 2026-08-10
- Owner: the Heartbeat serve process owns its termination signal and the point
at which its scheduling loop stops.
- Inputs: SIGINT/SIGTERM, the current atomic pulse transaction, the configured
interval, and an optional bounded iteration ceiling.
- Outputs: no new pulse after shutdown is observed, interruptible idle wait, one
final `epiphany.heartbeat.serve_receipt.v0` with `shutdownRequested=true`, and
process exit zero.
- Derived state: Docker stop timeout is supervision pressure only; it is no
longer the termination mechanism. A signal cannot roll back an in-flight
atomic pulse and therefore takes effect at the next transaction boundary.
- Forbidden writers: Docker's eventual SIGKILL, artifact sequence, provider
readiness, and the resident Self process do not decide Heartbeat closure.
- Shared paths: bounded completion and signal completion converge on the same
final typed serve receipt. Every interval wait observes the same atomic signal
owner.
- Cut line: install one process-local signal owner before entering `serve`; stop
before the next pulse after a signal and replace every blocking interval sleep
with a signal-aware wait. Do not add persisted shutdown authority or a repair
loop.
- Verification layer: pure stop/wait tests, focused Heartbeat binary tests, then
exact packaged Linux serve under the copied c006 cognitive brake with SIGTERM,
exit zero, final shutdown receipt, and no new grant.

View file

@ -1,5 +1,23 @@
# Fresh workspace handoff
## Heartbeat graceful SIGTERM source complete — 2026-08-10
Heartbeat `serve` now owns SIGINT/SIGTERM with one process-local atomic signal
owner. Shutdown is observed before admitting the next pulse, all interval waits
are interruptible, and signal or bounded completion converge on the existing
typed serve receipt. The receipt now states `shutdownRequested`; an in-flight
atomic pulse is allowed to finish before closure. No persisted shutdown command,
retry writer, or Docker-timeout compensator was added.
Six focused Heartbeat binary tests pass, including signal/boundary stopping and
immediate interruption of the interval wait. The Heartbeat binary checks without
warnings and `git diff --check` passes. This cut is not yet committed, packaged,
or accepted on Linux. Next: commit/push, package exactly once on Starfire, and
run packaged serve on copied c006 state under its cognitive brake. Send SIGTERM
during an interval and require exit zero, a final typed receipt with
`shutdownRequested=true`, no new grant, and byte-identical resident/runtime
authority. Do not release actual c006. Yggdrasil never builds.
## Typed-attempt non-resurrection accepted and actual c006 settled — 2026-08-10
Exact pushed source `c693aaeadbb17204724c9986f16952e2f93e8fc9` packages