Repository navigation
refactor(cli): remove legacy bearer command - #899
Merged
Merged
Conversation
joelteply
added a commit
that referenced
this pull request
May 23, 2026
…ACT 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]>
2 of 4 tasks
joelteply
added a commit
that referenced
this pull request
May 23, 2026
* 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]>
This was referenced May 28, 2026
Closed
Merged
This was referenced May 28, 2026
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 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
airc bearercommand and its GitHub JSONL message-bus implementationVerification