Expand description
Connection-lifecycle reducer handlers. Extracted from reducer/mod.rs in task #182 PR-E for navigability.
Covers: register, goodbye, get_snapshot, plus the enforce_host_only gate and host_is_running predicate that window/saga handlers also call (via super::).
Functions§
- enforce_
host_ 🔒only - Phase B.4 — gate window-mirror reports to Host clients only. The host is the only source of truth about its own window lifecycle; allowing Renderer/Srv/Tool clients to mutate the mirror would let any registered process spoof open/close traffic and break the host-authoritative model. (codex P1 PR #576 round-1.)
- handle_
get_ 🔒snapshot - Phase D.1 — clone the reducer’s canonical state into a
Snapshotevent. Read-only; doesn’t mutate state except for bumpingevent_versionso the snapshot’s version is monotonically distinct from prior events (subscribers applying snapshot + delta events know the snapshot is “as-of” this version). - handle_
goodbye 🔒 - handle_
register 🔒 - host_
is_ 🔒running - Phase B.9.3 — does state.processes contain a Host in the
Runninglifecycle? Used by the OrphanInstance transition check; without this guard, a stale Exited record would fire HostShouldQuit on every benign close. Tool-only sessions (agentmux.exe --diag) also correctly skip the saga because they never register a Host.