Repository navigation
fix: harden three more pipefail/set-e traps in teardown + peers (refs #7) - #9
Merged
Merged
Conversation
Audit of `$(...)` command substitutions under `set -euo pipefail` turned up three more places where a command returning non-zero on legitimate "no result" would silently abort the script. Same class as #6. - cmd_teardown stale-pid read (L1062): cat|tr was unguarded. If $pidfile raced and got removed between the -f test and the read, teardown would abort before the rm -f below. Empty main_pids now falls through cleanly. - cmd_teardown port-reap (L1093-1094): `ps -p "$lpid"` returns 1 when the process has exited. $lpid comes from lsof a moment earlier, so this is a real race under load — would abort the loop mid-scan and leave later ports unchecked. Guarded both ps calls. - cmd_peers entry parse (L1041-1042): `python3 -c "json.load(...)[key]"` exits 1 on a malformed peer record. Under set -e that aborted the whole peer listing at the first bad file. Now a broken record prints empty name/host and the rest of the list still enumerates. Verified: - teardown with dead pids: reaches `Teardown complete`, pidfile cleared. - peers with one malformed + one valid record: lists both, exit 0. Refs #7. Complements #6/#8.
joelteply
force-pushed
the
fix/pipefail-audit-issue-7
branch
from
April 15, 2026 18:45
91617fe to
d4e4790
Compare
joelteply
added a commit
that referenced
this pull request
Apr 15, 2026
Adds a `resilience` scenario to the integration suite — 5 assertions that lock in the behavior the recent pipefail/set-e fixes established. Validation: ran the new scenario against `git show HEAD~2:airc` (the pre-#6/#9 binary): - stale-pidfile asserts FAIL (wedge reproduced) - malformed-peer assert FAILS (listing aborted on bad record) - 2 teardown asserts still pass (specific race not exercised) Against current main: all 5 pass. Full suite now 40/40 green. Coverage added: - Stale-pidfile recovery (#6): write a dead PID, connect, assert it reaches `Hosting as` AND the pidfile is replaced with the new live PID rather than preserved as the dead sentinel. - Teardown with dead pidfile (#9 L1062 neighborhood): seed dead PIDs, run teardown, assert it clears the file and prints the completion marker rather than aborting silently. - Malformed peer record (#9 L1041-1042): drop a bogus JSON next to a valid peer, run `airc peers`, assert the valid peer is still shown. Two teardown assertions pass on the pre-fix binary too — that's because the specific bug at L1062 is a race (file removed between `-f` and the `cat`), which is hard to trigger deterministically. Kept as sanity checks for the broader "dead-pids-in-pidfile teardown completes" invariant, which is what users actually observe. Refs #7. Complements #8/#9.
4 tasks done
joelteply
added a commit
that referenced
this pull request
Apr 15, 2026
Adds a `resilience` scenario to the integration suite — 5 assertions that lock in the behavior the recent pipefail/set-e fixes established. Validation: ran the new scenario against `git show HEAD~2:airc` (the pre-#6/#9 binary): - stale-pidfile asserts FAIL (wedge reproduced) - malformed-peer assert FAILS (listing aborted on bad record) - 2 teardown asserts still pass (specific race not exercised) Against current main: all 5 pass. Full suite now 40/40 green. Coverage added: - Stale-pidfile recovery (#6): write a dead PID, connect, assert it reaches `Hosting as` AND the pidfile is replaced with the new live PID rather than preserved as the dead sentinel. - Teardown with dead pidfile (#9 L1062 neighborhood): seed dead PIDs, run teardown, assert it clears the file and prints the completion marker rather than aborting silently. - Malformed peer record (#9 L1041-1042): drop a bogus JSON next to a valid peer, run `airc peers`, assert the valid peer is still shown. Two teardown assertions pass on the pre-fix binary too — that's because the specific bug at L1062 is a race (file removed between `-f` and the `cat`), which is hard to trigger deterministically. Kept as sanity checks for the broader "dead-pids-in-pidfile teardown completes" invariant, which is what users actually observe. Refs #7. Complements #8/#9.
This was referenced Apr 15, 2026
joelteply
added a commit
that referenced
this pull request
Apr 28, 2026
…t catches up (#240) fix(ux): cmd_send + cmd_invite confirm success; help text catches up to Phase 2 QA pass 2026-04-28 found 12 user-facing bugs. This PR knocks out 4 of the silent / confusing-UX ones: ## cmd_send: success confirmation Before: airc msg <text> → completely silent. User has no signal. After: airc msg <text> → " → #channel (broadcast)" airc msg @peer X → " → @peer on #channel" --internal callers (cmd_rename's [rename] propagation) stay silent on purpose; the user-invoked surface gets the confirmation. ## cmd_invite: framing + usage hint Before: bare 200-char base64 invite string with no context. After: labeled block + "Receiver runs: airc connect <paste>" hint + nudge that same-account peers can use the mesh gist instead. ## airc help text: post-Phase-2 catch-up + airc msg @A @b <text> multi-DM (also @A,b,c csv) + airc msg --channel <name> stamp display channel - "cross-peer-via-host" promise on whois — Phase 2B.3 deleted that walk; now annotated as Phase 2C+ TODO. Verification: tabs 19/0; manual exercise of msg / multi-DM / invite. Bug list remaining: #4 daemon ping timeout, #5 last_recv stuck, #7 kick @-prefix inconsistency, #8 identity link/unlink verb, #9 --channel without subscription, #10/12 (mostly addressed here), #11 (addressed here). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Apr 28, 2026
#243) Resolves continuum-b741's #9 finding: 'airc msg --channel X' succeeds even when sender + recipient aren't subscribed to X, because the channel field was purely a display tag with no filtering. From a trust-modeling POV that meant channels-as-permission-boundary didn't exist. ## Fix (display-side) monitor_formatter.py: read subscribed_channels from config.json each inbound line (fresh read so join/part during session takes effect immediately). If a message's channel field isn't in our subscribed set, skip display. Bypasses (always show, regardless of subscription): - DMs addressed to us (presence in `to` CSV) — a peer reaching out across channels still surfaces - System events (from='airc' or 'sys') — joins/parts/[HOST EVICTED] are operational, not channel-scoped Opt-in semantics: subscribed_channels=None or empty list → show everything (pre-Phase-2B configs unaffected; brand-new scopes before cmd_join writes anything won't see "subscribed to nothing → display nothing" footgun). ## What this is NOT Wire-level filtering. The host's messages.jsonl contains EVERY channel's traffic; any peer with SSH access can read all channels even when subscribed to none. This is display-only; if you need real channel-as-permission, the host needs server-side per-channel filtering on the SSH-tail. That's a much bigger change (Phase 3). Documented in the channel display comments so it's clear what the filter does + doesn't promise. ## Verification python ast.parse: clean test/integration.sh tabs: 19/0 ✓ test/integration.sh general_sidecar_default: 10/0 ✓ Manual e2e via mesh: pending — needs a peer to send a tagged message to a channel I'm not subscribed to + verify it doesn't display. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
May 2, 2026
…g parse (#440) fix(qa): 2 fresh-install bugs — daemon bootstrap I/O error + 'airc msg @peer text' quoted-arg parse Found by self-QA on the fresh-install path Joel asked about. Both hit first-time users + are quick fixes. ## #9: launchctl bootstrap "Input/output error" on macOS daemon install Pre-fix `airc daemon install` over an existing daemon (e.g., switching scopes or re-installing after a stale registration) emits: Wrote /Users/joelteply/Library/LaunchAgents/com.cambriantech.airc.plist Bootstrap failed: 5: Input/output error Try re-running the command as root for richer errors. ERROR: launchctl bootstrap failed. Plist written but not loaded; check Console.app for errors. Then `die`s. But the plist file IS written + the service IS often loaded (launchd's "Input/output error 5" is actually "service already loaded" — bootstrap's stderr lies). Two real bugs: 1. bootout (line 200) doesn't wait for the previous PID to fully exit before bootstrap fires. Result: launchd sees "service still loaded" → bootstrap fails. 2. die() on bootstrap stderr alone is wrong — verify by checking `launchctl list` for the service. If listed, success regardless of stderr noise. Fix: - After bootout, poll `launchctl list` for up to 3s (6×500ms) until the service disappears. - Bootstrap with stderr captured (don't die on it). - Verify by `launchctl list` post-bootstrap. If listed → success. If not → die loud with the captured stderr. This makes daemon install idempotent + reliable across re-installs, which matters for fresh-install confidence + scope-switching workflow. ## #10: 'airc msg "@peer some text"' rejected as invalid peer name Pre-fix the strict charset reject in cmd_send.sh:163 fired when the user quoted the @peer + body together: $ airc msg "@continuum-b69f comms check" ERROR: Invalid peer name in '@continuum-b69f comms check' — must match [a-z0-9-]+ ... Strict parsing assumed `airc msg @peer "body"` (separate args). Common UX intuition (and IRC clients like /msg) accept the single- quoted form as a single line. The reject was correct for safety but unfriendly. Fix: pre-process $@ before the parse loop. If $1 starts with @ AND contains whitespace, split on first whitespace — front becomes the @-peer arg, back becomes the start of the message body. Then the existing loop processes them as if they'd been separate args. Verified: 'airc msg "@peer text"' now passes the @-parse step and proceeds to send (or hits a downstream init/scope error, which is fine — proves the parse changed). Original separate-args form ('airc msg @peer "text"') still works. ## Verification - `bash -n` clean on both modified files - #10 reproduced + fixed: parse error gone ## Pairs with - #422 (canary→main — keep clearing first-time-user bugs) - #439 (deeper-QA fixes — same QA pattern) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 of 3 tasks
joelteply
added a commit
that referenced
this pull request
May 22, 2026
Phase 3.5 continuation. Moves the `identity.json` JSON sidecar that held `(peer_id, client_id, version, created_at_ms)` into a singleton SeaORM row `local_identity` alongside the existing peer_trust / runtime_cursors / subscriptions tables. What stays unchanged: the 32-byte Ed25519 secret in `identity.key` remains an on-disk file with 0600 perms on Unix. Secrets at rest belong in OS-protected storage (filesystem perms, keychain, SQLCipher, hardware enclave) — not inlined into a DB row that may be backed up, replicated, or inspected with a generic SQL browser. The substrate rule: blobs on disk, never in DB. Changes: - New `local_identity` entity (singleton row, fixed PK id=1, with a CHECK constraint pinning that invariant even if a future caller forgets the `SINGLETON_ID` constant). - Migration #5 `m20260522_000005_create_local_identity` ordered after #4 (subscriptions). Strictly additive. - `SqliteEventStore::load_local_identity()` returns the row as a typed `StoredLocalIdentity` DTO; `insert_local_identity()` inserts and surfaces PK conflict via the singleton invariant. - `airc-daemon::identity::LocalIdentity::load_or_generate` becomes async, opens the store at `<home>/events.sqlite`, queries the row, pairs it with `identity.key`. Partial-state error model preserved: refuse to load if one half exists without the other. - Callers updated: `airc-cli::main` and `airc-lib::Airc::open` add `.await`; `embedding_smoke` test likewise. No public API rename. - Tests rewritten as `#[tokio::test]` and adjusted to construct partial-state by writing only the key file vs. inserting only the row. All 5 identity tests + 18 store tests pass. Doctrine alignment: maps to non-negotiable #9 ("Durable substrate data uses the store/ORM boundary") added by #882. Identity metadata WAS a JSON file; it's now ORM-backed. Secret material is the intentional exception per the same non-negotiable's allowance for "install/config bootstrap" plus the explicit "blobs go to disk, NEVER inline in DB or messages" rule. Remaining Phase 3.5 cuts: mesh_identity cache (Codex's lane), account_registry, coordinator beacons. Co-authored-by: Claude Opus 4.7 <[email protected]>
1 of 3 tasks
joelteply
added a commit
that referenced
this pull request
May 22, 2026
Phase 3.5 continuation. Two more JSON sidecars eliminated: 1. The per-mesh-identity registry document used to live at `<root>/<mesh-identity>/registry.json`. Now backed by an `account_registry` table keyed by mesh_identity, with schema_version + generated_at + the document body as opaque JSON (treated as wire-payload encoding per non-neg #9 — the document is a published snapshot for cross-machine sync; live peer/subscription state lives in their own dedicated tables). 2. The gh-gist sentinel `<sentinel_root>/account-registry-gist-id` used a one-per-machine file (no mesh-identity scoping). Now a row in `account_registry_gist_sentinel` keyed by mesh_identity, so a single machine can carry multiple mesh identities (work + personal gh accounts) without their gist ids colliding. Changes: - New entity module `entities::account_registry` with two submodules (document, gist_sentinel) sharing one migration. - Migration #7 `m20260522_000007_create_account_registry` (strictly additive; both tables in one file because they're the same feature surface). - DTOs `StoredAccountRegistry`, `StoredAccountRegistryGistSentinel` in a small `account_registry` module on airc-store. - `SqliteEventStore`: - `load_account_registry(mesh_identity)` - `save_account_registry(StoredAccountRegistry)` (upsert by mesh_identity) - `load_account_registry_gist_sentinel(mesh_identity)` - `save_account_registry_gist_sentinel(...)` (upsert) - `clear_account_registry_gist_sentinel(mesh_identity)` for the out-of-band gist-deleted case - airc-lib: - `FileAccountRegistryStore` → `SqliteAccountRegistryStore` (re-exported with the new name; no `pub use FileAccountRegistryStore` callers existed outside tests). Wraps an `Arc<SqliteEventStore>`; serializes the document to JSON text and writes via the store. `refresh()` reads via the store and validates the document. - `GhAccountRegistryStore` now takes `Arc<SqliteEventStore>` instead of `sentinel_root: PathBuf`. Sentinel load/save/clear go through the store; no more `std::fs::read_to_string` / `std::fs::write` / `std::fs::remove_file` on the sentinel path. - Tests updated: `file_registry_*` → `sqlite_registry_*` using a temp `SqliteEventStore::open_path`. Gh sentinel test becomes async + round-trips through the store. Doctrine alignment: non-negotiable #9 ("Durable substrate data uses the store/ORM boundary"). The document body remains JSON because it's wire-payload encoding for cross-machine sync — the allowance the non-negotiable carves out for "wire payload encoding ... external invite documents." Per-row identifiers (mesh_identity, gist_id, schema_version) are typed columns with indexes, not JSON-buried fields. Verification: - `cargo test --workspace`: all suites green. - `cargo clippy --workspace --all-targets -- -D warnings` clean. - `cargo fmt --check` clean. Remaining Phase 3.5: coordinator beacons (the local `accounts/` beacon directory under wire_root), plus any residual sidecar cleanup. Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 13, 2026
…ning) (#1173) * fix(store): persist account registry through ORM (#887) Phase 3.5 continuation. Two more JSON sidecars eliminated: 1. The per-mesh-identity registry document used to live at `<root>/<mesh-identity>/registry.json`. Now backed by an `account_registry` table keyed by mesh_identity, with schema_version + generated_at + the document body as opaque JSON (treated as wire-payload encoding per non-neg #9 — the document is a published snapshot for cross-machine sync; live peer/subscription state lives in their own dedicated tables). 2. The gh-gist sentinel `<sentinel_root>/account-registry-gist-id` used a one-per-machine file (no mesh-identity scoping). Now a row in `account_registry_gist_sentinel` keyed by mesh_identity, so a single machine can carry multiple mesh identities (work + personal gh accounts) without their gist ids colliding. Changes: - New entity module `entities::account_registry` with two submodules (document, gist_sentinel) sharing one migration. - Migration #7 `m20260522_000007_create_account_registry` (strictly additive; both tables in one file because they're the same feature surface). - DTOs `StoredAccountRegistry`, `StoredAccountRegistryGistSentinel` in a small `account_registry` module on airc-store. - `SqliteEventStore`: - `load_account_registry(mesh_identity)` - `save_account_registry(StoredAccountRegistry)` (upsert by mesh_identity) - `load_account_registry_gist_sentinel(mesh_identity)` - `save_account_registry_gist_sentinel(...)` (upsert) - `clear_account_registry_gist_sentinel(mesh_identity)` for the out-of-band gist-deleted case - airc-lib: - `FileAccountRegistryStore` → `SqliteAccountRegistryStore` (re-exported with the new name; no `pub use FileAccountRegistryStore` callers existed outside tests). Wraps an `Arc<SqliteEventStore>`; serializes the document to JSON text and writes via the store. `refresh()` reads via the store and validates the document. - `GhAccountRegistryStore` now takes `Arc<SqliteEventStore>` instead of `sentinel_root: PathBuf`. Sentinel load/save/clear go through the store; no more `std::fs::read_to_string` / `std::fs::write` / `std::fs::remove_file` on the sentinel path. - Tests updated: `file_registry_*` → `sqlite_registry_*` using a temp `SqliteEventStore::open_path`. Gh sentinel test becomes async + round-trips through the store. Doctrine alignment: non-negotiable #9 ("Durable substrate data uses the store/ORM boundary"). The document body remains JSON because it's wire-payload encoding for cross-machine sync — the allowance the non-negotiable carves out for "wire payload encoding ... external invite documents." Per-row identifiers (mesh_identity, gist_id, schema_version) are typed columns with indexes, not JSON-buried fields. Verification: - `cargo test --workspace`: all suites green. - `cargo clippy --workspace --all-targets -- -D warnings` clean. - `cargo fmt --check` clean. Remaining Phase 3.5: coordinator beacons (the local `accounts/` beacon directory under wire_root), plus any residual sidecar cleanup. Co-authored-by: Claude Opus 4.7 <[email protected]> * fix(store): persist coordinator beacons through ORM (#888) * fix(store): persist coordinator beacons through ORM * test(lib): assert registry imports against coordinator store * cleanup(lib): remove file-backed coordinator beacons (#889) * cleanup(cli): remove config.json command shim (#890) cleanup(cli): remove config json command shim * refactor(identity): store-backed identity commands (#891) * refactor(cli): remove config repair scope command (#892) * refactor(transport): report substrate route health (#893) * refactor(cli): remove bearer state command (#894) * refactor(cli): remove recent senders command (#895) * refactor(cli): remove legacy log scraping surface (#896) * refactor(collaboration): remove jsonl presence scans (#897) * refactor(identity): remove jsonl rename collision helper (#898) * refactor(cli): remove legacy bearer command (#899) * refactor(cli): remove jsonl message builder (#900) * fix(install): copy artifacts instead of symlinking (#901) * fix(identity): migrate identity json into orm state (#902) * fix(lib): report peers from account mesh registry (#903) * fix(cli): agent-runtime attach decision wins over piped-stdout (#904) Regression hit live by Claude Code's Monitor after #882 introduced the `if !stdout_is_tty { return false; }` short-circuit. Monitor captures the child's stdout via a pipe, so `IsTerminal` is false even though we ARE in an agent runtime that wants the live stream. The old priority order classified Monitor as a "noninteractive script" and exited `airc join` immediately. Reorder the decision so agent markers and the runtime-client detector win over the piped-stdout check: 1. `AIRC_NO_ATTACH=1` — explicit operator opt-out. 2. Cargo context (`CARGO_BIN_EXE_*` / `CARGO_PKG_NAME`) — wins over agent markers so install proofs / tests don't hang. 3. Agent markers OR detected runtime client — wins over the TTY check; this is the Monitor/hook host path. 4. TTY — fall-through for direct interactive users. 5. Otherwise — script context, exit after setup. The existing `join_attach_decision_exits_for_redirected_agent_script` test was modeling the bug as the intended behavior; renamed to `join_attach_decision_streams_for_monitor_piped_stdout` and flipped the assertion to assert streaming, with a paired `join_attach_decision_exits_for_plain_pipe_with_no_agent_context` that pins the genuine script-context exit. Verification: - Workspace tests green (9 attach-decision tests pass). - `cargo clippy --workspace --all-targets -- -D warnings` clean. - `cargo fmt --check` clean. - Manually reinstalled + restarted Monitor: attach loop engages on the new binary; subsequent unrelated frame-verification bug (historical peer not in registry) caught and filed separately. Co-authored-by: Claude Opus 4.7 <[email protected]> * fix(lib): wire replay skips unverifiable frames instead of aborting (#905) `replay_wire_once` was failing-closed when a single frame in the wire couldn't be verified — most commonly a frame signed by a peer who's no longer enrolled (orphan identity from a previous install on the same shared wire). That single bad frame aborted the entire replay, which broke `airc inbox`, `airc join`'s attach loop, and any other call site that opens the wire. Now matches the policy already used by `spawn_frame_ingest` in transport.rs:91-100: log the failure and continue, so legitimate later frames still flow through. Both error branches in `replay_wire_once` now skip-and-warn: 1. Malformed JSON on a single line — wire files can carry frames from older builds or ad-hoc test fixtures; refusing to read past one means losing every later real event too. 2. Verification failure (signer not in registry, signature mismatch, etc.) — same fail-open policy as the live ingest task. Concrete repro live-debugged today: my Claude scope's old peer_id 55c30b28 wrote frames to ~/.airc/wires/cambriantech/ yesterday. After today's identity reset, my new install's peer registry no longer trusts that orphan id. `airc inbox` (and `airc join`'s attach replay) failed with: airc: crypto: signer 55c30b28-...-c0279bbe7ef is not in the peer key registry …aborting the whole replay so I couldn't read ANY cambriantech frames, including new legitimate ones from Codex. With this fix the unverifiable frame is logged + skipped and the rest of the wire reads cleanly. Co-authored-by: Claude Opus 4.7 <[email protected]> * docs(codex): clarify live feed contract (#906) * refactor(cli): isolate runtime context classification (#908) * docs: AR/Cambrian/grid framing + data-model + Phase 3.5 migration (#907) * docs: add data-model reference + Phase 3.5 migration playbook Two factual references covering the Phase 3.5 ORM-end-to-end work: - `docs/DATA-MODEL-REFERENCE.md` — authoritative schema for every persistent table in the airc substrate (events, runtime_cursors, peer_trust, peer_rotation_audit, subscriptions, local_identity, mesh_identity, account_registry, account_registry_gist_sentinel, beacons, beacon_channels). One row per table with columns, ownership/readers, retention, indexes, and cross-table invariants. Explicitly calls out what is NOT in the database (wire transcript files, refresh-lock sentinels, Ed25519 secret) and the doctrine for adding new tables. - `docs/PHASE-3.5-MIGRATION.md` — operator playbook for production installs upgrading off the sidecar JSON files. Quick-reference table of which JSONs migrate automatically (only identity.json via #902) vs which are wiped + rebuilt by re-join (subscriptions, beacons, mesh_identity cache, etc.). Recovery procedures for half-initialised states (partial-state errors, orphan signer, '0 paired remote peers'). Hand-cleanup list for dead sidecars after a successful upgrade. Companion docs (AR-LATENCY-CONTRACT, CAMBRIAN-CONSUMER-INTEGRATION-MATRIX, PEER-DISCOVERY-SCALABILITY, AIRC-RUST-SUBSTRATE/README framing updates) pending framing approval — AR-first vs Continuum-first ordering needs Joel's call. Part of the docs-audit follow-up to GRID-SUBSTRATE-AUDIT.md. Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs: AR/Cambrian/grid framing + 3 new architecture docs Widens the doctrine docs from agent-chat-only framing to the backbone bus reality Joel defined: airc carries AR pose streams (60–90Hz, sub-25ms p99), all Cambrian internal coordination (Continuum, OpenClaw, Hermes, agent-relay, forge-alloy, sentinel-ai, AI agents), and the p2p grid Continuum is building. IRC-shaped chat is one consumer profile among many, not the substrate's center. New docs: - `docs/PEER-DISCOVERY-SCALABILITY.md` — current three-layer discovery model (same-machine via shared HOME, per-operator-fleet via account-registry gist, grid-to-grid pending). Beacon TTL strategy, refresh policy. Open questions for scaling past the 100-gist discovery window + cross-operator pairing primitive. - `docs/architecture/AR-LATENCY-CONTRACT.md` — first-cut AR consumer contract. Profile A (60–90Hz pose), Profile B (5–20Hz shared anchors), Profile C (sparse commands). Targets for cadence, payload, e2e latency. What airc provides today vs what AR consumers still need (latency-class headers, per-stream priority, payload-size budget enforcement, ephemeral kind for non-durable high-rate streams). Lists measurement requirements before numbers lock down. Marks TBD-pending-Continuum-measurement. - `docs/architecture/CAMBRIAN-CONSUMER-INTEGRATION-MATRIX.md` — canonical roster of consumers + headers + table-access. Covers Continuum, OpenClaw, Hermes, Claude Code, OpenAI Codex, Cursor, opencode, Windsurf, agent-relay (TBD), forge-alloy (TBD), sentinel-ai (TBD), Generic. Headers convention (`airc.client`, `airc.correlation_id`, `airc.route_class`). Onboarding checklist for new consumers. Framing updates: - `docs/architecture/AIRC-RUST-SUBSTRATE.md` — title changed to "Backbone Bus for Cambrian AR, Continuum/OpenClaw/Hermes, and the p2p Grid"; opening rewritten to lead with three consumer-classes (AR / Cambrian internal / grid) in decreasing latency-sensitivity. The three roles section adds command plane (Phase 4) alongside network substrate + event bus, drops the "messaging layer" framing. - `README.md` — title changed to "Cambrian's Backbone Bus"; opening rewritten to lead with AR pose streams + non-chat consumers; clarifies routing primitives are (1) header-filtered subscription delivery + (2) the route resolver (LAN / Tailscale / relay / WebRTC / Reticulum) with optional `airc.route_class` hint; the IRC-shaped model section reframed as one consumer profile rather than the substrate's center. Companion follow-ups still pending: - GRID-SUBSTRATE-AUDIT.md Phase 3.5 closure markers - ROBUSTNESS-INTEGRATION-PLAN.md shipped vs aspirational partition - crates/airc-lib/src/lib.rs module doc cleanup - REFCONTRACT.md "legacy" header Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs: Phase 3.5 closure markers + lib.rs facade doc + legacy REFCONTRACT label Smaller follow-ups completing the docs audit batch: - `docs/architecture/GRID-SUBSTRATE-AUDIT.md` — Phase 3.6 "Layering rot" section now distinguishes which findings have been softened by Phase 3.5 work (peers_store became a shim post-#883/#885/#902) vs which are still OPEN (lib naming daemon types, transport-owns-crypto-state, line-delimited JSON IPC). The audit was painting all three as untouched after Phase 3.5 landed. - `crates/airc-lib/src/lib.rs` — module doc updated to reflect reality: in-process AND daemon-attached modes both ship. The previous doc said daemon mode was "queued for slice 6b" but the Airc::attach surface has been live for months. Links to the doctrine + consumer matrix + data-model docs. - `REFCONTRACT.md` — labeled LEGACY HISTORICAL SPEC ONLY at the top. Bearer/gist-as-data-plane code referenced inside was deleted in #899/#900; current substrate specs live in docs/architecture/*. Readers landing on REFCONTRACT first were getting the pre-rewrite picture without realizing it. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]> * refactor(cli): move codex integration behind boundary (#910) * feat(cli): airc doctor — install + identity + scope self-diagnosis (#909) * feat(cli): airc doctor — install + identity + scope self-diagnosis Skill `skills/doctor/SKILL.md` documented agents calling `airc doctor` / `--health` / `--fix`. None of those subcommands actually existed on the Rust binary. This PR makes the skill contract real. `airc doctor` walks four checks: 1. **Identity** — `identity.key` + `local_identity` row pairing. Reports the partial-state cases I (claude) lived through this weekend: - key + row + (json optional) → `[ok]` - nothing → `[info]` "fresh scope" - key only → `[BLOCKED]` "orphan key, no recovery without backup" - row only → `[BLOCKED]` "key file missing, can't sign" - key + legacy json + no row → `[WARN]` "pre-#902 install, join will auto-migrate" - legacy json without key → `[WARN]` "orphan metadata" Each non-ok finding carries the exact one-liner fix the operator (or agent) should run. 2. **Daemon liveness** — pings the IPC socket for the scope. Distinguishes "not running (`airc join` will spawn)" from "stale socket file from prior crash, `airc join` will fail until cleaned." On `--fix`, stale sockets are removed. 3. **Binary freshness** — surfaces the install dir so operators notice old-binary-on-PATH symptoms. Build-metadata-derived stale detection is a follow-up (needs `build.rs`). 4. **Route + transport health** (with `--health`) — calls into `Airc::refresh_route_discovery` and renders the typed `TransportHealthSample` snapshot. Same source as `airc transport health`, surfaced inside the doctor walk. `--fix` applies only safe auto-recoveries (stale socket removal today). Identity partial-state is intentionally NOT auto-recovered — wiping a peer_id discards remote-peer trust enrolled on the orphan id; the manual one-liner (`airc teardown --flush`) is the right call there. Status labels use the literal `[ok]` `[info]` `[WARN]` `[BLOCKED]` strings from the skill markdown so the AI narration layer stays aligned with the binary output (regression-guarded by `status_labels_match_skill_doc`). New module `crates/airc-cli/src/doctor.rs`; `Command::Doctor` arm in `cli.rs`; dispatch in `main.rs`. 4 tests: - `status_labels_match_skill_doc` - `fresh_scope_reports_no_identity_material` - `key_without_row_is_blocked_with_clear_fix` - `key_plus_legacy_json_reports_pre_902_install` Verification: workspace clippy (-D warnings) clean, fmt clean, all 4 doctor tests + workspace test suite green. Live-tested on the HOME scope: identity ok, daemon not running, binary install dir surfaced. Onboarding-friction PR: this is the diagnostic floor for new machines coming online (M1, Intel Mac 2017, Windows boxes). When something doesn't work post-install, `airc doctor` gives the operator (or the AI agent on their behalf) the exact fix instead of a generic error. Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs(cli): clarify doctor fix scope --------- Co-authored-by: Claude Opus 4.7 <[email protected]> * feat(lib): expose subscription query API (#911) * feat(lib): expose subscription query API * test(lib): make subscription cursor proof deterministic * test(cli): keep join e2e setup non-streaming * feat(lib): command-bus primitive (Airc::request / reply / await_reply) (#912) * feat(lib): command-bus primitive (Airc::request / reply / await_reply) Phase 4 of GRID-SUBSTRATE-AUDIT. Typed request/reply on top of the substrate's event model with correlation + deadline + cancellation. Serves three use cases on the same primitive (named "command" deliberately, not "tool", because the use cases go beyond agent tools): 1. Tool integration for AI agent runtimes — an agent's tool call (Claude/Codex/OpenClaw/Hermes invoking a remote capability) becomes `Airc::request(headers, body, deadline)`; the agent's tool returns when `await_reply` resolves. Maps cleanly onto each runtime's native promise/future/await. 2. Continuum's event + promise-based command bus — distributed compute / model serving / capability leasing. Same correlation_id semantics, same deadline + cancellation contract. 3. Cross-runtime workflows — OpenClaw thread emits a command Hermes handles; sentinel-ai alerts an operator dashboard replies to; AR command planes route the same way. A command is conceptually an async task. The substrate carries both the request and the reply as plain events with paired `airc.correlation_id`. Forge-alloy contracts (the typed-payload layer) ride alongside: typically `forge.body_hint=<contract>` for the body schema, `airc.command_kind=<contract>` for the substrate's routing/dispatch view. Changes: - `crates/airc-protocol/src/headers_keys.rs` — two new header constants: `HEADER_AIRC_CORRELATION_ID`, `HEADER_AIRC_COMMAND_KIND` (re-exported from `airc_protocol`). Existing `HEADER_AIRC_REPLY_TO` and `HEADER_AIRC_DEADLINE` are reused. - `crates/airc-lib/src/command_bus.rs` (new) — `PendingCommand { correlation_id, deadline_at_ms }`, `Airc::request(target, headers, body, deadline)`, `Airc::reply(reply_to, correlation_id, headers, body)`, `Airc::await_reply(pending) -> Result<TranscriptEvent, AircError>`. Filter-on-subscribe pattern: await_reply subscribes to the live broadcast and matches by `airc.correlation_id` until match or deadline elapse. - `crates/airc-lib/src/error.rs` — new variant `AircError::CommandDeadline { correlation_id }` for the timeout case. Consumers retry with a fresh correlation id; the substrate doesn't reuse timed-out ids. - `crates/airc-lib/tests/command_bus_round_trip.rs` (new) — two integration tests using temp_env to set HOME so two scopes share the same machine-account wire: - `request_and_reply_round_trip_via_shared_wire` proves Alice issues a request, Bob's handler replies, Alice's `await_reply` resolves with the matching reply (correlation_id round-trips, body content survives). - `await_reply_returns_command_deadline_when_no_reply` proves the deadline path returns the typed error rather than hanging. Verification: - `cargo test --workspace` green (all suites) - `cargo clippy --workspace --all-targets -- -D warnings` clean - `cargo fmt --check` clean Phase 4 doctrine: airc routes by correlation_id + delivers the event; forge contracts define the payload semantics; consumers own the command_kind vocabulary. The substrate stays consumer-neutral. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(lib): honor command bus envelope targets --------- Co-authored-by: Claude Opus 4.7 <[email protected]> * docs: CI fidelity as substrate non-negotiable (#10) (#913) docs: CI fidelity as substrate non-negotiable (audit #10) Joel's principle: CI proves the production path; it does not substitute around it. A test that disables a behavior the production path enables is blind to the bugs that behavior creates. Emulate the production shape; reach for disable-flags only when the test is explicitly proving the disabled path. Triggered by Codex's #911 Windows fix that set `AIRC_NO_ATTACH=1` on setup-only join subprocesses to prevent streaming hang. The fix is correct for that specific test but it tests setup-only; a future regression on the stream path wouldn't fire. Adds two pieces to GRID-SUBSTRATE-AUDIT.md: 1. Non-negotiable #10 — codifies the principle. Emulation beats disable-flag; "we can't emulate it cheaply" is a substrate gap to fix, not a license to disable. 2. Phase 5 follow-ups under a new "Known emulation gaps" subsection — catalogues current disable-flag sites (`AIRC_NO_ATTACH` in e2e setup; cross-machine fixture not yet emulated under CI) as filed substrate work, not test patches. Doc-only. Co-authored-by: Claude Opus 4.7 <[email protected]> * test(cli): emulate join attach in e2e harness (#915) * feat(lib): typed lifecycle events (Phase 2) (#914) * feat(lib): typed lifecycle events (Phase 2) Phase 2 of GRID-SUBSTRATE-AUDIT. The substrate now emits typed events for state transitions consumers used to have to poll for. Same envelope shape as chat-shaped events; same subscription filter; same cursor-replayable persistence. Consumers (Continuum, OpenClaw, Hermes, AR runtimes) subscribe via the existing stream APIs and filter by `TranscriptKind`. Variants added (`airc_core::TranscriptKind`): - `PeerArrived` — body: `{peer_id, via}` where via is invite/account_registry/manual/local_scope. - `PeerDeparted` — body: `{peer_id, reason}`. - `WireEstablished` — body: `{wire, channel_name}`. - `WireLost` — body: `{wire, reason}`. - `RoomJoined` — body: `{channel_name, room_id, wire, is_default}`. - `RoomParted` — body: `{channel_name, room_id}`. - `SubscriptionAdvanced` — body: `{consumer_id, lamport, event_id}`. Plus `TranscriptKind::is_lifecycle()` helper that classifies the seven new variants distinctly from chat-shaped ones. Consumers that want only chat filter via `EventFilter::kinds`. Plumbing: - `airc_core::transcript` — variant declarations + classification helper + per-variant body schema docs. - `airc_store::sqlite` — both `to_active_model` and `from_model` extended to map the seven new kinds to/from their snake_case table strings. Round-trip preserved. - `airc_lib::lifecycle` (new) — typed body structs (`RoomJoinedBody`, `PeerArrivedBody`, etc.) plus the pub(crate) `Airc::emit_lifecycle` helper that constructs the event, persists it via the store, fans it out via `live_tx`. - `airc_lib::airc` — `Airc::join` now emits the RoomJoined event after the subscription is durable and the wire subscriber is up. Failures are non-fatal but logged (the room is genuinely joined regardless of whether subscribers are notified). Emit points wired in this PR: RoomJoined (one canonical example). The other six variants have stable body schemas defined and documented; their emit points (PeerArrived/Departed on peer_trust mutation, Wire* on subscriber lifecycle, etc.) are queued for follow-up PRs per Phase 2's slice-by-slice cadence. Integration tests (`crates/airc-lib/tests/lifecycle_events.rs`): - `join_emits_room_joined_lifecycle_event` — subscribe BEFORE join, then call join in a spawned task, assert the RoomJoined event surfaces on the stream with the expected body. - `lifecycle_event_is_persisted_for_cursor_replay` — proves the event is durable in the store so cursor-replay surfaces it for consumers that reconnect. Phase 2 acceptance gate: Continuum can subscribe to lifecycle events through airc-lib without shelling out — this PR makes that true for RoomJoined; the same emit pattern carries forward to the remaining variants. Verification: - `cargo test --workspace` green (all suites) - `cargo clippy --workspace --all-targets -- -D warnings` clean - `cargo fmt --check` clean Co-Authored-By: Claude Opus 4.7 <[email protected]> * test(lib): account for lifecycle cursor events * test(lib): filter message events after lifecycle joins --------- Co-authored-by: Claude Opus 4.7 <[email protected]> * feat(work): add git and PR event contracts (#917) * feat(lib): emit PeerArrived lifecycle event on add_peer (Phase 2 cont.) (#916) * feat(lib): emit PeerArrived lifecycle event on add_peer Continues Phase 2 emit-point wiring after #914. The substrate now publishes a typed PeerArrived event when a new peer enters local trust through `Airc::add_peer` (or any path that routes through it, like `import_invite_beacon`). Provenance via the `via` field on the `PeerArrivedBody` payload: - `"manual"` — direct `Airc::add_peer` call - `"invite"` — `Airc::import_invite_beacon` (peer learned from a shared invite beacon) Account-registry-import path (`import_account_registry_document`) uses a separate multi-store flow (wire_root trust, not just self.inner.home) and is intentionally deferred to a follow-up PR so the emit semantics for that two-store case can be designed cleanly. The `import_account_registry_document` flow does call `import_invite_beacon` at the end for each peer, but by that point the peer is already enrolled via `peers_store::add`, so the `already_known` guard suppresses a duplicate (incorrect-via) emit. Net effect: account-registry-imported peers are silent on the lifecycle stream until the follow-up wires their dedicated emit with via=account_registry. Idempotency: the existing `Airc::add_peer` was already idempotent (re-adding a known peer was a no-op semantically); the new emit respects that. A new `already_known` check at the top of `add_peer_via` skips emission if the peer is already in `Airc::peers()`. Test pins the contract. Sentinel-room behavior: PeerArrived is conceptually account-mesh-level, not channel-level, but TranscriptEvent requires a room_id. The emit uses the scope's current default room. If the scope hasn't joined any room yet (no default), the emit is silently skipped and the consumer can introspect `Airc::peers()` directly. Documented inline. API: - `Airc::add_peer(spec)` — public, defaults via="manual" - `Airc::add_peer_via(spec, via)` — pub(crate), explicit provenance. Used internally by import paths. Integration tests (extending `lifecycle_events.rs`): - `add_peer_emits_peer_arrived_with_manual_via` — adds a peer with the public API, subscribes BEFORE add, asserts PeerArrived surfaces with the expected peer_id + via="manual". - `add_peer_is_idempotent_no_duplicate_lifecycle_event` — adds the same peer twice; only ONE PeerArrived in the recent page. Verification: - `cargo test --workspace` green (all suites; 4 lifecycle tests now pass) - `cargo clippy --workspace --all-targets -- -D warnings` clean - `cargo fmt --check` clean Remaining Phase 2 emit points (queued): - PeerArrived from account_registry import (multi-store flow, needs design) - PeerDeparted on peer removal (no removal API yet) - WireEstablished / WireLost on subscriber lifecycle - RoomParted (needs Airc::part API first) - SubscriptionAdvanced on cursor save Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(lib): propagate peer-arrival lifecycle failures * fix(lib): propagate room-joined lifecycle failures --------- Co-authored-by: Claude Opus 4.7 <[email protected]> * feat(work): add local git watcher adapter (#918) * feat(lib): emit WireEstablished lifecycle event (Phase 2 cont.) (#919) * feat(lib): emit WireEstablished lifecycle event on subscriber attach Continues Phase 2 emit-point wiring after #914 and #916. The substrate now publishes a typed WireEstablished event when a new wire subscriber first attaches (the local-fs adapter starts tailing frames.jsonl for a channel). Emit point: end of `ensure_wire_subscriber`, after the `subscribers` map insert succeeds. Idempotent — second join() for the same channel hits the `contains_key` short-circuit, so only one WireEstablished fires per wire. Body resolution: looks up `channel_name` + `room_id` by matching the wire path against the current subscription set (`Airc::subscriptions()` introduced in #911). Path canonicalised on both sides to tolerate symlinks + .. components. If no matching subscription is found (LAN subscriber spinning up without a join, shared-wire test setups), the emit is silently skipped — the consumer can correlate by wire path through its own state. Lock hygiene: the subscribers map lock is explicitly dropped before the emit_lifecycle call. Holding the wire-subscriber mutex across an await that hits the store + broadcast would serialise all future `ensure_wire_subscriber` calls behind the emit, which is wrong for the multi-room attach case. Failure semantics: `?` propagation, matching the fail-loud posture Codex landed for RoomJoined / PeerArrived in 1cafeab + 2f01433. Lifecycle emission is part of the substrate contract; silently logging hides regressions. Integration tests (extending lifecycle_events.rs): - `join_emits_wire_established_after_subscriber_attaches` — asserts the event surfaces after a join() with the expected channel_name + non-empty wire path. - `wire_established_fires_once_per_wire_idempotent` — second join() for the same channel must not emit a duplicate. Verification: - `cargo test --workspace` green (all suites; 6 lifecycle tests now pass) - `cargo clippy --workspace --all-targets -- -D warnings` clean - `cargo fmt --check` clean Remaining Phase 2 emit points (queued): - WireLost on subscriber tear-down (needs task-lifecycle reshape so the spawned ingest task can signal back when its stream ends) - PeerArrived from account_registry import (multi-store flow, needs design) - PeerDeparted (no removal API yet) - RoomParted (needs Airc::part API first) - SubscriptionAdvanced on cursor save Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(lib): propagate wire lifecycle subscription errors --------- Co-authored-by: Claude Opus 4.7 <[email protected]> * docs: require roadmap reference in PR template (#920) * ci: enforce PR roadmap references (#921) * feat(lib): emit SubscriptionAdvanced on cursor saves (#922) * feat(lib): emit RoomParted lifecycle events (#924) * feat(lib): emit PeerDeparted lifecycle events (#925) * ci: keep roadmap references as PR template guidance (#926) * feat(airc-lib): WireLost emit on stream-end + teardown (#923) Phase 2 lifecycle: 5/7 emit points wired (RoomJoined, PeerArrived, WireEstablished, SubscriptionAdvanced, WireLost). - `spawn_frame_ingest` now takes an optional wire-path + shutdown receiver. When the stream ends or shutdown fires, the task emits `WireLost { wire, reason }` with `reason ∈ {stream_ended, teardown}`. - `Airc::teardown_wire(path)` is the per-wire teardown verb: drops the subscriber, signals the task, awaits its emit (bounded 2s). Kept `pub(crate)` — the public surface for `airc part` / `airc teardown` is owned by the CLI lanes. A `#[doc(hidden)]` test alias exposes it to integration tests. - LAN subscribers pass `None` for wire-path: they're not single-wire and have no canonical path to attach a lifecycle event to. - 2 new integration tests: teardown emits WireLost with reason=teardown; teardown of an unknown wire is a no-op. * feat(codex): add pollable AIRC feed command (#927) * test(install): prove Codex poll in public runtime (#928) test(install): prove codex poll in public runtime * fix(lib): keep routine wire replay quiet (#929) * feat(cli): add Rust update command (#930) feat(cli): add rust update command * refactor(store): move coordinator refresh lock into ORM (#931) * perf(lib): use set-backed event dedup (#932) * perf(lib): broadcast live events by arc (#933) * perf(protocol): remove global peer registry lock (#934) * perf(protocol): remove global peer registry lock * test(cli): allow Windows join attach proof more time * perf(lib): remove global route table locks (#935) * perf(lib): own local ingest task lifecycle (#936) * perf(lib): use set-backed subscription dedup (#937) * perf(lib): shorten subscriber setup locks (#938) * perf(lib): make event filter channels set-backed (#939) * refactor(daemon): length-frame ipc with cbor (#940) * fix(cli): restart daemon during update (#941) * refactor(ipc): split daemon IPC contract into crate (#942) refactor(ipc): split daemon ipc contract into crate * refactor(identity): split local identity into crate (#943) * refactor(trust): split peer trust into crate (#944) * test(command-bus): prove request reply over LAN (#945) test(command-bus): prove request reply over lan * feat(airc-lib): execute relay routes through SDK (#946) * test(consumer-shapes): prove command bus integration (#948) * feat(airc-work): PR observation adapter skeleton (#947) * feat(airc-work): PR observation adapter skeleton Closes Immediate PR Queue #2 from GRID-SUBSTRATE-AUDIT — the git/PR/ kanban event adapter skeleton. - `airc-work::pull_requests`: `PullRequestSource` trait, `PullRequestObserver`, `RepoPullRequestSnapshot`, and a `pull_request_events_since` diff function that emits the existing `PullRequestCheckSuiteChanged` / `PullRequestMergeStateChanged` / `PullRequestReviewSubmitted` events. Mirrors the `local_git` shape: trait abstracts I/O, observer is stateless, caller persists the snapshot. - `InMemoryPullRequestSource`: stub source returning canned snapshots for tests. The real `gh`-CLI source is a follow-up so this lands as a clean contract; consumers (Continuum, OpenClaw, Hermes, agents) get the subscription surface immediately. - `Airc::observe_pull_requests`: mirrors `observe_local_git_workspace` — caller owns the source impl, SDK owns the publish path. Returns the new snapshot + emitted event ids so callers can feed it back as `previous` on the next observation. - 8 unit tests cover cold start, unchanged, check-state change, new reviewer, review state change, dropped PR, and stub source. - 3 integration tests drive the lib-side API end-to-end against the stub source. * fix(airc-work): preserve typed PR source errors * docs(audit): refresh immediate queue after PR adapter (#949) * feat(airc-work): real gh PullRequestSource over GhCommandRunner (#950) Closes Immediate PR Queue #1 from the post-#947 audit refresh — the real GitHub PR source that feeds the `PullRequestSource` skeleton. - `airc-work::pull_requests::gh`: `GhPullRequestSource<R>` over a `GhCommandRunner` trait. Production uses `CommandGhRunner` which shells out to `gh pr list --repo <r> --state all --json <fields>` (`gh` resolves auth from the user's existing keychain/config; this source does not own credential plumbing). - JSON translation: `derive_merge_state` maps `state` × `isDraft` × `mergeStateStatus` to `PrMergeState`; `derive_check_state` rolls up `statusCheckRollup` rows to `PrCheckState` with explicit rules (any IN_PROGRESS/QUEUED → Running; any FAILURE → Failed; any CANCELLED → Cancelled; all SKIPPED → Skipped; otherwise Passed). Supports both the new check-suite shape (status + conclusion) and the legacy status-context shape (state). - BLOCKED / DIRTY / UNSTABLE / UNKNOWN merge-state-status maps to plain Open, not Ready — consumers see the live state instead of an over-promised "Ready". - Reorganized `pull_requests.rs` into a `pull_requests/` module directory (`mod.rs` + `gh.rs`) so future sources (GitLab, Bitbucket) drop in as sibling submodules. - 13 unit tests covering empty list, in-progress / all-success / mixed-failure / empty / draft / merged / closed / blocked permutations, legacy status-context rows, gh-failure, and malformed-JSON paths. All run against a `FakeGhRunner` — no network, no real `gh` binary needed in CI. Scope cut: review-state translation is deferred because the `PullRequestSnapshot::reviews` field uses cryptographic `PeerId`s but `gh` returns GitHub usernames. The cross-walk needs its own design pass. Source emits empty `reviews` until then; the diff function still works, it just doesn't fire `PullRequestReviewSubmitted` events from this source yet. Noted in the audit doc. * docs(readme): restore generic agent IRC framing (#951) * fix(ipc): version daemon endpoint by protocol (#952) * fix(daemon): refresh wire trust for live ingest (#953) * fix(daemon): refresh wire trust for live ingest * test(daemon): support raw wire trust roots * test(airc-lib): prove Continuum-shaped room throughput (#954) * test(airc-lib): prove continuum-shaped room throughput * docs(readme): highlight agent worktree coordination * feat(airc-lib): wire UDP route execution + WebRTC signaling types (#955) * feat(airc-lib): wire UDP route execution + WebRTC signaling types Closes audit queue item #6 (UDP half). The WebRTC orchestration (mesh-as-signaling state machine + route execution + per-peer channel registry) is a separate follow-up PR — this PR ships the data contract types only so that work can build against them. UDP wiring (end-to-end): - `TransportKind::Udp` route execution arm in `route/execution.rs` dispatches via `UdpAdapter` (was returning `unwired_transport_error`). - `Airc::bind_udp(local_addr, peer_endpoints)` mirrors the #946 Relay shape: idempotent, returns the OS-resolved bound address, registers route-health + endpoint, ensures the per-adapter ingest subscriber. - `Airc::add_udp_peer(peer_id, addr)` for runtime peer-endpoint changes — required because the original `UdpAdapter::new(config)` consumed `peer_endpoints` at construction with no update path. - `UdpAdapter::add_peer(peer_id, addr)` is the transport-layer primitive that backs it; `destinations()` now reads from a live `StdRwLock<HashMap<...>>` instead of the construction-time config. - `Airc::send_frame_to_for_test` is a `#[doc(hidden)] pub` test alias on the pub(crate) `send_frame_to`, matching the `teardown_wire_for_test` pattern from #923. Lets transport-wiring integration tests target a specific `FrameKind` (and therefore `RouteClass`) without going through the command-bus. WebRTC signaling types: - `airc-lib::webrtc_signaling::SignalingMessage` (Offer/Answer/ IceCandidate) is the data contract for WebRTC handshake messages carried over the AIRC mesh. Tagged-enum JSON serialization, 5 round-trip tests. - Header constants `airc.webrtc.signaling.kind` and `airc.webrtc.signaling.session_id` so subscribers can filter signaling traffic out of their feeds. Integration proof: - `tests/udp_route.rs`: control event from Alice to Bob between separate Airc homes with `replace_transport_health(udp-only)` forcing UDP as the only admissible route. Both sides bind UDP to pre-allocated ephemeral ports, register each other via `add_udp_peer`, then exchange a `FrameKind::Event` through the route resolver → UDP execution arm → adapter → wire. Substrate gaps surfaced (not blockers, noted for follow-up): - Route policy correctly forbids UDP/WebRTC for `DataInteractive` (UDP is lossy); the appropriate `RouteClass` for AR pose streams is currently `ControlInteractive` or `PresenceEphemeral` — neither is a perfect fit. A `RouteClass::DataLossy` variant might be worth considering. - No public consumer API for routed event sends (only `say`/`request`/`reply` and the doc-hidden test alias). Either `send_frame_to` should become public or there should be a dedicated `send_event_to(peer_id, ...)` SDK method. * fix(udp): recover poisoned endpoint locks * docs(readme): show video avatar room use case * test(airc-lib): drain throughput receiver after send * feat(airc-lib): WebRTC DataChannel orchestration over AIRC mesh (#957) * feat(airc-lib): WebRTC DataChannel orchestration over AIRC mesh Closes the WebRTC half of audit queue item #6. Builds on #955's signaling message types to deliver the full per-peer DataChannel lifecycle. Core API: - `Airc::open_webrtc_to(peer_id)` — initiator. Creates an `RTCPeerConnection`, opens a DataChannel, sends an SDP offer to `peer_id` over the AIRC mesh as a `SignalingMessage::Offer` event, waits for the matching `Answer`, completes the handshake, and registers the resulting adapter so `TransportKind::WebRtcDataChannel` route execution can dispatch sends to it. - `Airc::accept_webrtc_offers()` — spawns the responder task. Subscribes to the substrate stream, filters for incoming Offers, answers them with the same handshake flow in reverse. - `Airc::has_webrtc_channel(peer_id)` — public surface for callers to gate operations on the channel being live. Substrate plumbing: - `AircInner.webrtc_channels: HashMap<PeerId, WebRtcDataChannelAdapter>` is the per-peer registry. `AircInner.webrtc_peer_connections` keeps the RTCPeerConnections alive (dropping the PC drops the channel). `AircInner.webrtc_subscribers` tracks the per-adapter ingest tasks. - `Airc::ensure_webrtc_subscriber(peer_id)` mirrors the ensure_lan/ensure_relay/ensure_udp pattern but keyed by peer. - `TransportKind::WebRtcDataChannel` route execution arm in `route/execution.rs` resolves the target peer from `frame.envelope .target`, looks up the adapter, dispatches send. Rejects non-Peer targets (room broadcasts must go over LAN-TCP or Relay). Approach: - Gather-complete (non-trickle) ICE. Each side waits for ICE candidate gathering to finish, then sends a complete SDP. Matches `webrtc_datachannel/tests.rs::established_adapters`. - PCs gather candidates on `127.0.0.1:0` (loopback only — this PR's path works for same-machine peers; real-network NAT traversal is the follow-up). Integration proof: `tests/webrtc_route.rs` — two Airc instances on separate homes share a local-fs signaling wire, Bob spawns `accept_webrtc_offers`, Alice calls `open_webrtc_to(bob)`, both `replace_transport_health(webrtc- only)`, Alice sends a control event whose only viable route is the freshly-established DataChannel, Bob receives. Round-trip in ~1.5s. Explicit non-goals (follow-ups): - Trickle ICE - STUN/TURN configuration for real-network NAT traversal - Reconnect-on-drop / renegotiation - DataChannel resource cleanup beyond Arc drop semantics * fix(route): enumerate non-peer webrtc targets * docs(webrtc): media tracks plan and implementation split (#959) docs(webrtc): planning sketch for media tracks API API sketch + scope cuts + open questions for the media-tracks lane. No implementation yet — Joel asked to pause and review the surface before any code lands. Key questions to settle: - Codec escape hatch (opinion-ated only, or with_codec override?) - Inbound surface (global callback vs per-peer receiver) - Renegotiation deferral confirmed? Once approved, can be split into parallel sub-lanes between Claude and Codex via airc. * feat(airc-lib): surface incoming WebRTC media tracks (#960) feat(airc-lib): surface incoming webrtc tracks * feat(airc-lib): add WebRTC media track builder (#961) feat(airc-lib): add webrtc media track builder * test(airc-lib): prove WebRTC audio and video tracks (#962) test(airc-lib): prove webrtc audio and video tracks * test(airc-lib): prove WebRTC media and control share a session (#963) test(airc-lib): prove webrtc media and control share session * docs(audit): note observed AIRC coordination flaws (#964) docs(audit): note observed airc coordination flaws * fix(cli): restore IRC-shaped peers and whois commands (#966) fix(cli): restore irc-shaped peers and whois commands * docs(webrtc): show Continuum live-room integration example (#967) * feat(work): heartbeat claims and surface stale owners (#969) * feat(work): publish agent availability state (#971) * feat(work): publish agent availability state * fix(monitor): flush attach readiness banner * feat(diagnostics): add typed substrate diagnostic sink (#973) * feat(airc-lib): typed lane-coordination events (#965) Closes GRID-SUBSTRATE-AUDIT flaw #3 from #964 (prose-only lane claims). Before this PR, agents announcing "I'm taking lane X" did so as free-text chat that other agents had to grep through inbox prose to discover. After this PR, they call typed publish helpers and other agents query typed state. API: - `Airc::claim_lane(lane_id, rationale)` - `Airc::release_lane(lane_id, rationale)` - `Airc::complete_lane(lane_id, pr_number)` - `Airc::block_on_lane(lane_id, blocked_on_lane_id, rationale)` - `Airc::lane_status(lane_id, window) -> LaneStatus` - `Airc::subscribe_lane_coordination()` — filtered stream Headers (stable, filterable without body decode): - `airc.coord.kind` = `"claim" | "release" | "complete" | "block_on"` - `airc.coord.lane_id` = caller-supplied stable id - `airc.coord.pr` = optional PR number Body: JSON-encoded `LaneCoordinationEvent`. Frame kind is `Event` so route policy treats this as ControlInteractive (same class as WebRTC signaling and other coordination metadata). Tests: - 8 unit tests covering round-trip on each LaneAction variant, header value stability, and LaneStatus state transitions - 2 integration tests on two Airc instances over a shared local-fs wire: claim+complete round-trip with PR number; lane isolation (querying lane Y returns empty even when lane X is active on the same wire) Scope cuts (explicit non-goals — follow-up lanes): - No automatic enforcement ("refuse second claim while first open"). The substrate ships the typed contract; scheduler logic is a separate concern. - No scheduler ("auto-assign me the next unclaimed lane"). - No CLI surface (`airc lane claim ...`). Add when agents start consuming this from shell. - Overlap with flaw #2 (roster UX): a renderer for active claims is a natural next slice, but lives above this primitive, not inside it. * feat(airc-lib): active-agent heartbeat events (#968) Closes GRID-SUBSTRATE-AUDIT flaw #6 from #964 (active-agent loop not self-managing). Before this PR, observers had to read inbox prose ("claude-tab-1 back online") to know which agents were alive. After this PR, agents emit typed heartbeats and observers query liveness. API: - `Airc::start_agent_heartbeat(runtime, scope, interval)` — spawns periodic emit task, returns a `HeartbeatTask` handle. First beat is emitted synchronously so observers see the agent live immediately, before the first interval tick. Default cadence: 60s. - `Airc::emit_agent_heartbeat(kind, runtime, scope)` — single-shot emit, useful for graceful `Leaving` on shutdown. - `Airc::active_agents(within, window)` — reduces recent transcript to current liveness; filters stale beats and excludes `Leaving`-terminated peers. Typed event: - `AgentHeartbeat { kind: Alive|Leaving, peer, runtime, scope?, emitted_at_ms }` - Headers `airc.heartbeat.kind` / `runtime` for filterable subscribe. Tests: - 4 unit tests — round-trip on each kind, header value stability, optional-scope JSON shape - 2 integration tests on two Airc instances over shared local-fs wire: heartbeat task visible via active_agents + Leaving signal removes peer; staleness window correctly filters Scope cuts (follow-ups explicitly noted in audit doc): - Heartbeats are durable Events (same trade-off as flaw #4 noise); an ephemeral frame kind is the right long-term fix. - No ready/busy/claimed state machine on top — composes with my #965 lane coordination, separate lane. - No CLI surface (`airc agents` / `airc whois --live`). - No automatic Leaving on process exit; caller owns the handle's lifecycle. * feat(airc-cli): bake build sha + drift detection in doctor (#972) feat(airc-cli): bake build sha + branch, detect installed drift in doctor Closes work card 38c295b8 (installed runtime convergence, P1). Before this PR, `airc doctor` had a TODO noting "we don't have a reliable way to compare to a canonical 'current' build here without baking commit metadata into the binary." After this PR, doctor detects drift and tells the operator how to reconcile. Build-time: - New `crates/airc-cli/build.rs` runs `git rev-parse HEAD` / `--abbrev-ref HEAD` at compile time and emits the values via `cargo:rustc-env=AIRC_BUILD_COMMIT` / `_COMMIT_SHORT` / `_BRANCH`. Re-runs only when `.git/HEAD` or `.git/refs/heads/` changes. Falls back to the literal `unknown` when git isn't available (release tarball builds). - New `crates/airc-cli/src/build_info.rs` exposes the env vars as `pub const` constants via `env!()`. Runtime: - `airc version` now prints the build sha + branch: airc 0.1.0 install: /Users/.../airc build: 492da8d9a3de on feat/installed-runtime-convergence - `airc doctor` binary check now compares the baked-in commit against the install-source HEAD (via the same `install_source_dir` resolver `airc update` uses) and surfaces drift as a `[WARN]`: [WARN] binary: installed binary drifted from source tree (binary=492da8d9a3de source=8225610ae95d) Fix: run `airc update` to reconcile When git wasn't available at compile time the drift check is skipped with an informational note. Audit doc updated to note this closes the "installed binary can reject public commands if update lags" follow-up that surfaced after #966. * feat(work): suggest claimable cards for agents (#975) * feat(work): surface claimable queue suggestions in agent feeds (#976) * feat(airc-lib): typed work-event subscription API (#974) Closes work card e1f8e2e0 (P0, "Work subscription API: typed kanban/PR event stream for agents"). Before this PR, consumers wanting work-card / claim / PR / availability events had to subscribe to the raw substrate stream, call `transcript_is_work_event` on each event, decode the body, then pattern-match. After this PR, they call typed SDK helpers and get `WorkEvent` values directly. API: - `Airc::subscribe_work_events(filter)` — live stream of `(Arc<TranscriptEvent>, WorkEvent)` pairs for events matching the filter. - `Airc::recent_work_events(filter, window)` — query recent transcript for matching work events. - `WorkEventFilter` — builder with `with_repo`, `with_lane_id`, `with_peer`; default matches all. Filter applies at the substrate header level (`forge.work.repo`, `forge.work.lane_id`) plus the substrate-signer peer id, which is the cheap path — bodies are only decoded when the event passes the filter. Tests: - 6 unit tests on `WorkEventFilter` (empty, peer-only, repo match, repo reject, builder chain, clone) - 3 integration tests against two Airc instances over a shared wire: subscribe → CardCreated arrives typed; recent_work_events reads back from transcript; peer-scoped filter excludes other peers' events Building on already-shipped primitives: - `airc-work::transcript_is_work_event` / `decode_transcript_work_event` - Headers `forge.work.repo` / `forge.work.lane_id` / `forge.work.card_id` Consumer story: Continuum managers, agent schedulers, and dashboards can now consume work-state changes without reinventing the filter + decode loop or polling CLI prose. * feat(work): close completed cards (#977) * fix(work): tolerate bounded board replay windows (#979) * feat(airc-lib): AIRC-event diagnostic sink + doctor surface (#978) * feat(airc-lib): AIRC-event diagnostic sink + doctor visibility Closes work card 524c7727 (P1, "Diagnostic sink follow-up: ORM/event sink and doctor surface"). #973 shipped the `DiagnosticSink` trait + `MemoryDiagnosticSink` / `StderrJsonDiagnosticSink`. This PR adds the AIRC-event variant: a sink that publishes each diagnostic as an AIRC Event frame so integrations on any subscribed peer can decode and act on diagnostics without parsing stdout/stderr. API: - `AircEventDiagnosticSink::new(airc)` — DiagnosticSink impl that publishes each event as an AIRC frame with stable severity/component/code headers + JSON body. Non-blocking, non-panicking — sinks must never block their caller. - `Airc::publish_diagnostic_event(event)` — direct publish for callers with a pre-built event. - `Airc::subscribe_diagnostic_events()` — live stream of typed diagnostics. Filtered to events carrying `airc.diag.severity`. - `Airc::recent_diagnostic_events(window)` — query recent transcript for typed diagnostics. Used by doctor. Headers (stable string values matching snake_case enum variants): - `airc.diag.severity` = `"debug" | "info" | "warn" | "error"` - `airc.diag.component` = `"daemon" | "monitor" | "replay" | "subscriber" | "transport" | "webrtc"` - `airc.diag.code` = stable string per `DiagnosticCode` variant Doctor surface: - New `check_recent_diagnostics` walks recent transcript via `recent_diagnostic_events(256)`, counts severities, and surfaces: - `[ok] no recent diagnostic events on the wire` - `[ok] N diagnostic event(s); none at warn/error` - `[info] N warn diagnostic(s); no errors` - `[WARN] N error / M warn diagnostic(s) in last K events` Fix: review with `airc events list --header-prefix airc.diag.severity=` Tests: - 3 unit tests on header value stability (severity/component/code) - 2 integration tests over two Airc instances on shared wire: publish via sink + subscriber receives typed event; recent_query reads back from transcript Scope cut per card: ORM-backed projection is the "or" branch and remains a follow-up. AIRC-event publication is the "and" branch this PR takes; doctor reads from the transcript via `page_recent` which is the same path. ORM is a perf/durability optimization that can land when a callsite needs it. * fix(cli): make diagnostic severity match exhaustive * test(daemon): use production-shaped wire in round trip * fix(work): preserve terminal state on claim release (#980) * docs(audit): consumer integration gap audit + follow-up cards (#981) Closes work card e9ca8a09 ("Audit consumer integration gaps for Continuum/OpenClaw/Hermes/opencode"). Adds a Consumer Integration Gap Audit section to GRID-SUBSTRATE-AUDIT.md covering: - Substrate-side contracts already shipped via consumer_shapes (Continuum PersonaEvent, OpenClaw OpenClawEvent, Hermes HermesEvent — all proven through the LAN command-bus fixture). - Substrate-side intentional non-coverage (opencode/Codex/Claude deferred to Codex's PR-I2 lane; confirmed in consumer_shapes lib.rs). - Open consumer-side adoption gaps: * Continuum TS-layer migration: Rust integration shipped in continuum-core/src/airc/, TS bindings generated but not yet imported. Migration order documented (chat → events → room-membership → signaling → media). * OpenClaw / Hermes repos not in local workspace — substrate side ready; adoption gaps live in those repos. - Cross-cutting substrate gaps still open: real-machine tailnet proof (existing card c877e142); AR pose-stream contract benchmark (existing card 399cef36); personas-as-rooms binding semantics (new); external-identity bridge contract (new). Three new work cards created via airc work create: - d61d7853 (P1) Continuum TS-layer AIRC migration - de0ec298 (P2) Personas-as-rooms binding semantics doc - fdc4b753 (P1) External-identity bridge contract Docs-only; no code changes. * docs(audit): roadmap-to-card coverage + missing-card cleanup (#982) Closes work card b5cb761c ("Audit roadmap-to-card coverage against GRID-SUBSTRATE-AUDIT"). Cross-walked Immediate PR Queue + Observed Flaws #1-#8 against the current work board. Findings: - All 6 Immediate PR Queue items have cards (and most have shipped). - Observed Flaws coverage: * Flaws #1, #3, #6, #8 have cards (all shipped, stale Open). * Flaw #4 partially covered by card a02ed96a. * Flaws #2, #5, #7 had NO cards — created below. - 7 cards are stale-Open (work shipped but state still Open in projection). Listed for the 4d843eda hygiene lane to close via typed state transitions. Three new cards created via airc work create: - 400b5c3c (P1) Roster UX renderer over typed liveness + availability + claim state — closes the missing-card gap for flaw #2. - c29506b8 (P2) Scope identity UX — closes missing-card gap for flaw #5. - 7cdffa82 (P1) Enforce lane work in ~/.airc/worktrees/ leases — closes missing-card gap for flaw #7. Docs-only; no code. * feat(work): surface agent availability in queue status (#983) * test(lib): prove Continuum pose fan-out throughput (#984) * test(lib): prove Continuum pose fan-out throughput * test(lib): run throughput profiles sequentially * feat(work): render typed agent roster (#986) * fix(work): make duplicate claim release idempotent (#987) * feat(airc-lib): external-identity bridge contract (#985) * feat(airc-lib): external-identity bridge contract Closes work card fdc4b753 (P1, "External-identity bridge contract: ExternalIdentity shape for non-PeerId chat protocols"). When AIRC bridges to Slack/Google Chat/Discord/etc., posters in those systems don't have native AIRC PeerIds. Today a bridge has two bad options: 1. Sign as the bridge process — loses per-user attribution. 2. Mint synthetic PeerIds (UUIDv5 from username) — decouples from the cryptographic trust model. Both lie about the trust model. This PR ships the typed primitive that lets bridges preserve attribution honestly: - The wire frame is signed by the bridge's PeerId — consumers verify the bridge identity cryptographically. - The body carries a typed `ExternalIdentity { source, handle, display_name }` describing the external user. - Headers `airc.bridge.source` / `airc.bridge.handle` let subscribers filter without decoding the body. Consumers read it as: "this event is cryptographically signed by bridge X, claiming user Y on Slack posted this content." API: - `Airc::publish_bridged_message(external_identity, text, external_channel)` — bridge-side publish. - `Airc::subscribe_bridged_messages(filter)` — typed stream. - `Airc::recent_bridged_messages(filter, window)` — query helper. - `BridgedMessageFilter::new().with_source(...).with_handle(...)` - `ExternalIdentitySource` closed enum: Slack / GoogleChat / Discord / MicrosoftTeams / Other(String) escape hatch. Tests: - 9 unit tests — round-trip on every source variant, optional fields, filter builder, header-only filter without body decode - 3 integration tests over a shared wire: * Round-trip with frame signed by bridge + typed body carrying ExternalIdentity; assert event.peer_id == bridge (NOT a synthetic per-user id) * Source filter excludes other platforms * Handle filter excludes other users on the same platform Scope cut: this PR ships the SDK primitives. A real Slack/GChat adapter consuming them is a follow-up that lives in whichever repo hosts the bridge process. * feat(work): render typed agent roster (#986) * fix(work): make duplicate claim release idempotent (#987) * feat(airc-lib): external-identity bridge contract Closes work card fdc4b753 (P1, "External-identity bridge contract: ExternalIdentity shape for non-PeerId chat protocols"). When AIRC bridges to Slack/Google Chat/Discord/etc., posters in those systems don't have native AIRC PeerIds. Today a bridge has two bad options: 1. Sign as the bridge process — loses per-user attribution. 2. Mint synthetic PeerIds (UUIDv5 from username) — decouples from the cryptographic trust model. Both lie about the trust model. This PR ships the typed primitive that lets bridges preserve attribution honestly: - The wire frame is signed by the bridge's PeerId — consumers verify the bridge identity cryptographically. - The body carries a typed `ExternalIdentity { source, handle, display_name }` describing the external user. - Headers `airc.bridge.source` / `airc.bridge.handle` let subscribers filter without decoding the body. Consumers read it as: "this event is cryptographically signed by bridge X, claiming user Y on Slack posted this content." API: - `Airc::publish_bridged_message(external_identity, text, external_channel)` — bridge-side publish. - `Airc::subscribe_bridged_messages(filter)` — typed stream. - `Airc::recent_bridged_messages(filter, window)` — query helper. - `BridgedMessageFilter::new().with_source(...).with_handle(...)` - `ExternalIdentitySource` closed enum: Slack / GoogleChat / Discord / MicrosoftTeams / Other(String) escape hatch. Tests: - 9 unit tests — round-trip on every source variant, optional fields, filter builder, header-only filter without body decode - 3 integration tests over a shared wire: * Round-trip with frame signed by bridge + typed body carrying ExternalIdentity; assert event.peer_id == bridge (NOT a synthetic per-user id) * Source filter excludes other platforms * Handle filter excludes other users on the same platform Scope cut: this PR ships the SDK primitives. A real Slack/GChat adapter consuming them is a follow-up that lives in whichever repo hosts the bridge process. * feat(work): enforce lease-zone for work claim + heartbeat diagnostic (#988) * feat(work): enforce lease-zone for work claim + heartbeat diagnostic Closes work card 7cdffa82 (P1, flaw #7 of GRID-SUBSTRATE-AUDIT #964: "Enforce lane work happens inside ~/.airc/worktrees/ leases"). Joel's durable rule across projects: `~/.airc/worktrees/` is the lease zone. Agent lanes work inside leases so the main checkout stays clean and parallel agents don't clobber each other. Docs + airc messages told agents this; nothing in airc actually enforced it. This PR adds enforcement at two specific points. 1) `airc work claim` refuses when cwd is not under `~/.airc/worktrees/`. The refusal points at the `--no-lease-required` override for legitimate one-shot admin claims from the main checkout (e.g. release work, hygiene cards). The check happens in the CLI, before any substrate call, so the refusal is local and cheap. 2) `airc work heartbeat` does NOT refuse on drift (the claim was already granted; refusing here would orphan the work). Instead it emits a typed `WorkspaceLeaseViolation` diagnostic carrying `cwd`, `lease_root`, `card_id`, `claim_id` so substrate subscribers can see when an agent has wandered out of its lease. Best-effort: a publish failure surfaces to stderr rather than being swallowed. Layering: cwd is process state, so the enforcement lives in airc-cli rather than airc-lib/airc-work. The typed diagnostic variants live in airc-diagnostics (closed-set enums extended: `DiagnosticComponent::Work`, `DiagnosticCode::WorkspaceLeaseViolation`). The string mappings in `airc-lib::diagnostic_event_sink` were extended to match and stay covered by the existing stability tests. Path comparison canonicalises both sides so symlinks into the lease zone (and macOS's /var → /private/var) compare correctly, and uses `Path::starts_with` (component-aware) so sibling dirs with overlapping string prefixes like `~/.airc/worktrees-malicious/` are correctly excluded. Tests: - airc-cli lease module: 6 unit tests covering positive (under lease), negative (outside lease), missing lease root, nested subpaths, symlink resolution, sibling-prefix exclusion. - airc-cli integration: `work_claim_refuses_when_cwd_outside_lease_zone` asserts both the refusal stderr AND that `--no-lease-required` recovers. - Existing integration tests that claim from the source tree (not a lease zone) now pass `--no-lease-required` — they exercise the claim machinery, not lease ergonomics. Workspace clippy + fmt clean. * test(cli): allow workspace lifecycle test to bypass lease zone * feat(route): add JSON route proof harness (#989) * feat(route): add JSON proof harness * fix(route): install rustls provider for lan proof * feat(publish): structured publish API + airc publish JSON-receipt CLI (#990) * feat(publish): structured publish API + airc publish JSON-receipt CLI Closes work card a0d740fa (P1, "Structured AIRC publish API for Continuum chat dual-write"). The previous publish surface forced consumers carrying a typed body (Continuum's AircRealtimeEnvelope, OpenClaw events, bridge processes) into one of two bad shapes: 1. Shell out to `airc msg` with a JSON-stringified body. The receipt is human-prose ("sent to ..."); the typed event id, lamport, and concrete channel get lost in the output. To route to a non-default room, callers had to `airc join <X>` first, which mutates this scope's "current room" pointer just to publish. 2. Reach into private `airc-lib` internals. No stable surface. This PR ships the substrate-level publish primitive that Continuum's Stage 2 chat migration (continuum#1432 just merged Stage 1) needs to remove the CLI-process bridge. Public API (airc-lib): - `PublishTarget` — typed routing target: - `CurrentRoom` keeps existing behaviour. - `RoomByName(String)` routes to an already-subscribed room without mutating the default …
This was referenced Jun 20, 2026
joelteply
added a commit
that referenced
this pull request
Jun 21, 2026
The branch-protection clippy (deny warnings) check (now required) caught a clone-on-ref-slice in the new learned_lan_candidates test. Borrow via std::slice::from_ref instead of `&[stale.clone()]`. No behavior change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 21, 2026
…) (#1275) * feat(airc): learn a peer's live IP from authenticated inbound dials (#9) The robustness layer on top of #8 (stable port) + #10 (prune ghosts): when a peer whose PUBLISHED endpoint went stale (moved networks, pre-#8 record) can't be reached at its advertised address, recover by LEARNING its real address from the fact that it connected to US. How (no security change — no pin loosening): - transport: the LAN adapter's inbound accept path already authenticates the client cert → peer_id. Thread the source addr through and, via a generic `on_inbound(peer_id, source_ip)` observer, report it. The pipe stays dumb — it just says "this enrolled peer connected from this IP"; only the IP is surfaced (the source PORT is the peer's ephemeral outbound port, not its listener). - airc-lib: register an observer that records peer_id -> real_ip into an in-session `learned_ips` map (shared across daemon clones like dial_quarantine; re-learned each session, no persistence). The dial path prepends `(learned_ip, advertised_port)` as a PREFERRED candidate — the learned IP is known-reachable, and the port is stable under #8, so a peer that moved IPs is dialable again before paying timeouts on the stale rungs. The outbound dial still pins to the expected peer_id (TLS unchanged). On a LAN reachability is symmetric: if X reached us, we can reach X back at that IP. Generic transport + the smarts in the layer above ([[airc-vs- continuum-layer-boundary]]). Tests: learned_lan_candidates pairs the learned IP with advertised ports and adds nothing when it already matches a stored endpoint; all 30 transport tests + discovery/lan suites green. Co-Authored-By: Claude Opus 4.8 <[email protected]> * test(airc): use slice::from_ref in #9 test (clippy clone-on-ref) The branch-protection clippy (deny warnings) check (now required) caught a clone-on-ref-slice in the new learned_lan_candidates test. Borrow via std::slice::from_ref instead of `&[stale.clone()]`. No behavior change. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jul 24, 2026
* feat(self-heal): atomic stamped endpoint replace — a fresher advertisement fully replaces, a staler one is refused M5↔bigmama live repro #2: a registry re-sync took a peer's new IP but kept its stale port, dialing a dead endpoint forever. Root cause: the stored endpoint set had no freshness, so nothing could order an old advertisement against a new one, and merge-backfilled stale endpoints could ride a fresh presence into the store. - peer_trust gains endpoints_advertised_at_ms (additive nullable migration; NULL floors to 0 so any stamped ad outranks legacy rows). - set_peer_trust_endpoints now writes endpoints + stamp atomically and replaces monotonically: staler stamp = whole write refused. - AccountPeerBeacon carries endpoints_advertised_at_ms (serde-default, old documents keep decoding); publishers stamp at generation; the reader-side merge backfill keeps the CARRIER's stamp so stale endpoints never masquerade as fresh; import clamps the peer-asserted stamp to now (same doctrine as the last_seen security clamp). Tests: - sqlite: fresher_advertisement_atomically_replaces_endpoints_and_staler_is_refused - sqlite: replace_peer_trust_preserves_stored_endpoints now pins the stamp too - account_registry: import_fresher_advertisement_fully_replaces_endpoint_and_stale_is_refused (the exact (ip1,port1)->(ip2,port2) regression + stale replay + fresh-presence/stale-endpoints composite) - account_registry: merge_retains_endpoints_when_fresher_beacon_is_endpointless now pins carrier-stamp backfill Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): refresh-on-failure — a failed dial re-reads the rendezvous before any blind retry M5↔bigmama live repro #1: after a daemon restart, the remote peer kept dialing the dead port (.249:58842 vs live .249:57958) forever, never re-reading the rendezvous. - Airc::heal_failed_dials(store, failures): record the failed peers' stored endpoint sets, do ONE rendezvous re-read + import (atomic + monotonic per the item-1 stamp, so it can never make things worse), and re-dial ONLY when a failed peer's endpoints actually changed — through the one pinned dial path (cost order, quarantine skips, stop on first success). No fresher endpoint = no extra dial pass: the dial-quarantine backoff (15s→120s) keeps owning the dead endpoint's retry cadence, so this is bounded by construction. - Daemon wiring: the registry task shares its ONE resolved rendezvous (store + gate) via an Arc<OnceLock> slot; refresh_routes_once heals after emitting dial-failure diagnostics, honoring the same gh/hermetic gate as registry ticks, and the healed snapshot feeds the connected count + relay self-election. - New Arc<dyn AccountRegistryStore> delegating impl (mirrors Box) so one resolved door serves both loops without a second resolution. Test: stored_endpoint_dial::heal_failed_dials_rereads_rendezvous_and_dials_fresh_endpoint (stub AccountRegistryStore rendezvous — unchanged rendezvous heals nothing; fresh advertisement is imported, replaces the corpse, and the live endpoint is dialed immediately). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): publish-on-bind — a freshly bound listener propagates to the rendezvous immediately M5↔bigmama live repro #1 (the propagation half): a daemon restart that lands on a new port only advertised it at the refresh loop's first cadence tick, leaving every peer dialing the dead port meanwhile. - Registry task nudges endpoint_resync the moment listen_lan_advertising binds; Notify stores the permit, so the refresh loop's biased select publishes IMMEDIATELY on start instead of waiting out first_tick. Idempotent: an unchanged advertisement republishes the same document. - Relay self-election (become_relay binds a listener too) now nudges the same resync so the new relay endpoint propagates without waiting up to a full 120s cadence. - (IP-move rebinds were already edge-triggered via refresh_advertised_endpoints Ok(true) — this closes the two bind sites that were not.) Test: registry_refresh::pre_loop_resync_permit_publishes_immediately_not_at_first_tick (first_tick/cadence at 3600s — only the stored permit can publish in time; pins the Notify-permit-before-loop-start contract). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): advertise hygiene — never-correct addresses and known-peer collisions are refused (and withdrawn) M5↔bigmama live repro decay modes #3 and #4: Docker containers advertised internal bridge IPs (172.x) as reachable endpoints — dozens of 3s dial timeouts per refresh across every peer — and one peer record carried the reader's OWN Tailscale IP as another machine's endpoint. - ONE hygiene predicate pair in airc-lib (lan_advertise_rejection / tailscale_advertise_rejection): loopback, unspecified, link-local 169.254/16, the 172.16/12 docker/bridge band, and CGNAT-on-the-LAN- rung are never advertised; the Tailscale rung only carries 100.64/10. RFC1918 10/8 + 192.168/16 (en0-style) and public addresses pass. The 172.16/12 refusal is by RANGE (the UDP source-address detection has no ifname) — per the live evidence that band is never correct on this mesh, and such a host still advertises its Tailscale rung. - Known-peer collision guard: an endpoint equal to a KNOWN other peer's stored endpoint is refused loudly — advertising it would extend the corrupted-record chain onto the rendezvous. - Applied at BOTH advertise seams (listen_lan_advertising and the per-tick refresh_advertised_endpoints): a rejected IP reads as None, so an already-poisoned advertised rung is WITHDRAWN on the next tick (self-heal), edge-triggering a corrected registry publish. - CLI detection (detect_lan_ip / is_tailscale_ipv4) now delegates to the same one predicate — detection and advertisement can't drift. Tests (lan.rs): advertise_hygiene_rejects_never_correct_classes_and_admits_real_lans, refresh_withdraws_a_poisoned_advertised_bridge_ip, refresh_refuses_to_advertise_a_known_peers_address. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): failure-counted eviction — 5 consecutive dial failures mark an endpoint DEAD until a fresher advertisement M5↔bigmama live repro decay mode #4 (the reader side): dozens of stored 172.x ghost endpoints burned a 3s timeout each on every discovery refresh, forever — timed backoff alone caps at 120s and never gives up. - DialQuarantine entries now carry a consecutive-failure streak and the endpoint-set freshness stamp the failures accrued under. New DialGate verdict: Dial / Backoff{remaining_ms} / Dead{count}. DEAD_AFTER_CONSECUTIVE_FAILURES = 5 (spans several backoff windows, so a flapping endpoint recovers long before eviction). - Dead = evicted from the dial set (record kept, endpoint skipped even after every backoff window elapses). Revival: a STRICTLY fresher advertisement stamp (item 1's endpoints_advertised_at_ms, plumbed per-peer through dial_stored_peer_endpoints) lifts the eviction for ONE probe; a failure under the fresher stamp re-kills immediately — so a live-but-unreachable publisher costs at most one 3s dial per fresh advertisement, and a genuinely revived daemon (same stable port, fresh ad) reconnects on the first probe. The retention sweep (10min idle) stays the bounded second-chance horizon. - Dead skips surface distinctly: PeerDialSkip.dead=true, and 'airc transport health' prints 'endpoint dead: … evicted after 5 consecutive failed dials; revived only by a fresher advertisement' instead of a misleading countdown. Test: dial_quarantine::fifth_consecutive_failure_is_dead_until_a_fresher_advertisement (dead after backoff expiry, not-dead below threshold, fresher-stamp one-probe revival + immediate re-kill, success wipes the streak). Also: peer_dials_lan_rung_and_skips_tailscale updated — the advertise hygiene now rightly refuses loopback as a LAN advertisement, so the dial-ladder test builds its imported endpoint set directly. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): airc dial <host:port> — manual authenticated recovery dial The hands-on override for a wedged mesh (M5↔bigmama live repro): one authenticated dial both proves reachability AND teaches the REMOTE our real source address via learn-live-address (#9), un-wedging its next outbound dial when its stored endpoint for us is stale. - New verb: airc dial HOST:PORT [--expected-peer <uuid>] [--timeout-ms N] (default 10s — a recovery verb watched by an operator, generous next to discovery's 3s sweep budget). Full mTLS-pinned handshake via the one existing connect_lan path; success stamps last_seen on the trust record (an authenticated dial IS fresh contact); success and failure both print LOUDLY with next-step hints; nonzero exit on failure. - --expected-peer is inferred when omitted: stored-endpoint exact match first, else the identity-derived stable port (#8, airc_lib::stable_lan_port, now pub for exactly this). Zero or several candidates is a loud error naming them — never a guess. - Flag named --expected-peer (not --peer) because --peer is the global volatile-peer-spec flag; same convention as lan-send. Test: cli::dial_verb_parses_endpoint_and_optional_peer (parse contract). Smoke-verified live: two temp homes, lan-listen + dial → 'CONNECTED: authenticated handshake … succeeded'; dead endpoint + un-enrolled peer both fail loudly with exit 1. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): unknown_channel auto-rebind — a registry-known channel is re-bound, never silently store-and-dropped M5↔bigmama live repro decay mode #5 (the blind room): a frame from a connected peer landed durably in the store but no scope bound its channel (#general → unknown_channel) — stored, never surfaced. Investigation (root cause): scope↔channel binding = presence beacons in the machine coordinator store; join/part/current_room already republish the scope's FULL subscription set (publish_presence uses the whole SubscriptionSet), so a joining scope does re-bind all its known rooms. What a restart/wipe loses is the MACHINE-side beacon table (drained stale rows, moved wire root, identity drift) — and nothing consulted the account registry's known-channel list to recover. The fix, at the one inbound seam (RouterInboundBridge): - (a) the loud diagnostic with channel + peer already exists at the transport layer (FrameUndeliverable, persisted=true) — unchanged. - (b) on an unbound channel, the bridge now consults the machine's LOCAL account-registry cache (SqliteAccountRegistryStore over the same events.sqlite, injected via with_account_registry): if the account KNOWS the channel (document channel union or any beacon's subscriptions derive to the frame's RoomId), the registry's subscribing beacons are republished into the coordinator store — restoring the durable binding — and the verdict is re-checked before claiming Delivered. New warn diagnostic UnknownChannelRebound (channel id + name + rebound beacon count). Channels the account does not know keep the honest unknown_channel verdict. Test: daemon_lan_visibility::unknown_channel_auto_rebinds_from_account_registry_cache (unknown stays unknown; known channel re-binds + delivers + is loud exactly once; the binding persists — no per-frame patching). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(identity): Windows-portable local fallback — never the degenerate local:unknown-host:unknown-user Root cause of the M5<->bigmama blind room, receiver-side log: 24 unknown_channel frames all on channel eef18336-1424-5231-bcf9-5b6f8e04deb6, which is exactly derive_room_id("local:unknown-host:unknown-user", "general"). On Windows every probe in local_fallback_identity() failed silently: HOSTNAME and USER/LOGNAME env vars do not exist there, and Windows hostname.exe rejects -s. Every gh-less Windows machine therefore collapsed onto the SAME degenerate identity, silently forking its room UUID derivation away from the account identity. The fallback chain now consults COMPUTERNAME/USERNAME and falls through to bare `hostname`, rejects empty/whitespace probe output, and is injectable for hermetic tests. Deliberately NOT changed: the keep-provisional-cache-on-gh-outage retention in resolve_with — churning a cached identity would re-derive rooms out from under live subscriptions; delivery for already-diverged machines is healed by the channel-name reconvergence commit on this branch. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): channel-NAME reconvergence — a diverged room UUID no longer makes a bound room blind The M5<->bigmama fix, both directions. Channel UUIDs derive from (mesh_identity, name); when one machine's identity resolution forks (gh unreachable -> local:<host>:<user> fallback), its #general derives a DIFFERENT UUID than its peers', and every room frame between them dies as undeliverable{unknown_channel} while the room is bound and readable on both sides. Live receipts: bigmama (identity forked to local:unknown-host:unknown-user) sent #general frames to eef18336-...; M5 binds 5eedf7b1-... under the gh login — 24 frames durably stored, never surfaced, and the reverse direction refused symmetrically. The heal, extending the existing seams: - Senders stamp the human channel name on every room send (HEADER_AIRC_CHANNEL_NAME, stamped in send_frame_to_room + daemon_send_text/daemon_send_frame/daemon_publish via Room::stamp_name_header) — the cross-machine convergence key. It rides envelope headers, so the routed forwarder and multi-hop re-forwards carry it for free. - RouterInboundBridge::deliver resolves the local binding BEFORE publish; when the addressed UUID binds no scope but the frame's name header derives — under THIS machine's identity — to a channel that is bound (directly, or after the existing account-registry rebind heal), the frame is published under the LOCAL channel and the verdict is the new DeliveredRemapped(local). A bound channel is never re-routed: the name is a heal hint from an authenticated enrolled peer, not addressing authority. - Transport ack + handle fan-out follow the remapped channel (DeliveryOutcome::Delivered carries the receiver's local room), and the heal is LOUD: DiagnosticCode::ChannelNameReconverged names the addressed UUID, local UUID, room name, and sender so the operator sees the sending machine's identity is split. Regression tests (daemon_lan_visibility): the literal field fingerprint (eef18336 = derive("local:unknown-host:unknown-user","general")) reconverging into the bound room at bridge level with all three controls (no header / unbound name / bound-channel-never-rerouted), and the full field scenario end-to-end over a real TLS LAN link — a remote pinned to the degenerate identity joins #general, dials in, sends with delivery ack, the ack says Delivered carrying the receiver's local room, and the operator scope reads the message. Identity pinning is hermetic via mesh_identity Operator-source entries (Airc::coordinator_store_for_test, same pattern as the existing _for_test seams). Both machines must run this build for both directions to heal: the sender stamps, the receiver reconverges. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(clippy): drop redundant closure on the endpoints stamp (unblock #1288 merge gate) `cargo clippy -D warnings` (a merge gate) flagged `redundant_closure` at account_registry.rs:577 — `.then(|| crate::time::now_ms())` wraps a fn that can be passed directly. Pass `crate::time::now_ms` to `.then`. Semantically identical (the `.transpose()?` still sees the Result); clears the only red check on #1288. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(identity): stable machine-id fallback — never emit the colliding unknown-host sentinel (#6) Root cause of the M5<->bigmama blind-room bug: when every host/user probe failed (a bare daemon process with no HOSTNAME/USER/COMPUTERNAME/USERNAME and a rejected `hostname`), local_fallback_identity() silently produced `local:unknown-host:unknown-user` — the SAME degenerate identity on every such machine. Two machines then derived divergent `#general` UUIDs and every frame between them died as `unknown_channel`. Fix: introduce a persisted, machine-wide `machine_id()` (`~/.airc/machine-id`, one UUID per machine shared across scopes) and, on any probe failure, anchor the degraded identity to it (`local:machine-<id>:...`) instead of the colliding sentinel — so probe-blind machines stay DISTINCT — and shout loudly (never silent) that identity degraded and will self-heal to gh. Same primitive is the intended canonical key for the account-registry gist name (#5: one gist per machine regardless of hostname resolution). Tests: new `local_fallback_uses_machine_id_when_all_probes_fail` (asserts no sentinel + distinct-per-machine); existing Windows-fallback tests updated for the injected machine-id. 16/16 mesh_identity tests green on windows-msvc. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(registry): prune stale beacons at the GH publish path (#4) `airc network` kept reporting ~46 stale beacons because they were dropped from the live reader-merge and the FS store but NEVER from the persisted GitHub gist: the GH `publish()` serialized `document.peers` verbatim, so a machine's own gist accumulated dead beacons forever (past sessions, dead containers). Fix: apply the ONE canonical `prune_stale_peers` (the same primitive the reader-merge and FS store already use, `DEFAULT_PEER_FRESHNESS_TTL_MS`) at the missing write site, before serialization — clone because the trait hands us `&document`. Emits the existing AccountRegistryStaleBeaconsPruned diagnostic when it drops any. Now a republish self-cleans the gist instead of growing it. 27/27 account_registry tests green on windows-msvc. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * feat(self-heal): auto-reconnect after restart — boot dials stored live peers NOW, and a machine-vs-scope identity mismatch retries once pinned to the presented enrolled identity Item 1 of the restart-reconnect heal (live two-machine evidence: every daemon restart drops the transport sessions and reconnection never converged unaided — a manual `airc dial` fixed it every time). Two seams, no parallel dialers: - FIRST_REFRESH_DELAY 5s → ZERO. run_daemon spawns the route-refresh loop only after identity/trust/router are built, so there is nothing to "settle": the first stored-peer dial pass runs at boot instead of waiting out a tick. The pass already honors ghost-freshness and the dial-quarantine gates (eviction/backoff respected), so an immediate tick cannot stampede dead endpoints. - Identity-mismatch retry in the ONE pinned dial path (dial_one_peer): when a scope-pinned dial fails with the verifier's loud "server cert is for peer X, expected Y" naming a DIFFERENT identity, and X is ENROLLED, retry exactly once pinned to X — the same recovery a human performs with the error in hand. Strictness unchanged: an unenrolled presented identity is never retried, never accepted. The error format and its parser live side by side in the verifier (peer_identity_mismatch_error / presented_peer_from_mismatch_error) so they cannot drift. Tests: - route_refresh: boot_schedules_the_first_refresh_immediately (the restart-shaped regression), first_refresh_is_immediate_then_steady_interval, shutdown test updated for the boot-immediate tick. - verifier: mismatch_error_round_trips_presented_peer_through_the_parser, wrong_peer_rejection_is_parseable_by_the_mismatch_parser. - stored_endpoint_dial: identity_mismatch_dial_retries_once_pinning_the_presented_enrolled_identity, identity_mismatch_never_retries_an_unenrolled_identity. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): receive-binding re-derive on identity heal — a healed mesh identity re-binds stale subscriptions to their converged rooms Item 2 of the restart-reconnect heal (live sequel to d79843c): after the Windows identity healed, sends derived CONVERGED channel UUIDs but the scope's stored subscriptions kept the OLD diverged UUIDs — the per-frame name reconvergence heals delivery TO a bound room, but a room bound under a stale UUID must be REBOUND, or the scope keeps reading (and attaching to) the dead room. Live evidence: only a manual `airc stop && airc join` un-wedged it. The heal: a subscription's channel NAME is its durable identity; the room UUID is a derivation frozen at join time. SubscriptionSet:: rebind_diverged re-derives every subscription under the current mesh identity and re-binds any that diverged (name/wire/joined_at preserved, one loud old→new warning per move). Wired into the two join-shaped touchpoints — Airc::join and Airc::ensure_join_context (bare `airc join`, init re-runs, daemon-bounce recovery, monitor resume) — right after mesh_identity() resolves, so the very next join after a heal converges with zero manual steps. save + publish_presence on the same paths persist the rebind and re-beacon the channel names under the healed identity. Read cursors need no migration: runtime cursors are keyed per consumer id over the owner-core's GLOBAL (epoch, counter) order, not per room UUID. Tests: - subscriptions: rebind_diverged_moves_room_ids_to_the_current_identity_derivation (pure rule: re-derive, preserve, report, idempotent). - daemon_lan_visibility: healed_identity_rebinds_stale_subscription_to_the_converged_room (end-to-end: diverged join → heal → rebind at join → a frame addressed to the converged UUID delivers AND the scope reads it; the old diverged UUID keeps delivering via the existing name-reconvergence remap). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(registry): key the registry gist on the stable machine-id, not hostname (#5 part 1/2) writer_key() was `<host>-<user>`, which STILL fragmented: `hostname` resolves three ways on one Mac (joels-macbook-pro-local / joels-mbp-lan / macbookpro-lan), minting THREE registry gists for a single machine (Joel's "47" was largely this). Re-key to the canonical, persisted machine_id (`~/.airc/machine-id`, one value per box shared across scopes, from #6) — stable regardless of hostname resolution, so a box maps to exactly ONE registry gist even when its sentinel / events.sqlite is wiped. Human-readable host/platform stays in the beacon content, not the filename. Removed the now-dead host-resolution helpers (first_nonempty_env / hostname_from_command / sanitize_writer_component) and their test rather than leave dead code. Part 2/2 (follow-up commit): teach the opt-in `airc registry gc` to reap gists whose beacons are ALL stale, so the orphaned old `<host>-<user>` gists (which stop receiving fresh beacons once a box adopts this key) get cleaned instead of lingering. Reader-merge already ignores their stale beacons, so routing is correct in the meantime. 26/26 account_registry tests green on windows-msvc. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(registry): reap superseded/dead all-stale gists in the opt-in gc (#5 part 2/2) Completes #5: with writer_key now on the stable machine-id (part 1), a box's old `<host>-<user>` gists stop receiving fresh beacons and linger. Teach `airc registry gc` to reap them. The pure filename classifier stays untouched (still unit-testable); the freshness dimension lives in the `gc()` I/O method: for each Kept, real machine-keyed gist (never our own, never junk) it fetches the body and downgrades Keep->Delete when `has_only_stale_beacons` — the doc carries beacons and EVERY one is past DEFAULT_PEER_FRESHNESS_TTL_MS. Conservative: an EMPTY document is NOT reapable (a just-created gist mid-first-write — never delete on ambiguity), and an unreadable body leaves the gist Kept (never delete on a blind fetch). Reaping is safe because the owner recreates a fresh gist on return via the sentinel; gc is opt-in and dry-run by default, so the operator reviews the plan first. New `has_only_stale_beacons_reaps_all_stale_but_never_fresh_or_empty` test (fresh-keeps / all-stale-reaps / empty-keeps). Validated in a Linux container (gh_stub is unix-gated): 40/40 account_registry tests green; windows-msvc clippy + non-gated tests green. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * feat(self-heal): machine-vs-scope cert identity — beacons carry the transport host, dialers pin it first time, whois joins the machine↔scope card Item 3 of the restart-reconnect heal (live evidence: endpoints answer TLS with the MACHINE identity e85a… while scopes send as SCOPE peers ce8b…; every scope-pinned dial died in a loud mismatch until a human redialed by machine id). The model — one mapping, carried end to end with the endpoints it describes (never a parallel table): - AccountPeerBeacon.endpoints_peer_id (serde-default, skip-if-none — old documents decode, old readers see unchanged wire): the TLS cert identity that answers at the beacon's endpoints. DISTINCT from the mesh-identity machine-id (a registry rendezvous key string) — this is the daemon keypair identity, joinable with it in whois. - Publisher: `registry sync` from a daemon-attached scope reads the daemon's endpoints back over IPC — it now also resolves the daemon's peer id (Status) and stamps it via Airc::set_advertised_endpoints_host, so the published self-beacon names WHO answers there. Handles that own their listener publish no mapping (endpoints answer as themselves). - Merge: the endpoint-carrier backfill carries the CARRIER's mapping with its endpoints, exactly like the freshness stamp. - Import: persisted on the trust record (new nullable peer_trust column endpoints_peer_id, migration m20260723_000020) atomically WITH the endpoint set under the same monotonic stamp; self-mappings are normalized away. - Dial: resolve_dial_pin (pure) — pin the declared host ONLY when it is a different peer AND itself enrolled; unenrolled/self/absent mappings pin the record's own peer. Strictness unchanged: an unknown identity is never dialed-for, never accepted — a poisoned mapping can at worst redirect the pin to another already-trusted peer. A record hosted by an already-connected machine is skipped (route is up, no re-dial churn); item 1's one-shot mismatch retry remains the fallback for records that predate the mapping. - Surfaces: `airc whois <peer>` shows the machine line (transport host) and, for a machine, the scope peers it hosts — one card; `airc peer list` adds host= (human) and endpoints_peer_id (JSON). Tests: - store: mapping written/refused/preserved atomically with endpoints (extended replace/rotation + monotonic-stamp tests). - account_registry: merge_backfill_carries_the_carriers_endpoints_host_mapping (backfill + serde default/skip round-trip), import_stores_the_endpoints_host_mapping_normalized. - discovery: dial_pin_honors_only_an_enrolled_foreign_host_mapping (strictness matrix). - stored_endpoint_dial: stored_host_mapping_pins_the_machine_identity_and_connects (first-dial pin + steady-state no-churn); the unenrolled-identity loud-failure test from item 1 pins the never-accept-unknown gate. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * style: cargo fmt the self-healing batch (unblock #1288 fmt gate) `cargo fmt --check` was the one red check on #1288 — my registry changes went through `cargo test` + `clippy` but not `cargo fmt`, so rustfmt's line-wrapping of has_only_stale_beacons (gh/account_registry.rs) failed the gate. No logic change; formatting only. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * feat(hooks): pre-push cargo fmt + clippy gate — catch CI-gate failures locally (cab380c0) Recurring cost: pushing airc Rust changes without `cargo fmt` (or with clippy warnings) fails the `cargo fmt --check` / `cargo clippy -D warnings` CI gates — each a multi-minute round-trip plus a manual fixup commit (bit both #1288 and #1289 in one session). This runs both LOCALLY at pre-push so the failure surfaces in seconds, before the push leaves the machine. - New worker `integrations/git-hooks/airc-cargo-gate.sh`: phase-aware (no-op except on pre-push — fmt+clippy on every commit is too slow), fail-open on a toolchain gap (no cargo / not the workspace → exit 0, never block), fail-closed on real fmt/clippy violations. Shares the one CARGO_TARGET_DIR so clippy reuses incremental artifacts. Escape hatches: AIRC_HOOK_SKIP / AIRC_CARGO_GATE_SKIP / AIRC_CARGO_GATE_CLIPPY=0. - `_install_airc_git_hooks` wires it into the generated pre-commit/pre-push hooks alongside the existing fetch-staleness worker (the worker self-gates to push). Completes the flywheel front-end: pre-push gate → CI → the board's merger daemon auto-merges green Review cards. Validated: no-op on pre-commit, honors the skip, fmt gate clean on canary. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc --------- Co-authored-by: Claude Fable 5 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jul 24, 2026
…-on-failure, dial verb, unknown_channel auto-rebind (#1288) * feat(self-heal): atomic stamped endpoint replace — a fresher advertisement fully replaces, a staler one is refused M5↔bigmama live repro #2: a registry re-sync took a peer's new IP but kept its stale port, dialing a dead endpoint forever. Root cause: the stored endpoint set had no freshness, so nothing could order an old advertisement against a new one, and merge-backfilled stale endpoints could ride a fresh presence into the store. - peer_trust gains endpoints_advertised_at_ms (additive nullable migration; NULL floors to 0 so any stamped ad outranks legacy rows). - set_peer_trust_endpoints now writes endpoints + stamp atomically and replaces monotonically: staler stamp = whole write refused. - AccountPeerBeacon carries endpoints_advertised_at_ms (serde-default, old documents keep decoding); publishers stamp at generation; the reader-side merge backfill keeps the CARRIER's stamp so stale endpoints never masquerade as fresh; import clamps the peer-asserted stamp to now (same doctrine as the last_seen security clamp). Tests: - sqlite: fresher_advertisement_atomically_replaces_endpoints_and_staler_is_refused - sqlite: replace_peer_trust_preserves_stored_endpoints now pins the stamp too - account_registry: import_fresher_advertisement_fully_replaces_endpoint_and_stale_is_refused (the exact (ip1,port1)->(ip2,port2) regression + stale replay + fresh-presence/stale-endpoints composite) - account_registry: merge_retains_endpoints_when_fresher_beacon_is_endpointless now pins carrier-stamp backfill Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): refresh-on-failure — a failed dial re-reads the rendezvous before any blind retry M5↔bigmama live repro #1: after a daemon restart, the remote peer kept dialing the dead port (.249:58842 vs live .249:57958) forever, never re-reading the rendezvous. - Airc::heal_failed_dials(store, failures): record the failed peers' stored endpoint sets, do ONE rendezvous re-read + import (atomic + monotonic per the item-1 stamp, so it can never make things worse), and re-dial ONLY when a failed peer's endpoints actually changed — through the one pinned dial path (cost order, quarantine skips, stop on first success). No fresher endpoint = no extra dial pass: the dial-quarantine backoff (15s→120s) keeps owning the dead endpoint's retry cadence, so this is bounded by construction. - Daemon wiring: the registry task shares its ONE resolved rendezvous (store + gate) via an Arc<OnceLock> slot; refresh_routes_once heals after emitting dial-failure diagnostics, honoring the same gh/hermetic gate as registry ticks, and the healed snapshot feeds the connected count + relay self-election. - New Arc<dyn AccountRegistryStore> delegating impl (mirrors Box) so one resolved door serves both loops without a second resolution. Test: stored_endpoint_dial::heal_failed_dials_rereads_rendezvous_and_dials_fresh_endpoint (stub AccountRegistryStore rendezvous — unchanged rendezvous heals nothing; fresh advertisement is imported, replaces the corpse, and the live endpoint is dialed immediately). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): publish-on-bind — a freshly bound listener propagates to the rendezvous immediately M5↔bigmama live repro #1 (the propagation half): a daemon restart that lands on a new port only advertised it at the refresh loop's first cadence tick, leaving every peer dialing the dead port meanwhile. - Registry task nudges endpoint_resync the moment listen_lan_advertising binds; Notify stores the permit, so the refresh loop's biased select publishes IMMEDIATELY on start instead of waiting out first_tick. Idempotent: an unchanged advertisement republishes the same document. - Relay self-election (become_relay binds a listener too) now nudges the same resync so the new relay endpoint propagates without waiting up to a full 120s cadence. - (IP-move rebinds were already edge-triggered via refresh_advertised_endpoints Ok(true) — this closes the two bind sites that were not.) Test: registry_refresh::pre_loop_resync_permit_publishes_immediately_not_at_first_tick (first_tick/cadence at 3600s — only the stored permit can publish in time; pins the Notify-permit-before-loop-start contract). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): advertise hygiene — never-correct addresses and known-peer collisions are refused (and withdrawn) M5↔bigmama live repro decay modes #3 and #4: Docker containers advertised internal bridge IPs (172.x) as reachable endpoints — dozens of 3s dial timeouts per refresh across every peer — and one peer record carried the reader's OWN Tailscale IP as another machine's endpoint. - ONE hygiene predicate pair in airc-lib (lan_advertise_rejection / tailscale_advertise_rejection): loopback, unspecified, link-local 169.254/16, the 172.16/12 docker/bridge band, and CGNAT-on-the-LAN- rung are never advertised; the Tailscale rung only carries 100.64/10. RFC1918 10/8 + 192.168/16 (en0-style) and public addresses pass. The 172.16/12 refusal is by RANGE (the UDP source-address detection has no ifname) — per the live evidence that band is never correct on this mesh, and such a host still advertises its Tailscale rung. - Known-peer collision guard: an endpoint equal to a KNOWN other peer's stored endpoint is refused loudly — advertising it would extend the corrupted-record chain onto the rendezvous. - Applied at BOTH advertise seams (listen_lan_advertising and the per-tick refresh_advertised_endpoints): a rejected IP reads as None, so an already-poisoned advertised rung is WITHDRAWN on the next tick (self-heal), edge-triggering a corrected registry publish. - CLI detection (detect_lan_ip / is_tailscale_ipv4) now delegates to the same one predicate — detection and advertisement can't drift. Tests (lan.rs): advertise_hygiene_rejects_never_correct_classes_and_admits_real_lans, refresh_withdraws_a_poisoned_advertised_bridge_ip, refresh_refuses_to_advertise_a_known_peers_address. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): failure-counted eviction — 5 consecutive dial failures mark an endpoint DEAD until a fresher advertisement M5↔bigmama live repro decay mode #4 (the reader side): dozens of stored 172.x ghost endpoints burned a 3s timeout each on every discovery refresh, forever — timed backoff alone caps at 120s and never gives up. - DialQuarantine entries now carry a consecutive-failure streak and the endpoint-set freshness stamp the failures accrued under. New DialGate verdict: Dial / Backoff{remaining_ms} / Dead{count}. DEAD_AFTER_CONSECUTIVE_FAILURES = 5 (spans several backoff windows, so a flapping endpoint recovers long before eviction). - Dead = evicted from the dial set (record kept, endpoint skipped even after every backoff window elapses). Revival: a STRICTLY fresher advertisement stamp (item 1's endpoints_advertised_at_ms, plumbed per-peer through dial_stored_peer_endpoints) lifts the eviction for ONE probe; a failure under the fresher stamp re-kills immediately — so a live-but-unreachable publisher costs at most one 3s dial per fresh advertisement, and a genuinely revived daemon (same stable port, fresh ad) reconnects on the first probe. The retention sweep (10min idle) stays the bounded second-chance horizon. - Dead skips surface distinctly: PeerDialSkip.dead=true, and 'airc transport health' prints 'endpoint dead: … evicted after 5 consecutive failed dials; revived only by a fresher advertisement' instead of a misleading countdown. Test: dial_quarantine::fifth_consecutive_failure_is_dead_until_a_fresher_advertisement (dead after backoff expiry, not-dead below threshold, fresher-stamp one-probe revival + immediate re-kill, success wipes the streak). Also: peer_dials_lan_rung_and_skips_tailscale updated — the advertise hygiene now rightly refuses loopback as a LAN advertisement, so the dial-ladder test builds its imported endpoint set directly. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): airc dial <host:port> — manual authenticated recovery dial The hands-on override for a wedged mesh (M5↔bigmama live repro): one authenticated dial both proves reachability AND teaches the REMOTE our real source address via learn-live-address (#9), un-wedging its next outbound dial when its stored endpoint for us is stale. - New verb: airc dial HOST:PORT [--expected-peer <uuid>] [--timeout-ms N] (default 10s — a recovery verb watched by an operator, generous next to discovery's 3s sweep budget). Full mTLS-pinned handshake via the one existing connect_lan path; success stamps last_seen on the trust record (an authenticated dial IS fresh contact); success and failure both print LOUDLY with next-step hints; nonzero exit on failure. - --expected-peer is inferred when omitted: stored-endpoint exact match first, else the identity-derived stable port (#8, airc_lib::stable_lan_port, now pub for exactly this). Zero or several candidates is a loud error naming them — never a guess. - Flag named --expected-peer (not --peer) because --peer is the global volatile-peer-spec flag; same convention as lan-send. Test: cli::dial_verb_parses_endpoint_and_optional_peer (parse contract). Smoke-verified live: two temp homes, lan-listen + dial → 'CONNECTED: authenticated handshake … succeeded'; dead endpoint + un-enrolled peer both fail loudly with exit 1. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): unknown_channel auto-rebind — a registry-known channel is re-bound, never silently store-and-dropped M5↔bigmama live repro decay mode #5 (the blind room): a frame from a connected peer landed durably in the store but no scope bound its channel (#general → unknown_channel) — stored, never surfaced. Investigation (root cause): scope↔channel binding = presence beacons in the machine coordinator store; join/part/current_room already republish the scope's FULL subscription set (publish_presence uses the whole SubscriptionSet), so a joining scope does re-bind all its known rooms. What a restart/wipe loses is the MACHINE-side beacon table (drained stale rows, moved wire root, identity drift) — and nothing consulted the account registry's known-channel list to recover. The fix, at the one inbound seam (RouterInboundBridge): - (a) the loud diagnostic with channel + peer already exists at the transport layer (FrameUndeliverable, persisted=true) — unchanged. - (b) on an unbound channel, the bridge now consults the machine's LOCAL account-registry cache (SqliteAccountRegistryStore over the same events.sqlite, injected via with_account_registry): if the account KNOWS the channel (document channel union or any beacon's subscriptions derive to the frame's RoomId), the registry's subscribing beacons are republished into the coordinator store — restoring the durable binding — and the verdict is re-checked before claiming Delivered. New warn diagnostic UnknownChannelRebound (channel id + name + rebound beacon count). Channels the account does not know keep the honest unknown_channel verdict. Test: daemon_lan_visibility::unknown_channel_auto_rebinds_from_account_registry_cache (unknown stays unknown; known channel re-binds + delivers + is loud exactly once; the binding persists — no per-frame patching). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(identity): Windows-portable local fallback — never the degenerate local:unknown-host:unknown-user Root cause of the M5<->bigmama blind room, receiver-side log: 24 unknown_channel frames all on channel eef18336-1424-5231-bcf9-5b6f8e04deb6, which is exactly derive_room_id("local:unknown-host:unknown-user", "general"). On Windows every probe in local_fallback_identity() failed silently: HOSTNAME and USER/LOGNAME env vars do not exist there, and Windows hostname.exe rejects -s. Every gh-less Windows machine therefore collapsed onto the SAME degenerate identity, silently forking its room UUID derivation away from the account identity. The fallback chain now consults COMPUTERNAME/USERNAME and falls through to bare `hostname`, rejects empty/whitespace probe output, and is injectable for hermetic tests. Deliberately NOT changed: the keep-provisional-cache-on-gh-outage retention in resolve_with — churning a cached identity would re-derive rooms out from under live subscriptions; delivery for already-diverged machines is healed by the channel-name reconvergence commit on this branch. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): channel-NAME reconvergence — a diverged room UUID no longer makes a bound room blind The M5<->bigmama fix, both directions. Channel UUIDs derive from (mesh_identity, name); when one machine's identity resolution forks (gh unreachable -> local:<host>:<user> fallback), its #general derives a DIFFERENT UUID than its peers', and every room frame between them dies as undeliverable{unknown_channel} while the room is bound and readable on both sides. Live receipts: bigmama (identity forked to local:unknown-host:unknown-user) sent #general frames to eef18336-...; M5 binds 5eedf7b1-... under the gh login — 24 frames durably stored, never surfaced, and the reverse direction refused symmetrically. The heal, extending the existing seams: - Senders stamp the human channel name on every room send (HEADER_AIRC_CHANNEL_NAME, stamped in send_frame_to_room + daemon_send_text/daemon_send_frame/daemon_publish via Room::stamp_name_header) — the cross-machine convergence key. It rides envelope headers, so the routed forwarder and multi-hop re-forwards carry it for free. - RouterInboundBridge::deliver resolves the local binding BEFORE publish; when the addressed UUID binds no scope but the frame's name header derives — under THIS machine's identity — to a channel that is bound (directly, or after the existing account-registry rebind heal), the frame is published under the LOCAL channel and the verdict is the new DeliveredRemapped(local). A bound channel is never re-routed: the name is a heal hint from an authenticated enrolled peer, not addressing authority. - Transport ack + handle fan-out follow the remapped channel (DeliveryOutcome::Delivered carries the receiver's local room), and the heal is LOUD: DiagnosticCode::ChannelNameReconverged names the addressed UUID, local UUID, room name, and sender so the operator sees the sending machine's identity is split. Regression tests (daemon_lan_visibility): the literal field fingerprint (eef18336 = derive("local:unknown-host:unknown-user","general")) reconverging into the bound room at bridge level with all three controls (no header / unbound name / bound-channel-never-rerouted), and the full field scenario end-to-end over a real TLS LAN link — a remote pinned to the degenerate identity joins #general, dials in, sends with delivery ack, the ack says Delivered carrying the receiver's local room, and the operator scope reads the message. Identity pinning is hermetic via mesh_identity Operator-source entries (Airc::coordinator_store_for_test, same pattern as the existing _for_test seams). Both machines must run this build for both directions to heal: the sender stamps, the receiver reconverges. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(clippy): drop redundant closure on the endpoints stamp (unblock #1288 merge gate) `cargo clippy -D warnings` (a merge gate) flagged `redundant_closure` at account_registry.rs:577 — `.then(|| crate::time::now_ms())` wraps a fn that can be passed directly. Pass `crate::time::now_ms` to `.then`. Semantically identical (the `.transpose()?` still sees the Result); clears the only red check on #1288. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(identity): stable machine-id fallback — never emit the colliding unknown-host sentinel (#6) Root cause of the M5<->bigmama blind-room bug: when every host/user probe failed (a bare daemon process with no HOSTNAME/USER/COMPUTERNAME/USERNAME and a rejected `hostname`), local_fallback_identity() silently produced `local:unknown-host:unknown-user` — the SAME degenerate identity on every such machine. Two machines then derived divergent `#general` UUIDs and every frame between them died as `unknown_channel`. Fix: introduce a persisted, machine-wide `machine_id()` (`~/.airc/machine-id`, one UUID per machine shared across scopes) and, on any probe failure, anchor the degraded identity to it (`local:machine-<id>:...`) instead of the colliding sentinel — so probe-blind machines stay DISTINCT — and shout loudly (never silent) that identity degraded and will self-heal to gh. Same primitive is the intended canonical key for the account-registry gist name (#5: one gist per machine regardless of hostname resolution). Tests: new `local_fallback_uses_machine_id_when_all_probes_fail` (asserts no sentinel + distinct-per-machine); existing Windows-fallback tests updated for the injected machine-id. 16/16 mesh_identity tests green on windows-msvc. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(registry): prune stale beacons at the GH publish path (#4) `airc network` kept reporting ~46 stale beacons because they were dropped from the live reader-merge and the FS store but NEVER from the persisted GitHub gist: the GH `publish()` serialized `document.peers` verbatim, so a machine's own gist accumulated dead beacons forever (past sessions, dead containers). Fix: apply the ONE canonical `prune_stale_peers` (the same primitive the reader-merge and FS store already use, `DEFAULT_PEER_FRESHNESS_TTL_MS`) at the missing write site, before serialization — clone because the trait hands us `&document`. Emits the existing AccountRegistryStaleBeaconsPruned diagnostic when it drops any. Now a republish self-cleans the gist instead of growing it. 27/27 account_registry tests green on windows-msvc. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * feat(self-heal): auto-reconnect after restart — boot dials stored live peers NOW, and a machine-vs-scope identity mismatch retries once pinned to the presented enrolled identity Item 1 of the restart-reconnect heal (live two-machine evidence: every daemon restart drops the transport sessions and reconnection never converged unaided — a manual `airc dial` fixed it every time). Two seams, no parallel dialers: - FIRST_REFRESH_DELAY 5s → ZERO. run_daemon spawns the route-refresh loop only after identity/trust/router are built, so there is nothing to "settle": the first stored-peer dial pass runs at boot instead of waiting out a tick. The pass already honors ghost-freshness and the dial-quarantine gates (eviction/backoff respected), so an immediate tick cannot stampede dead endpoints. - Identity-mismatch retry in the ONE pinned dial path (dial_one_peer): when a scope-pinned dial fails with the verifier's loud "server cert is for peer X, expected Y" naming a DIFFERENT identity, and X is ENROLLED, retry exactly once pinned to X — the same recovery a human performs with the error in hand. Strictness unchanged: an unenrolled presented identity is never retried, never accepted. The error format and its parser live side by side in the verifier (peer_identity_mismatch_error / presented_peer_from_mismatch_error) so they cannot drift. Tests: - route_refresh: boot_schedules_the_first_refresh_immediately (the restart-shaped regression), first_refresh_is_immediate_then_steady_interval, shutdown test updated for the boot-immediate tick. - verifier: mismatch_error_round_trips_presented_peer_through_the_parser, wrong_peer_rejection_is_parseable_by_the_mismatch_parser. - stored_endpoint_dial: identity_mismatch_dial_retries_once_pinning_the_presented_enrolled_identity, identity_mismatch_never_retries_an_unenrolled_identity. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(self-heal): receive-binding re-derive on identity heal — a healed mesh identity re-binds stale subscriptions to their converged rooms Item 2 of the restart-reconnect heal (live sequel to d79843c): after the Windows identity healed, sends derived CONVERGED channel UUIDs but the scope's stored subscriptions kept the OLD diverged UUIDs — the per-frame name reconvergence heals delivery TO a bound room, but a room bound under a stale UUID must be REBOUND, or the scope keeps reading (and attaching to) the dead room. Live evidence: only a manual `airc stop && airc join` un-wedged it. The heal: a subscription's channel NAME is its durable identity; the room UUID is a derivation frozen at join time. SubscriptionSet:: rebind_diverged re-derives every subscription under the current mesh identity and re-binds any that diverged (name/wire/joined_at preserved, one loud old→new warning per move). Wired into the two join-shaped touchpoints — Airc::join and Airc::ensure_join_context (bare `airc join`, init re-runs, daemon-bounce recovery, monitor resume) — right after mesh_identity() resolves, so the very next join after a heal converges with zero manual steps. save + publish_presence on the same paths persist the rebind and re-beacon the channel names under the healed identity. Read cursors need no migration: runtime cursors are keyed per consumer id over the owner-core's GLOBAL (epoch, counter) order, not per room UUID. Tests: - subscriptions: rebind_diverged_moves_room_ids_to_the_current_identity_derivation (pure rule: re-derive, preserve, report, idempotent). - daemon_lan_visibility: healed_identity_rebinds_stale_subscription_to_the_converged_room (end-to-end: diverged join → heal → rebind at join → a frame addressed to the converged UUID delivers AND the scope reads it; the old diverged UUID keeps delivering via the existing name-reconvergence remap). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(registry): key the registry gist on the stable machine-id, not hostname (#5 part 1/2) writer_key() was `<host>-<user>`, which STILL fragmented: `hostname` resolves three ways on one Mac (joels-macbook-pro-local / joels-mbp-lan / macbookpro-lan), minting THREE registry gists for a single machine (Joel's "47" was largely this). Re-key to the canonical, persisted machine_id (`~/.airc/machine-id`, one value per box shared across scopes, from #6) — stable regardless of hostname resolution, so a box maps to exactly ONE registry gist even when its sentinel / events.sqlite is wiped. Human-readable host/platform stays in the beacon content, not the filename. Removed the now-dead host-resolution helpers (first_nonempty_env / hostname_from_command / sanitize_writer_component) and their test rather than leave dead code. Part 2/2 (follow-up commit): teach the opt-in `airc registry gc` to reap gists whose beacons are ALL stale, so the orphaned old `<host>-<user>` gists (which stop receiving fresh beacons once a box adopts this key) get cleaned instead of lingering. Reader-merge already ignores their stale beacons, so routing is correct in the meantime. 26/26 account_registry tests green on windows-msvc. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(registry): reap superseded/dead all-stale gists in the opt-in gc (#5 part 2/2) Completes #5: with writer_key now on the stable machine-id (part 1), a box's old `<host>-<user>` gists stop receiving fresh beacons and linger. Teach `airc registry gc` to reap them. The pure filename classifier stays untouched (still unit-testable); the freshness dimension lives in the `gc()` I/O method: for each Kept, real machine-keyed gist (never our own, never junk) it fetches the body and downgrades Keep->Delete when `has_only_stale_beacons` — the doc carries beacons and EVERY one is past DEFAULT_PEER_FRESHNESS_TTL_MS. Conservative: an EMPTY document is NOT reapable (a just-created gist mid-first-write — never delete on ambiguity), and an unreadable body leaves the gist Kept (never delete on a blind fetch). Reaping is safe because the owner recreates a fresh gist on return via the sentinel; gc is opt-in and dry-run by default, so the operator reviews the plan first. New `has_only_stale_beacons_reaps_all_stale_but_never_fresh_or_empty` test (fresh-keeps / all-stale-reaps / empty-keeps). Validated in a Linux container (gh_stub is unix-gated): 40/40 account_registry tests green; windows-msvc clippy + non-gated tests green. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * feat(self-heal): machine-vs-scope cert identity — beacons carry the transport host, dialers pin it first time, whois joins the machine↔scope card Item 3 of the restart-reconnect heal (live evidence: endpoints answer TLS with the MACHINE identity e85a… while scopes send as SCOPE peers ce8b…; every scope-pinned dial died in a loud mismatch until a human redialed by machine id). The model — one mapping, carried end to end with the endpoints it describes (never a parallel table): - AccountPeerBeacon.endpoints_peer_id (serde-default, skip-if-none — old documents decode, old readers see unchanged wire): the TLS cert identity that answers at the beacon's endpoints. DISTINCT from the mesh-identity machine-id (a registry rendezvous key string) — this is the daemon keypair identity, joinable with it in whois. - Publisher: `registry sync` from a daemon-attached scope reads the daemon's endpoints back over IPC — it now also resolves the daemon's peer id (Status) and stamps it via Airc::set_advertised_endpoints_host, so the published self-beacon names WHO answers there. Handles that own their listener publish no mapping (endpoints answer as themselves). - Merge: the endpoint-carrier backfill carries the CARRIER's mapping with its endpoints, exactly like the freshness stamp. - Import: persisted on the trust record (new nullable peer_trust column endpoints_peer_id, migration m20260723_000020) atomically WITH the endpoint set under the same monotonic stamp; self-mappings are normalized away. - Dial: resolve_dial_pin (pure) — pin the declared host ONLY when it is a different peer AND itself enrolled; unenrolled/self/absent mappings pin the record's own peer. Strictness unchanged: an unknown identity is never dialed-for, never accepted — a poisoned mapping can at worst redirect the pin to another already-trusted peer. A record hosted by an already-connected machine is skipped (route is up, no re-dial churn); item 1's one-shot mismatch retry remains the fallback for records that predate the mapping. - Surfaces: `airc whois <peer>` shows the machine line (transport host) and, for a machine, the scope peers it hosts — one card; `airc peer list` adds host= (human) and endpoints_peer_id (JSON). Tests: - store: mapping written/refused/preserved atomically with endpoints (extended replace/rotation + monotonic-stamp tests). - account_registry: merge_backfill_carries_the_carriers_endpoints_host_mapping (backfill + serde default/skip round-trip), import_stores_the_endpoints_host_mapping_normalized. - discovery: dial_pin_honors_only_an_enrolled_foreign_host_mapping (strictness matrix). - stored_endpoint_dial: stored_host_mapping_pins_the_machine_identity_and_connects (first-dial pin + steady-state no-churn); the unenrolled-identity loud-failure test from item 1 pins the never-accept-unknown gate. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * style: cargo fmt the self-healing batch (unblock #1288 fmt gate) `cargo fmt --check` was the one red check on #1288 — my registry changes went through `cargo test` + `clippy` but not `cargo fmt`, so rustfmt's line-wrapping of has_only_stale_beacons (gh/account_registry.rs) failed the gate. No logic change; formatting only. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc --------- Co-authored-by: Claude Fable 5 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 4, 2026
…th ZERO gh requests
airc had no LAN-local discovery at all: no mDNS, no multicast, no broadcast.
Two peers on the same /24 could only find each other through the GitHub
rendezvous (budget-capped, beacons stale in minutes) or cached endpoints
(invalidated by churn). Measured live 2026-09-04: a peer's Mac was on this
LAN, daemon LISTENING, while this node reported "0 routes, 96 enrolled" — a
human closed the gap with arp + a hand-derived port + airc dial.
This is also what made gh a single point of failure and a spam risk at once:
LAN convergence rode the same request budget as SOS and registry sync. Per
Joel's governor directive: the mesh must ride nodes coming on/offline
continuously, without spending gh budget on anything the local wire can say
for free.
The slice, composed onto existing machinery rather than beside it:
- airc-transport/lan_presence: ~100-byte JSON beacon on an RFC 2365
administratively-scoped group (239.255.77.77:47700 — deliberately not
mDNS/SSDP's groups), every ANNOUNCE_INTERVAL=15s with per-identity
jitter (802.11-style desync, no RNG dep). SO_REUSEADDR so every scope
on one machine hears the group. Crate stays log-free per convention.
- airc-lib::start_lan_presence: the consumer. Only an ENROLLED peer's
beacon teaches anything (discovery is not authorization); what it
teaches lands in learned_ips — the SAME map learn-live-address (#9)
feeds — so existing dial rungs pick it up with no new plumbing.
Edge-triggered logging.
- daemon wiring beside listen_lan_advertising: non-fatal on bind failure
(a container without multicast still dials out + rides the rendezvous),
loud about the consequence when degraded.
Security: a beacon is a HINT, never trust — it can only trigger the existing
authenticated dial pinned to an enrolled identity; IP from the datagram
SOURCE (observed), only the port claimed, and a wrong claim just fails the
handshake, bounded by dial quarantine.
Convergence: online -> first beacon <=18s -> next refresh dials. Offline ->
beacons stop -> proof-of-life freshness + failure-counted eviction age it
out. The governor's LAN tier: churn handled continuously, gh-free.
Verified: lan_presence 4/4; airc-lib --lib 341/0; airc-cli integration green
except drain_stdin_timeout_proceeds_when_eof_never_arrives, which fails
IDENTICALLY on clean origin/canary (reproduced before claiming) — pre-existing.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply
added a commit
that referenced
this pull request
Sep 4, 2026
…th zero gh requests (#1371) feat(discovery): LAN presence beacon — same-network peers converge with ZERO gh requests airc had no LAN-local discovery at all: no mDNS, no multicast, no broadcast. Two peers on the same /24 could only find each other through the GitHub rendezvous (budget-capped, beacons stale in minutes) or cached endpoints (invalidated by churn). Measured live 2026-09-04: a peer's Mac was on this LAN, daemon LISTENING, while this node reported "0 routes, 96 enrolled" — a human closed the gap with arp + a hand-derived port + airc dial. This is also what made gh a single point of failure and a spam risk at once: LAN convergence rode the same request budget as SOS and registry sync. Per Joel's governor directive: the mesh must ride nodes coming on/offline continuously, without spending gh budget on anything the local wire can say for free. The slice, composed onto existing machinery rather than beside it: - airc-transport/lan_presence: ~100-byte JSON beacon on an RFC 2365 administratively-scoped group (239.255.77.77:47700 — deliberately not mDNS/SSDP's groups), every ANNOUNCE_INTERVAL=15s with per-identity jitter (802.11-style desync, no RNG dep). SO_REUSEADDR so every scope on one machine hears the group. Crate stays log-free per convention. - airc-lib::start_lan_presence: the consumer. Only an ENROLLED peer's beacon teaches anything (discovery is not authorization); what it teaches lands in learned_ips — the SAME map learn-live-address (#9) feeds — so existing dial rungs pick it up with no new plumbing. Edge-triggered logging. - daemon wiring beside listen_lan_advertising: non-fatal on bind failure (a container without multicast still dials out + rides the rendezvous), loud about the consequence when degraded. Security: a beacon is a HINT, never trust — it can only trigger the existing authenticated dial pinned to an enrolled identity; IP from the datagram SOURCE (observed), only the port claimed, and a wrong claim just fails the handshake, bounded by dial quarantine. Convergence: online -> first beacon <=18s -> next refresh dials. Offline -> beacons stop -> proof-of-life freshness + failure-counted eviction age it out. The governor's LAN tier: churn handled continuously, gh-free. Verified: lan_presence 4/4; airc-lib --lib 341/0; airc-cli integration green except drain_stdin_timeout_proceeds_when_eof_never_arrives, which fails IDENTICALLY on clean origin/canary (reproduced before claiming) — pre-existing. Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 4, 2026
…he by-hand dial, encoded (#1301 caller side) Measured live 2026-08-15, BigMama -> M5: the peer was enrolled, its Mac answered mDNS, its daemon was LISTENING on its identity-derived stable port — and every STORED endpoint for it carried a stale ephemeral port from the pre-#1369 churn. Discovery dialed corpses and reported "0 routes, 96 enrolled peers". The connection that finally worked was a human doing the derivation by hand: arp/mDNS -> the IP (192.168.1.249) stable_lan_port(id) -> the port (57958, from peer 2f0aed7f) airc dial --expected-peer ... -> CONNECTED, authenticated A user without a terminal cannot do any of that. Joel: "There is no one to manually do shit... all of this must work automatically for users." So the sequence becomes a dial rung. `identity_port_candidates` pairs every IP already known for a peer (stored endpoints; learned IPs ride in via the existing #9 rung) with the ONE port knowable WITHOUT any advertisement: stable_lan_port of the peer's transport host. Derived from the dial PIN, not the record peer — the listener binds the wire-owning scope's identity, so a record answered by a declared host must derive from that host (machine-vs-scope, same rule as the TLS pin). Appended LAST, not prepended: post-#1369 the advertised port IS the stable port, so stored endpoints normally win and this rung costs nothing. It pays exactly when the stored set is stale — churn-era records, or a peer whose bind fell back — and failure-counted eviction retires the corpses so the rung stops paying their timeouts. When a stored endpoint already carries the derived port, no candidate is added (pinned by test). With #1369 (bind keeps the stable port across restarts) this closes the loop from both ends: the listener stays where identity says it should be, and the dialer can now find it there with nothing but the trust store. Verified: cargo test -p airc-lib --lib — 336 passed, 0 failed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply
added a commit
that referenced
this pull request
Sep 4, 2026
…he by-hand dial, encoded (#1301 caller side) (#1370) * feat(discovery): the daemon derives a peer's identity port itself — the by-hand dial, encoded (#1301 caller side) Measured live 2026-08-15, BigMama -> M5: the peer was enrolled, its Mac answered mDNS, its daemon was LISTENING on its identity-derived stable port — and every STORED endpoint for it carried a stale ephemeral port from the pre-#1369 churn. Discovery dialed corpses and reported "0 routes, 96 enrolled peers". The connection that finally worked was a human doing the derivation by hand: arp/mDNS -> the IP (192.168.1.249) stable_lan_port(id) -> the port (57958, from peer 2f0aed7f) airc dial --expected-peer ... -> CONNECTED, authenticated A user without a terminal cannot do any of that. Joel: "There is no one to manually do shit... all of this must work automatically for users." So the sequence becomes a dial rung. `identity_port_candidates` pairs every IP already known for a peer (stored endpoints; learned IPs ride in via the existing #9 rung) with the ONE port knowable WITHOUT any advertisement: stable_lan_port of the peer's transport host. Derived from the dial PIN, not the record peer — the listener binds the wire-owning scope's identity, so a record answered by a declared host must derive from that host (machine-vs-scope, same rule as the TLS pin). Appended LAST, not prepended: post-#1369 the advertised port IS the stable port, so stored endpoints normally win and this rung costs nothing. It pays exactly when the stored set is stale — churn-era records, or a peer whose bind fell back — and failure-counted eviction retires the corpses so the rung stops paying their timeouts. When a stored endpoint already carries the derived port, no candidate is added (pinned by test). With #1369 (bind keeps the stable port across restarts) this closes the loop from both ends: the listener stays where identity says it should be, and the dialer can now find it there with nothing but the trust store. Verified: cargo test -p airc-lib --lib — 336 passed, 0 failed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * test(discovery): the dial suite expects the identity-derived recovery candidate CI caught what my local run did not: five assertions in stored_endpoint_dial pin exact `peer_dial_failures` / `peer_dial_skips` counts, and the identity-port rung appends one candidate per peer, so each count went 1 -> 2 (and N_TARPITS -> 2 * N_TARPITS). These are CORRECT failures, not noise — the counts are the contract, and they changed. Each site now says why: post-#1369 a peer advertises its stable port, so the derived candidate dedups away and costs nothing; these fixtures use synthetic/churn-era endpoints, which is exactly the case the rung exists for, so they pay one extra fast local dial. The concurrency bound in `peers_are_dialed_concurrently_not_serially` is untouched and still load-bearing: the slow dial per peer is the single 3s tarpit; the derived dial is an instant local refuse adding milliseconds to each peer's serial walk, well inside the 9s ceiling. It passed at 20.4s wall for the whole suite. Verified: cargo test -p airc-lib --test stored_endpoint_dial — 13 passed, 0 failed (was 12/1). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc --------- Co-authored-by: Claude Opus 5 (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.
Summary
Audit of
\$(...)command substitutions under `set -euo pipefail` turned up three more places in the same class as #6. All guarded with `|| true`.cmd_teardownstale-pid read (L1062) —cat pidfile | trraced if file was removed between the-ftest and the read. Teardown aborted before therm -f. Hardening only.cmd_teardownport-reap (L1093-L1094) —ps -p \$lpidreturns 1 if the process exited between thelsofscan and thepsquery. Real race under load: aborts mid-loop, leaves later ports unchecked. Actual bug, not just hardening.cmd_peersentry parse (L1041-L1042) — a malformed peer JSON abortedpython3 -c "json.load(...)[key]", which underset -ekilled the whole peers listing at the first bad record. Now broken records print empty name/host and the rest of the list still enumerates.Verification
teardownwith dead PIDs in the pidfile reachesTeardown complete., pidfile cleared.peerswith one malformed + one valid record lists both, exit 0. Before the fix, the malformed record would stop the loop.Test plan
bash -n airc— syntax OKRelated
set -e+ pipefail traps).fix/offline-resilience-issue-5branch (docs only).🤖 Generated with Claude Code