Repository navigation
fix(bearer_gh): emit stderr on every gh api failure (kills silent-eat in recv path) - #403
Merged
Merged
Conversation
_gh_api_get was Joel's exact "you fuckers use try/catch to eat errors" case: 4 different failure modes (gh binary missing, subprocess timeout, non-zero exit, JSON parse error) all silently returned None. recv_stream's poll loop interpreted None as "transient gh hiccup, sleep+retry forever" — so when a real failure happened (auth lost mid-stream, gist deleted, rate limit hit), joiners' Monitor saw nothing for hours while peer chat rotted in the void. Concrete failure observed live tonight: peer messages landing in the gist (verified via gh api gists/<id>) but b69f's recv_stream silently not delivering. Even after #400's receive-silence beacon caught the silence, debugging required logging into the box and tailing bearer_state files manually. Now: every gh api failure prints to stderr (which the bash monitor captures), so the actual error text (rate-limit body, 401 message, network error) reaches the debugger. Pattern: same family as #400 (silent watchdog → loud watchdog), #401 (silent display filter → tolerant filter), #402 (silent display drop → loud drop alarm). Tonight is the "no silent failure modes left in airc receive path" sweep. Per the global "evidence is for the debugger, not the trash" rule. ## Tests - bash + python syntax clean - Unit-test coverage of _gh_api_get exists in test_bearer.py; the new stderr writes are non-intrusive (don't change return values, only add side-effect output) so existing tests pass unchanged. - Live verification: any peer joining a stale/deleted/rate-limited gist will now see real error text in their monitor's stderr stream instead of silent rot. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR makes GitHub-gist transport failures in GhBearer’s _gh_api_get() loud by emitting error evidence to stderr on all failure paths, preventing the receive poll loop from silently treating real failures as indefinite transient hiccups.
Changes:
- Import
sysand emitstderroutput for gh-binary resolution failures, subprocess failures, non-zerogh apiexits, and JSON parse failures. - Preserve existing return behavior (
Noneon failure) while recording_last_errfor classification where applicable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
joelteply
added a commit
that referenced
this pull request
May 2, 2026
… missing) (#408) The Windows daemon launcher .bat (generated by 'airc daemon install') called the airc binary with NO stdout redirect: "$bash_exe" -c "exec '$airc_bin_unix' connect" So airc's event stream (the entire stdout output: hosting messages, peer joins, channel state, beacons) went to NOTHING. Only the launcher's own restart-record messages reached daemon.err. Symptom (b69f 2026-05-02): airc daemon-installed on Windows; daemon "running" per the registry entry; but `airc daemon log` reports "daemon.log doesn't exist" because no process ever wrote to it. Operator has no way to see what airc actually did — bios-critical substrate is opaque on the very platform users need it most. Fix: 1>> daemon.log 2>> daemon.err on the airc invocation. Now daemon.log captures the actual airc event stream while daemon.err keeps the launcher's restart records separate. Per the global "evidence is for the debugger, not the trash" rule + tonight's bios-resilience sweep (everything airc does must be visible AND self-healing). Daemon mode is the OS-supervised path that survives Claude session ends — but only useful if its logs exist. ## Cumulative effect Tonight's airc sweep now closes: - Receive path silent failures (#400/#401/#402/#403/#404/#406) - Self-heal of host rotation (#405/#407) - Daemon-log invisibility on Windows (THIS PR) Last remaining bios-fragility I know of: `airc daemon install` on Windows succeeded BEFORE this fix — so b69f's daemon may be running right now but wrote nothing all session. After this lands + b69f re-installs, daemon.log will populate. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
May 2, 2026
…once-per-session contract notice (#423) fix(monitor,vuln-a): wrap peer chat in <peer-message> sandbox tags Vuln-A: peer broadcasts contain raw text that reaches the AI session via Claude Code Monitor. An attacker peer can put prompt-injection payloads in `msg` ("ignore previous instructions and ...") and the text arrives indistinguishable from operator commands. Fix: wrap peer-supplied content in <peer-message>...</peer-message> tags before printing to stdout. System events (fr in airc/sys) are trusted and pass through unwrapped. Anthropic's prompt-injection guidance recommends exactly this pattern for any third-party text fed to a model — Claude has been trained on XML-tag input boundaries forever, so the tagged content is naturally treated as data not directives. Plus b69f's suggestion 2026-05-02: emit a one-shot stdout contract notice on the FIRST peer message of the session, so the receiving Claude knows the contract surface. Idempotent — only fires once, subsequent peer messages just get the wrap. NOT a complete defense — sufficiently-crafted payload may still attempt escape — but raises the bar dramatically and aligns with the substrate's "evidence is for the debugger" rule (peer content surfaces, but as DATA, not COMMAND). Pairs with future transport- level peer auth (#418 design) for defense-in-depth. ## Tests - python ast.parse: clean - Manual smoke: send a broadcast → check formatter output has <peer-message> wrap + first-message contract notice - Existing system-events still unwrapped (alice joined, watchdog beacons, etc.) ## Pairs with - #418 (fusion-transport): vuln-A + transport-auth shrinks attack surface from "anyone with gh write" to "anyone on tailnet" - #401, #402, #403, #404, #406, #413, #419, #421: receive-path silent-failure sweep. Vuln-A is the next class — silent injection. Now loud + sandboxed. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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's exact 'you fuckers use try/catch to eat errors' case in airc receive path.
_gh_api_gethad 4 silent-return-None branches (gh missing, subprocess timeout, exit non-zero, JSON parse) — recv_stream's poll loop interpreted None as 'transient hiccup, sleep+retry forever.' So real failures (auth lost mid-stream, gist deleted, rate-limit) made joiner Monitors silent for hours while peer chat rotted in the void.Tonight's live failure: peer messages landed in gist (verified via
gh api gists/<id>) but b69f's recv_stream silently dropped. Even after #400's silence beacon caught the symptom, debugging required ssh + tail of state files manually because the upstream cause was eaten.Fix: every failure path now writes the actual error text to stderr (which the bash monitor captures + #400's beacon makes loud). 4 branches × 1 sys.stderr.write each. Doesn't change return values — non-breaking for existing tests.
Pattern: closes the last silent-eat in tonight's airc sweep. #400 made silence loud, #401 fixed prefix tolerance, #402 added display-filter loud-drop alarm, this kills the last silent-eat in the receive transport itself.
Per the global 'evidence is for the debugger, not the trash' rule.
🤖 Generated with Claude Code