Repository navigation
fix(bearer): pull LocalBearer from resolver — silent-loss class fix - #296
Conversation
Caught in production on canary 2026-04-29: AI peers reported "all
broadcasts succeeded but nobody saw anything." Investigation showed
that `airc msg --room general` from a joiner returned exit 0 + the
"→ #general (broadcast)" success banner, the message landed in the
sender's local messages.jsonl mirror, but the gist (which every other
peer polls) was never updated. Several rounds of broadcasts to
#general from authenticator-448f and continuum-b741 vanished into a
black hole.
Root cause: bearer_resolver picked LocalBearer for any peer whose
remote_home was a writable directory on this filesystem. LocalBearer's
send appended the wire envelope to `<host>/messages.jsonl` directly
and returned `{"kind":"delivered"}` because the file write succeeded.
That premise was correct in the SSH-tail era (joiners tailed the
host's local file, so writing there reached them). Post-3c the
substrate is the room gist; nobody reads the host's local file
anymore. The bearer was reporting delivered against the wrong
destination.
Fix: remove LocalBearer from _REGISTRY. The gist becomes the single
source of truth for sends, regardless of locality. Latency cost for
same-machine peers goes from ~10ms to ~1-2s (gh polling cadence) —
imperceptible at chat pace, vastly better than silent loss. The
LocalBearer class stays on disk in case we revive a gh-aware variant
that ALSO writes to the gist.
Coverage:
- Updated test_bearer.py: ResolverOrderTests now asserts loopback peers
WITHOUT a room_gist_id raise PeerUnreachable (regression guard
against re-introducing the silent-loss path), and a loopback peer
WITH room_gist_id resolves to GhBearer.
- ResolverPostPhase3cPlusTests asserts available_kinds() == ['gh'].
- scenario_bearer_local in integration.sh now asserts the resolver
registry no longer contains LocalBearer + the resolver does NOT
route loopback peers to it; bearer-class tests use direct
construction.
This fixes the "I don't see them responding, uh oh" observation Joel
reported 2026-04-29: peers weren't frozen, my broadcasts simply
weren't reaching them.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a production silent-message-loss issue by preventing bearer_resolver.resolve() from selecting LocalBearer for loopback/same-machine peers, ensuring messages are routed via gist-backed GhBearer (the post-3c substrate).
Changes:
- Remove
LocalBearerfrombearer_resolver’s registered transports, leavingGhBeareras the sole resolver candidate. - Update unit tests to assert only
ghis available and loopback peers withoutroom_gist_idraisePeerUnreachable. - Update integration coverage to ensure the resolver registry no longer contains
localwhile still smoke-testingLocalBearervia direct construction.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/airc_core/bearer_resolver.py | Drops LocalBearer import/registry entry; documents the silent-loss rationale. |
| test/test_bearer.py | Updates resolver/registry expectations and adds regression guards for loopback-without-gist. |
| test/integration.sh | Adjusts scenario_bearer_local to assert resolver opt-out + keeps direct LocalBearer smoke tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| local _lib_dir; _lib_dir="$(cd "$(dirname "$AIRC")/lib" && pwd)" | ||
| local fake_home; fake_home=$(mktemp -d -t airc-it-bl-home.XXXXXX) | ||
| local off_file; off_file="$fake_home/monitor_offset" |
There was a problem hiding this comment.
off_file is defined but never used in this scenario. Consider removing it to keep the scenario focused (or wire it into the LocalBearer recv test if it’s meant to exercise offset tracking).
| local off_file; off_file="$fake_home/monitor_offset" |
| # Preference order. Earlier = preferred. The resolver tries each in turn | ||
| # via can_serve() and falls through on PeerUnreachable from open(). |
There was a problem hiding this comment.
The comment says the resolver "falls through on PeerUnreachable from open()", but resolve() never calls open() (it returns an unopened bearer) and it also doesn’t attempt sequential open() fallthrough. Please update this comment to reflect the current behavior (or explicitly note that open()-fallthrough is a future enhancement).
| # Preference order. Earlier = preferred. The resolver tries each in turn | |
| # via can_serve() and falls through on PeerUnreachable from open(). | |
| # Preference order. Earlier = preferred. The resolver checks each bearer | |
| # via can_serve() in order and returns the first matching bearer | |
| # unopened. It does not currently attempt open() here or fall through on | |
| # PeerUnreachable from open(); that remains a future enhancement. |
- bearer_gh.send docstring updated to match verify-after-write + 409-retry implementation (prior text described removed ETag/If-Match path) - monitor_formatter: 'AEAD auth failed' → 'unwrap failed (key mismatch, tampered, or malformed envelope)' since unwrap_envelope returns None for any failure mode, not just AEAD auth - cmd_send.sh: stop swallowing bearer_cli send stderr (CLAUDE.md 'never swallow' — was 2>/dev/null on the joiner outcome capture) - README + SKILL.md: correct overstated 'end-to-end encrypted' framing (DMs are; broadcasts go plaintext on the gist) and remove stale same-machine LocalBearer claims (pulled #296) Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Caught in production on canary 2026-04-29: every joiner-side broadcast was vanishing. `airc msg --room general` from a joiner returned success banner, landed in local audit log, but the room gist was never updated — peers polling the gist saw nothing for hours.
Root cause: `bearer_resolver.resolve()` picked LocalBearer for any peer whose `remote_home` was a writable local directory. LocalBearer's send appended directly to `/messages.jsonl` and returned `{"kind":"delivered"}` — correct in the SSH-tail era when joiners tailed the host's file, wrong post-3c when the gist is the substrate.
Fix: remove LocalBearer from `_REGISTRY`. Everyone (including same-machine peers) routes through GhBearer. Latency goes from ~10ms to ~1-2s for same-machine peers — imperceptible at chat pace, vastly better than silent loss. LocalBearer the class stays on disk for possible revival as a gh-aware variant.
Coverage
Test plan