a1c83ef901
The off-loop heartbeat write broke the producer->consumer invariant #86860 depends on: file freshness no longer equals loop schedulability, yet the probe still classified a stale file as WEDGED — and WEDGED is destructive authority (SIGTERM -> SIGKILL, bypassing the #86684 cron drain floor). The measured motivating stall (112.6s max) exceeds the 90s stale budget, so a healthy loop blocked inside the watchdog's own write could be killed, and executor saturation produces the same false positive. The inverse edge also existed: an off-loop write landing after the loop froze refreshes the file mtime, manufacturing a false-fresh liveness proof. The gateway loop now also arms a loop-scheduling witness: a UNIX socket (state/gateway.loop-tick.<pid>.sock) answered by the loop itself via await asyncio.start_unix_server — socket-buffer writes, no fsync, no disk I/O, so it keeps working on the filesystem that stalls the heartbeat write. The heartbeat payload records whether the witness is armed (loop_tick_socket). The classifier is now two-witness: - socket answers -> ALIVE (file age irrelevant: a stalled write or saturated executor can no longer produce a wedge verdict) - file fresh, socket silent -> UNKNOWN (a late off-loop write can no longer manufacture a liveness proof) - file stale, socket silent, producer armed -> WEDGED (both witnesses agree the loop stopped scheduling) - legacy payload (no flag) -> unchanged single-witness contract: the legacy producer wrote on-loop, so staleness is still proof - any conflict/ambiguity -> UNKNOWN, never escalate Tests are a producer->consumer composition: a real heartbeat loop with a stalled write probes ALIVE while the file is past the stale budget, and launchd_restart fed by the real probe drains instead of escalating; a silent socket with a fresh file denies ALIVE; WEDGED requires the armed socket to agree; a bind-failed producer disables stale escalation; legacy payloads keep the old contract; a source-inspection test pins that the witness is awaited on the loop. Mutation-checked: reverting either source file fails the new tests. 45 tests pass across the watchdog suites; ruff clean.