Repository navigation
fix: bearer heartbeat — detect stuck-but-alive recv (the 'monitor dies' bug) - #312
Merged
Merged
Conversation
Joel 2026-04-29: 'polling easily shuts down on its own OR never even worked, only sending/pinging triggered anything to occur.' Confirmed in production: 52 stale bearer_cli zombies machine-wide; current scope's recv pipeline often had monitor_formatter alive but ZERO bearer_cli children attached (after laptop sleep, after gh transient, etc). #302's child-death detection only catches DEAD; STUCK looks alive because kill -0 succeeds. Fix: bearer_cli emits a sentinel JSON line {airc_heartbeat:1, ts, channel} to stdout every AIRC_BEARER_HEARTBEAT_SEC (default 30s) regardless of bearer activity. monitor_formatter recognizes the sentinel, arms its inactivity watchdog, suppresses display. Stuck bearer → no heartbeats reach formatter → existing 150s watchdog trips → formatter exits 2 → bash multi-channel watcher kills children + respawns the pipe. Watchdog re-enabled for hosts. Pre-fix it was disabled because hosts had no inbound during idle (alarm tripped every 150s). With heartbeats keeping it armed during legitimate idle, stuck-bearer detection works on host AND joiner uniformly. TDD coverage: test_recv_emits_heartbeats_when_bearer_idle — IdleBearer that yields nothing for 2.5s; assert ≥2 heartbeats at 1s interval (would fail pre-fix; now passes). test_heartbeat_line_is_valid_json_with_sentinel — heartbeat line parses as JSON with airc_heartbeat=1 so monitor_formatter can match. This is the test that should have existed before bearer rewrite shipped. 68/68 unit tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Apr 29, 2026
…le, part) (#313) test: add real-gh smoke scenarios — passive_recv, round_trip, idle_then_recv, part_deletes_host_gist The TDD gap Joel called out 2026-04-29: 'not stupid unit, not faked with some half assed local equivalent — what is the most basic things, ping, new rooms, leaving, joining.' New file test/integration_smoke.sh (focused, not bolted onto the 4000-line integration.sh). Each scenario: 1. Uses the REAL gh substrate (no --no-gist, no --no-room). 2. Spawns TWO real airc processes (host + joiner). 3. Asserts user-visible outcomes (gist content, peer's local log, bearer state ticking). 4. Cleans up every created gist on RETURN even on failure. 5. Skips cleanly if gh missing/unauthed. Scenarios: - passive_recv: A sends, B receives via polling without sending. THE missing test — would have caught every 'monitor frozen' report this session. - round_trip: A→B and B→A both arrive via polling. - idle_then_recv: 45s idle, B still receives. Validates #312 bearer-heartbeat keeps the recv pipe alive across legitimate idle (pre-fix idle = pipe-stuck = monitor dead). - part_deletes_host_gist: airc part on host deletes the gist on gh; joiner's part doesn't. All 4 pass live against the real gh substrate. Bumped per-scenario wait window to 60s (gh poll cadence + bearer warmup + GET RTT can exceed 30s on first-message after spawn). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Joel: 'polling easily shuts down on its own OR never even worked.' Confirmed in production. #302 only catches DEAD; STUCK looks alive.
Fix: bearer_cli emits {airc_heartbeat:1} on stdout every AIRC_BEARER_HEARTBEAT_SEC (30s default). Formatter recognizes + arms watchdog + suppresses display. Stuck bearer → no heartbeats → watchdog trips → bash respawns pipe.
Watchdog re-enabled for hosts (heartbeats keep it armed during legitimate idle).
TDD: 2 new tests —
test_recv_emits_heartbeats_when_bearer_idleandtest_heartbeat_line_is_valid_json_with_sentinel. 68/68 pass.