Skip to content

fix(monitor): beacon time-since uses bearer_state mtime (kills my own 80hr noise) - #404

Merged
joelteply merged 1 commit into
canaryfrom
fix/airc-beacon-time-fix-and-send-loud
May 2, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/airc-beacon-time-fix-and-send-loud

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Self-fix for #400. The receive-silence beacon reported '287715s' (80 hrs) on a freshly-opened bearer because I used airc.pid mtime as the proxy for process start. airc.pid is appended-to across teardown cycles, so its mtime can be from earlier sessions.

Better proxy: bearer_state.<channel>.json mtime. Bearer rewrites these on open + each event, so mtime IS bounded by current process age. airc.pid kept as last-resort fallback for host-only scopes with no bearers.

Trivial scope, single source change.

🤖 Generated with Claude Code

…(kills 80hr noise)

The receive-silence beacon I shipped in #400 reported "no inbound in
287715s" (80 hrs) on a bearer that had only just opened. Cause: my
fallback used airc.pid mtime as "process start time" but airc.pid
gets re-appended-to across teardown cycles — the file's mtime can be
from an earlier session even after a clean restart.

Better proxy: bearer_state.<channel>.json. The bearer rewrites these
on every open + every event, so mtime IS bounded by current process
age. Pre-fix airc.pid mtime gave bogus 80hr alarms; fix now reports
seconds-since-bearer-opened correctly.

Live verification will come when this lands + my next teardown cycle
fires the beacon.

Trivial scope. Single mtime source change in the freshest_recv==0
branch. airc.pid mtime kept as last-resort fallback for the case
where no bearer_state files exist (e.g. host-only scope, no bearer).

## Tests

- bash syntax clean
- Logic verified against my own running airc (the noisy 80hr beacon
  Joel observed earlier this session was the trigger)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 2, 2026 15:20
@joelteply
joelteply merged commit 8f8d248 into canary May 2, 2026
8 checks passed
@joelteply
joelteply deleted the fix/airc-beacon-time-fix-and-send-loud branch May 2, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the monitor’s receive-silence beacon so that “time since inbound” is bounded by the current bearer’s lifetime, avoiding exaggerated multi-hour/day silence reports caused by stale airc.pid mtime across teardown cycles.

Changes:

  • Compute the “no inbound yet” silence floor from the freshest bearer_state*.json mtime instead of airc.pid mtime.
  • Keep airc.pid mtime as a last-resort fallback when bearer state mtimes can’t be used.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread airc
# state files have meaningful mtimes. Same wrong-time
# caveat as the pre-fix code, but it's the last resort.
local pid_mtime=0
[ -f "$AIRC_WRITE_DIR/airc.pid" ] && pid_mtime=$(stat -f %m "$AIRC_WRITE_DIR/airc.pid" 2>/dev/null || stat -c %Y "$AIRC_WRITE_DIR/airc.pid" 2>/dev/null || echo 0)
joelteply added a commit that referenced this pull request May 2, 2026
…le false-positive) (#406)

fix(monitor,#406): scope receive-silence beacon to subscribed channels (kill stale-file false-positive)

Self-fix for #404. The beacon iterated ALL bearer_state*.json files
including stale files from previously-subscribed channels (test rooms
left weeks ago, e.g. bearer_state.useideem.json from Apr 29 with
last_recv_ts: 1777446869 = 80hrs prior). MAX over the set picked the
stale file's positive ts when current channels' bearers had only just
opened (last_recv_ts: null). Result: false 80hr alarm on a fresh
restart.

Caught LIVE 2026-05-02: my freshly-rejoined airc fired beacon
"288919s silent" 25s after start because bearer_state.useideem.json
from 80hrs prior won the MAX over current channels' nulls.

Fix: read CONFIG's subscribed_channels list, build a set of expected
bearer_state file paths, filter the iteration to only those files.
Stale files from old subscriptions get skipped. Falls back to
including all files when subscribed_channels is empty (legacy scope
preservation).

## Tests

- bash syntax clean
- Functional repro of the failure case in commit prep:
    Setup: bearer_state.useideem.json with stale ts, subs=[cambriantech, general]
    Pre-fix: useideem's stale ts won → beacon fires false 80hr
    Post-fix: useideem skipped, freshest_recv=0 → falls to bs_mtime
              fallback which uses recent file mtime correctly

## Pattern

Same family as the no-silent-eat sweep tonight: silent failures
become loud failures, but the loud signal must be CORRECT, not
spurious. False alarms are their own silent failure (alarm fatigue).

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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]>
joelteply added a commit that referenced this pull request Aug 13, 2026
…404) (#1350)

Three consecutive runs on two PRs failed FOUR DIFFERENT daemon tests
with zero overlap, on diffs that touch roster string logic and one pool
constant. That is not a set of bugs; it is a suite that is
nondeterministic under the hosted runner.

The cause is capacity, not logic. These are integration tests that
spawn REAL daemon processes, bind sockets and open SQLite, and the
default harness runs every test binary concurrently with a thread per
core on top of that. A 2-core runner — Windows especially, with slower
process spawn and file locking — cannot carry that many live daemons,
so waits that are comfortable on a dev box expire in CI.

Why this matters more than the individual bugs it was masking: the gate
decides what reaches canary. When it fails randomly, no PR lands
without a re-run war, a GREEN result carries no information so real
regressions can pass, and both maintainers spend their time re-running
instead of building. Every reliability effort downstream is gated on
this one.

Acceptance is N consecutive green runs, not one lucky pass.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants