Skip to content

fix(skills,doctor): YAML # comment-coercion (Codex catch) + scope --health to subscribed_channels - #428

Merged
joelteply merged 1 commit into
canaryfrom
fix/doctor-health-scope-to-subscribed
May 2, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/doctor-health-scope-to-subscribed

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

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, landing within hours.

Codex's catch — YAML frontmatter # comment-coercion

"skills/join/SKILL.md had unquoted #general in YAML frontmatter, so Codex truncated the description at 'AND'; patched the installed copy + source checkout." — Codex, 2026-05-02 ~19:35Z

Codex's skill loader truncated /airc:join's description at "AND" because the unquoted #general was parsed as a YAML comment. Claude Code's parser is more permissive and didn't trip on it. Wrapping in double-quotes is the canonical YAML fix and works for both.

Audit method (run for any future SKILL.md addition):

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

That surfaced one more case: skills/list/SKILL.md (same pattern, fixed here).

F1 — airc doctor --health scope to subscribed_channels

Codex's --health run reported stale channels (#cambriantech, #useideem, QA rooms) as wedged/BLOCKED even though Codex isn't subscribed to them. Same fix-shape as #406's beacon scoping: intersect bearer-state files with subscribed_channels from config.

Verification (continuum scope: subscribed=general, stale on disk: cambriantech, useideem, 2 qa)

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.

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: 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

🤖 Generated with Claude Code, with the YAML catch credited to Codex CLI 0.128.0

…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]>
Copilot AI review requested due to automatic review settings May 2, 2026 19:34
@joelteply
joelteply merged commit 47f2952 into canary May 2, 2026
8 checks passed
@joelteply
joelteply deleted the fix/doctor-health-scope-to-subscribed branch May 2, 2026 19:35

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

This PR tightens two parts of the AIRC user surface: it fixes YAML frontmatter parsing in skill metadata so #channel text survives strict parsers, and it makes airc doctor --health report bus state for the channels this scope is actually subscribed to instead of stale leftovers on disk.

Changes:

  • Quote description frontmatter in /airc:list and /airc:join so #... is not treated as a YAML comment.
  • Add guidance in /airc:join for runtimes that do not provide Claude Code’s Monitor tool.
  • Scope airc doctor --health per-channel bearer checks to subscribed_channels.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
skills/list/SKILL.md Quotes the skill description so YAML parsers keep the full #channels text.
skills/join/SKILL.md Quotes the description and adds non-Monitor runner guidance for /join.
lib/airc_bash/cmd_doctor.sh Filters bearer-state health checks to the current scope’s configured channel subscriptions.

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

Comment on lines +501 to +504
# Empty _subs (legacy scope without subscribed_channels populated)
# falls back to checking everything — preserves old behavior on
# uninitialized scopes.
if [ -n "$_subs" ] && ! printf '%s\n' "$_subs" | grep -qFx "$channel"; then
# Empty _subs (legacy scope without subscribed_channels populated)
# falls back to checking everything — preserves old behavior on
# uninitialized scopes.
if [ -n "$_subs" ] && ! printf '%s\n' "$_subs" | grep -qFx "$channel"; then
joelteply added a commit that referenced this pull request May 2, 2026
fix(qa): 4 real bugs caught by self-QA pass on canary e8cfe14 — pre-promote cleanup

Self-regression test against the canary build surfaced 4 real bugs that
were either pre-existing or recently introduced. All shippable in one
focused PR before canary→main promote.

## 1. cmd_status monitor-state reads stale bearer files

Same Codex-class bug Joel asked about for `--health` (fixed in #428),
applied to cmd_status's monitor-state line which has the same shape:

  monitor: likely-alive (14146s via #cambriantech; ...)

Reported nearly-4-hour-old "freshness" because the probe globbed
EVERY bearer_state.*.json on disk (including stale files from prior
subscriptions) and picked the smallest age. The smallest age was 14kS
because all my subscribed bearers ARE actually fresh, but a parted
#cambriantech room's stale bearer_state file was still on disk.

Fix: intersect with `subscribed_channels` from config (legacy scopes
without subs populated fall back to all-files for backward compat).
Same fix-shape as #428.

## 2. cmd_rename own-historical-nick is treated as collision

Self-rename round-trip is broken: rename airc-8a5e → test-foo, then
airc-8a5e → test-foo → airc-8a5e fails with:

  ERROR: name collision: 'airc-8a5e' has been seen as an active peer
         in this room (use 'airc logs' to verify)

The collision check at cmd_rename.sh:88-104 scans tail-200 of
messages.jsonl for any matching `from`, but doesn't filter out
nicks that were US (visible because we sent messages under them
before the last rename).

Fix: walk the [rename] chain inside the same 200-line window,
mark all nicks that were us via that chain (current nick + any
old/new pair containing a known-us nick). Exclude self-history
from the collision set. Original safety property (block
renaming TO another peer's active nick) preserved — the check
only fires now when target is in `seen` AND NOT in `my_history`.

Test: rename forward + back now works; rename to a foreign peer's
active nick still correctly blocks.

## 3. `airc daemon stop` silently uninstalls (UX bug)

Pre-fix dispatch had `uninstall|remove|stop)` as one case → typing
`airc daemon stop` ran the FULL uninstall path: removed launchd
plist, killed the process, broke auto-restart on next login. Users
reasonably expect "stop" to halt the running unit but PRESERVE the
registration (systemctl convention).

Fix: remove the `stop` alias from `uninstall|remove|stop`. Add a
dedicated `stop|start)` case that produces a clear error pointing
at the right verbs (uninstall, restart, install).

Bonus: add `airc daemon restart` as a proper convenience verb
(uninstall + reinstall — picks up new airc binary). Help text
updated to list the new verb. Note used `$action` (the captured
arg) in the die message instead of `$1` — `$1` was shifted to the
next arg in dispatch and would trip set -u.

## 4. integration test detect_platform expected wrong values

Test at integration.sh:2543 expected `macos|linux|wsl|windows-bash`
but `platform_adapters.sh:detect_platform()` actually emits
`darwin|linux|wsl|windows`. Test was either written wrong or the
implementation was renamed without updating the test. Callers in
cmd_daemon.sh consistently use `darwin` and `windows` (line 121
case darwin, line 123 case windows), so the implementation is
canonical.

Fix: update test expectations to match impl. With AIRC_DIR pointing
at this checkout: `airc doctor --tests platform_adapters` now
reports 11/11 pass (was 9/11).

## Verification

- `bash -n` clean on all 3 modified shell files
- `airc daemon stop` now prints clear error + 3 alternatives
- `airc daemon restart` works (uninstall + install round-trip)
- `airc doctor --tests platform_adapters`: 11/11 pass

## Pairs with

- #422 (canary→main — this clears 4 real-world QA findings)
- #428 (cmd_doctor --health stale-channel scope — same fix-shape)
- #435 (5 critical Copilot residuals — companion cleanup)

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

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request May 2, 2026
…utput + send-file silent hang (#439)

fix(qa-deeper): 3 real bugs caught by deeper QA pass — multi-room subscribe + part output + send-file silent hang

Self-QA caught 3 more user-facing bugs after #438 landed. All fixable
in one focused PR.

## B5: airc join --room NEWNAME blocked when monitor already running

Pre-fix the trust-existing-monitor short-circuit in cmd_connect (line
253-260) returned 0 unconditionally when the scope's airc.pid showed a
live monitor. Result: user passes `airc join --room qa-test`, gets back
"this scope's monitor is already running" — but qa-test is NOT in
subscribed_channels. To add a new subscription user had to teardown +
rejoin the scope, losing all running state.

Fix: detect when --room was explicit AND the requested name is NOT in
the existing subscribed_channels. In that case, fall through to
subscribe + resolve-or-create the channel gist + save mapping. Bearer
respawn (per _monitor_multi_channel's outer cycle) picks it up within
~30s.

Verified by reading the diff path: subscribe → channel_gist resolve
--create-if-missing → set_channel_gist mapping. The bearer's outer
cycle re-reads channel_map so the next poll subscribes to the new
gist automatically.

## B6: airc part X prints contradictory "deleted" + "preserving" messages

cmd_part deletes room_gist_id (per-channel mapping) and prints
"✓ Room gist deleted." Then cmd_teardown is invoked under
AIRC_TEARDOWN_PART_ONLY=1, sees host_gist_id (a separate file
tracking host-mode marker), and prints "preserving hosted gist
(bus stability)." User reads both and is confused — looks like
the system both deleted AND preserved the same gist.

Fix: gate cmd_teardown's primary "preserving" message on
AIRC_TEARDOWN_PART_ONLY != 1. When part is the caller, it owns the
gist-disposition messaging; teardown stays silent on that.

## B7: airc send-file silent hang on gh-only peers

Post-Phase-3c (#281), substrate is gh-only. send-file uses scp +
relay_ssh which require the peer's host to have authorized our
identity-key via local TCP pair-handshake. For gh-only peers (joined
via gist substrate, never via TCP handshake), there's NO SSH
authorization in authorized_keys. scp hangs on "Permission denied
(publickey)" for 30+ seconds with no useful surface output, then
times out silently — user sees nothing.

Fix: precheck for empty host_target. If empty, the peer was never
pair-handshaked (gh-only path) → die() with a clear, actionable
error explaining the constraint + suggesting alternatives (use
airc msg for messaging, share a link for file transfer until
gh-substrate file transfer is implemented).

The 1MB gist hard limit makes gh-substrate file transfer impractical
for most files — proper fix is a future bearer that can stream large
payloads. For now, fail loud beats hang silent.

## Verification

- `bash -n` clean on all 3 modified files
- B7 verified: `airc send-file other-mac /tmp/payload` now produces
  the clear error message instead of hanging

## Pairs with

- #422 (canary→main — keep clearing real bugs before promote)
- #428 (--health stale-channel scope — same QA-driven cleanup pattern)
- #438 (4 earlier QA bugs)
- #281 (Phase 3c — what removed the SSH transport that send-file
  still expects)

Joel directive 2026-05-02: "fix till totally reliable" + "great work,
keep repairing and qa as you merge". This is the next batch.

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

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