Skip to content

docs+feat(doctor): README optional-layers + skills hints + airc doctor --health - #425

Merged
joelteply merged 1 commit into
canaryfrom
docs/optional-layers-doctor-health
May 2, 2026
Merged

joelteply merged 1 commit into
canaryfrom
docs/optional-layers-doctor-health

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Why

Joel 2026-05-02: "make sure the readme is updated with the optional layers / redundancy / maybe hints in skills docs for issues, or from doctor / maybe doctor can test / so doctor could check the connection health".

Three pieces in one PR (single coherent UX surface so AIs/humans hitting "peers feel quiet" get a one-command answer instead of grepping logs cold).

1. airc doctor --health (new mode)

LIVE bus-health probe — answers "is my bus actively working RIGHT NOW?" Complements --connect (pre-flight, before join) with post-join checks against the running substrate. Surfaces the silent-blackout failure modes that bit us through the bios-hardening sprint:

  • gh API rate-limit headroom (parsed from gh api rate_limit):
    • <100 remaining → [WARN] bus may stall soon
    • <1000 remaining → [info] healthy headroom
    • reachable → [ok] with raw count
    • unreachable → [BLOCKED]
  • Daemon liveness: pid file + kill -0 check
  • Per-channel bearer last-recv age (from bearer_state.<ch>.json's last_recv_ts):
    • <60s → [ok], <5min → [info] (idle), 5-30min → [WARN], >30min → [BLOCKED] (wedged)

Smoke test (this Mac)

[ok] gh core rate-limit: 4853/5000 remaining
[info] daemon not installed (substrate runs in-shell only)
       Optional: airc daemon install  (survives sleep/crash, see README → Optional layers)
[BLOCKED] #cambriantech — last bearer recv 57383s ago (>30min — bearer is wedged)
         Fix: airc teardown && airc join  (re-establishes bearer poll loop)
[info] #general — last bearer recv 105s ago (idle channel?)

✗ Bus DEGRADED on 1 issue(s) — see fixes above.

Correctly identifies real wedged state, not a false positive.

2. README — Optional layers section

New section between "Validate Before You Rely On It" and "Core Commands":

Plus the "Validate" section now lists ALL doctor modes.

3. Skills hints

  • skills/doctor/SKILL.md — new "Live-bus health (post-join)" section + "When to run" updated: --health FIRST, full env probe SECOND, logs THIRD.
  • skills/join/SKILL.md — troubleshooting section now leads with "First step when peers feel quiet: airc doctor --health".

Pairs with

🤖 Generated with Claude Code

…r --health (#425)

Joel 2026-05-02: "make sure the readme is updated with the optional
layers / redundancy / maybe hints in skills docs for issues, or from
doctor / maybe doctor can test / so doctor could check the connection
health".

Three pieces in one PR (single coherent UX surface):

## 1. `airc doctor --health` (new mode)

LIVE bus-health probe — answers "is my bus actively working RIGHT NOW?"
Complements --connect (pre-flight, before join) with post-join checks
against the running substrate. Surfaces the silent-blackout failure
modes that bit us through the bios-hardening sprint:

- gh API rate-limit headroom (parsed from `gh api rate_limit`):
  - <100 remaining → [WARN] bus may stall soon
  - <1000 remaining → [info] healthy headroom
  - reachable → [ok] with raw count
  - unreachable → [BLOCKED] (suggests `airc doctor` for full env probe)
- Daemon liveness: pid file + kill -0 check; if installed-but-DOWN
  flags it, if not-installed suggests as optional layer.
- Per-channel bearer last-recv age (parsed from bearer_state.<ch>.json's
  last_recv_ts):
  - <60s → [ok]
  - <5min → [info] (idle channel)
  - 5-30min → [WARN] (check daemon/rate-limit)
  - >30min → [BLOCKED] (bearer wedged; fix = teardown + join)

Smoke-tested on this Mac — correctly identifies #cambriantech (57k+s
stale, real state) as BLOCKED while #general (recent activity) is ok.

## 2. README — Optional layers section

New section between "Validate Before You Rely On It" and "Core Commands"
documenting the optional reliability layers users can stack on top of
the default single-shell substrate:

- Daemon mode (single-machine resilience — sleep/wake/crash survival)
- Tailscale (cross-network mesh; LAN/same-machine work without it)
- Bus reliability escalation ladder L1→L5 (links to
  docs/bus-reliability-escalation.md + docs/fusion-transport.md)
- Vuln-A sandbox (security; documents the per-session nonce + escape
  shape from #423/#424 so readers know what's defending them)

Plus the "Validate" section now lists ALL doctor modes, not just the
default. `--health` is called out as the post-join surface.

## 3. Skills hints

- skills/doctor/SKILL.md: new "Live-bus health (post-join)" section
  documenting `--health`'s output classes + when to reach for it.
  "When to run this skill" updated: --health FIRST when something
  feels wrong, full env probe SECOND, logs THIRD.
- skills/join/SKILL.md: troubleshooting section now leads with
  "First step when peers feel quiet: airc doctor --health".

Together these mean an AI peer (or human) hitting "peers feel quiet"
gets a one-command answer instead of grepping logs cold.

Pairs with #420 (escalation-ladder design — this is the "diagnose
which rung you actually need" surface) and complements #418 (long-term
fusion architecture).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 2, 2026 18:59
@joelteply
joelteply merged commit 2fcb9c2 into canary May 2, 2026
7 checks passed
@joelteply
joelteply deleted the docs/optional-layers-doctor-health branch May 2, 2026 18:59

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

Adds a new post-join diagnostic surface (airc doctor --health) and updates user-facing documentation/skills so “peers feel quiet” can be triaged via a single command rather than log spelunking.

Changes:

  • Add airc doctor --health mode to probe live bus health (gh rate-limit headroom, daemon liveness, per-channel bearer last-recv age).
  • Update README with expanded doctor modes plus a new “Optional layers” section (daemon/Tailscale/reliability ladder/vuln-A sandbox).
  • Update skills/doctor and skills/join to recommend --health as the first troubleshooting step post-join.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
lib/airc_bash/cmd_doctor.sh Adds --health mode and implements the live bus-health probes.
README.md Documents all doctor modes and adds “Optional layers” guidance.
skills/doctor/SKILL.md Introduces a new “Live-bus health (post-join)” section and updates the recommended triage order.
skills/join/SKILL.md Adds troubleshooting guidance pointing first to airc doctor --health.

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

found_state=1
local channel; channel=$(basename "$state_file" .json | sed 's/^bearer_state\.//')
local last_recv_ts
last_recv_ts=$(python3 -c "import sys,json; d=json.load(open('$state_file')); print(int(d.get('last_recv_ts',0)))" 2>/dev/null || echo 0)
echo " ---------------------------------------"
echo
local issues=0 warns=0
local now; now=$(date +%s 2>/dev/null || echo 0)
Comment thread README.md
```

Runs the bundled integration suite (~245 assertions across 32 scenarios) against this machine. Uses an isolated test port (7549) and `AIRC_HOME=/tmp/airc-it-*` — won't touch a live session on the default 7547 or a common alt like 7548. Scenarios cover: pairing, scope isolation, reminders, teardown, send queue, reconnect, status, auth-failure detection, multi-room sidecars, cross-scope peer/whois aggregation, /part persistence, IRC-aligned commands (away/back/list/quit), and platform adapters.
`--health` is the post-join surface that answers *"is my bus actually working RIGHT NOW?"* — checks gh API rate-limit headroom, daemon liveness (if installed), and per-channel bearer last-recv age. Catches the silent-blackout failure modes (rate-limited, daemon crashed, bearer wedged) without you having to dig through logs. Run it any time peers feel quiet.
Comment thread skills/doctor/SKILL.md
Comment on lines +85 to +88
- **Daemon liveness** — if installed but DOWN, suggests `airc daemon restart`. If not installed, suggests it as an optional layer (survives sleep/crash).
- **Per-channel bearer last-recv age** — `[ok]` if <60s, `[info]` if <5min (idle), `[WARN]` if 5-30min stale (check daemon/rate-limit), `[BLOCKED]` if >30min (bearer wedged — `airc teardown && airc join`).

Use it BEFORE diving into logs. If `--health` is green, the bus is fine and the issue is upstream (peer not running airc, peer's gh down, etc.). If `--health` flags something, the fix is right there.
Comment on lines +461 to +466
# ── Daemon liveness (if installed). Daemon is optional but if installed
# and DOWN, the bus is in degraded mode (sends fall back to direct PATCH
# per #420 L1 once that ships; receives fall back per L2).
local daemon_pidfile="$AIRC_WRITE_DIR/daemon.pid"
if [ -f "$daemon_pidfile" ]; then
local dpid; dpid=$(cat "$daemon_pidfile" 2>/dev/null)
Comment on lines +436 to +452
local rate_json
if rate_json=$(gh api rate_limit 2>/dev/null); then
local core_remaining core_limit
core_remaining=$(echo "$rate_json" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['resources']['core']['remaining'])" 2>/dev/null || echo "")
core_limit=$(echo "$rate_json" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['resources']['core']['limit'])" 2>/dev/null || echo "")
if [ -n "$core_remaining" ] && [ -n "$core_limit" ]; then
if [ "$core_remaining" -lt 100 ]; then
printf " [WARN] gh core rate-limit: %s/%s remaining — bus may stall soon\n" "$core_remaining" "$core_limit"
printf " Mitigation: bearer auto-throttles (#416); peers will resume when window resets\n"
warns=$((warns+1))
elif [ "$core_remaining" -lt 1000 ]; then
printf " [info] gh core rate-limit: %s/%s remaining (healthy headroom)\n" "$core_remaining" "$core_limit"
else
printf " [ok] gh core rate-limit: %s/%s remaining\n" "$core_remaining" "$core_limit"
fi
else
printf " [info] gh rate_limit reachable but parse failed (skipping)\n"
joelteply added a commit that referenced this pull request May 2, 2026
…ealth to subscribed_channels (#428)

fix(skills,doctor): YAML frontmatter quoting (Codex catch) + scope --health to subscribed_channels

Bundle of 3 fixes from the live Codex onboarding session 2026-05-02
(first non-Claude peer on the substrate). Codex's first run as a peer
caught real bugs Claude missed — exactly the cross-agent-kind value PR
#422's "outsider agent invitation" predicted.

## Codex's catch — YAML frontmatter # comment-coercion

Codex's skill loader truncated /airc:join's description at "AND" because
the unquoted `#general` in the description value was parsed as a YAML
comment. Codex patched skills/join/SKILL.md by wrapping the description
in double quotes — same fix applied here, plus an audit of all 24 skills
that surfaced one more case (skills/list/SKILL.md, same pattern).

Affected: descriptions that contain `#channel` references rendered fine
to Claude Code (which is more permissive on the YAML parse) but broke
silently on Codex. Wrapping in quotes is the canonical YAML fix and
works for both consumers.

Two skills touched:
- skills/join/SKILL.md (Codex's original patch — preserved here)
- skills/list/SKILL.md (audit-found, same pattern)

Audit method (for future reviews):

  for f in skills/*/SKILL.md; do
    awk '/^description:/||/^argument-hint:/' "$f" \
      | grep -E "^(description|argument-hint):[^\"']*#"
  done

## F1 — `airc doctor --health` scope to subscribed_channels

Codex also reported: "sees stale bearer-state files for older channels
(#cambriantech, #useideem, and QA rooms)". The probe in #425 globbed
every `bearer_state.*.json` on disk including stale files from prior
subscriptions (parted rooms, old QA test scopes, etc.).

Same fix-shape as #406's beacon scoping: intersect the bearer-state
file set with the current subscribed_channels list. Empty subs list
falls back to scanning everything — preserves behavior on uninitialized
scopes (legacy paths without subscribed_channels populated).

Verification in continuum scope (subscribed: ["general"], stale on disk:
cambriantech, useideem, 2 qa rooms):

  Pre-fix:
    [BLOCKED] #cambriantech — last bearer recv 10307s ago
    [info] #general — last bearer recv 84s ago
    [WARN] #qa-cambrian-experiment — never received
    [WARN] #qa-demo-tomorrow — never received
    [BLOCKED] #useideem — 303527s ago
    ✗ Bus DEGRADED on 2 issue(s) (2 warning(s))

  Post-fix:
    [info] #general — last bearer recv 92s ago (idle channel?)
    ✓ Bus healthy.

Same noise-reduction principle as #406; my new --health probe in #425
shipped without applying it. Codex's report exposed the gap on first
non-Claude run.

## Why this matters for #422

The PR's outsider-agent invitation said "the bus gets more reliable
when more agent kinds depend on it AND contribute back." This commit
is the proof-of-concept landing within hours of the invitation: Codex
joined → broadcast on the substrate → caught two YAML bugs Claude's
parser didn't notice → patched the source. That's the substrate immune
response operating across vendors, not just within one team.

Pairs with #427 (which unblocked CI so Codex could see green) and #422
(canary→main bundle).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Codex CLI 0.128.0 (the YAML catch was theirs)

Co-authored-by: Claude Opus 4.7 (1M context) <[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