Repository navigation
HOTFIX: auth probe on resume — no more silent retry loop on stale auth - #18
Merged
Merged
Conversation
…le auth ## The default-broken path `airc teardown` (no --flush) + `airc connect` (no args = resume) is the reflex sequence every user does. If the saved SSH key is stale (key rotation, reinstall, authorized_keys change), the old resume path: 1. printed "Resuming as joiner of 'X' (host)..." 2. jumped straight into monitor() 3. which ran `while true; do ssh ... tail -F ... || true; sleep 3; done` 4. SSH returned 255 on auth failure silently 5. `|| true` swallowed the exit 6. loop retried forever, stderr discarded Net: mesh was dead, user had no visible error, no clue how to recover. This is the literal "broken by default" that bit memento during cross- mesh coordination and cost us hours. ## Fix Probe SSH auth BEFORE entering the monitor loop in the resume path. `ssh -o ConnectTimeout=5 -o BatchMode=yes <host> "echo __AUTH_OK__"`. If probe succeeds → continue to monitor as before. If probe fails with an auth-class stderr (same detector as the cmd_send fix from #17: permission denied, publickey, host key verification, authentication fail, identification has changed, no supported authentication): - Surface the actual SSH stderr - Print the fix command: `airc teardown --flush && airc connect <invite>` - Reconstruct the saved invite string from config.json so the user doesn't have to hunt for it - die() with exit 1 If probe fails with a non-auth stderr (timeout, DNS, etc): - Warn but fall through to monitor() — transient outages are what the retry loop is actually designed for ## New scenario: scenario_resume_stale_auth Simulates the exact user flow: 1. Fresh pair + baseline send works (proves clean state) 2. `airc teardown` (no --flush, state preserved) 3. Regenerate the joiner's ssh_key in-place (any cause of stale key) 4. `airc connect` (resume) 5. Assert: exits <= 10s (not silently looping), exit non-zero, stderr mentions auth, stderr contains repair command, stderr has reconstructed invite string Validated against pre-fix (git show main:airc): 4 of 6 assertions FAIL, including "connect still running after 10s — silent retry loop (pre-fix bug)". On fix: 6/6 green, resume dies in 1 second with full diagnostic. Full suite: 74/74 (was 68/68). ## What this PR does NOT do (acknowledged gaps) - Does not auto-re-pair. User still has to type the command. Safer for now (auto-repair would paper over legitimate host-side changes the user should know about), but the code has everything needed to add it later. - Tests still pollute the caller's ~/.ssh/authorized_keys — every pair handshake appends a pubkey and nothing cleans it up. Separate concern; see follow-up work on sandboxed test harness (test-only sshd on alt port or Docker containers). Refs #17.
joelteply
added a commit
that referenced
this pull request
Apr 16, 2026
… docs Today's production story crammed years of user pain into one day: two hosts fighting over port 7547, memento paired with the wrong host for hours, sends that "succeeded" into a different mesh, resume silently retrying forever on stale auth. The code fixes landed in #17/#18; this PR fixes the DOCUMENTATION + SKILLS so future users/agents don't rediscover the same footguns. ## New skill: /repair One-command nuclear re-pair. Reconstructs the saved invite string from config, then runs `airc teardown --flush && airc connect <invite>`. Replaces the error-prone "teardown (forgot --flush) + resume (silent auth fail)" dance that bit memento today. Takes optional invite argument to repair onto a new host (useful when you discover you were on the wrong mesh). ## Updated skills - /connect: paste invite VERBATIM including `:port` — trimming silently pairs with whoever's on default 7547. Troubleshooting section now covers the resume-auth-probe failure mode + the wrong-host-on-shared- machine case. - /teardown: explicit --flush vs plain-teardown decision rule. "Rule of thumb: if anything about your pairing feels uncertain, use --flush." - /resume: documents the new auth probe. Failure mode now says follow the repair command verbatim from the stderr output. - /invite: warns to include the port in the pasted string when non-default. Tells the user to call out `:7548` explicitly so the recipient doesn't trim it. - /send: replaced the misleading "try teardown and re-pair" guidance. Now lists the three exit-class behaviors (auth fail / network queue / pending cap) with the correct repair for each. ## Updated integrations All six integration READMEs (claude-code, cursor, generic, openai-codex, opencode, windsurf) now document: - Auth vs network error distinction on send failure - `/repair` or equivalent nuclear re-pair sequence - Port-collision symptom ("peers look right but nobody responds — check host name in `airc peers`") - New lifecycle markers ([joined], [left], [QUEUED], [DRAINED], [AUTH FAILED]) in the generic JSONL protocol doc ## Why this matters The error-class evidence and the re-pair sequence existed in the code after today's hotfixes, but the user-facing docs still said "try teardown and re-pair" with no --flush — which is EXACTLY the wrong advice. A user following the old docs would land right back in the broken-by-default state that cost us hours. Refs #17, #18, #19, and the airc-96dd / vhsm-2c84 port collision on [email protected] — 2026-04-15 eval.
joelteply
added a commit
that referenced
this pull request
Apr 16, 2026
… docs (#20) Today's production story crammed years of user pain into one day: two hosts fighting over port 7547, memento paired with the wrong host for hours, sends that "succeeded" into a different mesh, resume silently retrying forever on stale auth. The code fixes landed in #17/#18; this PR fixes the DOCUMENTATION + SKILLS so future users/agents don't rediscover the same footguns. ## New skill: /repair One-command nuclear re-pair. Reconstructs the saved invite string from config, then runs `airc teardown --flush && airc connect <invite>`. Replaces the error-prone "teardown (forgot --flush) + resume (silent auth fail)" dance that bit memento today. Takes optional invite argument to repair onto a new host (useful when you discover you were on the wrong mesh). ## Updated skills - /connect: paste invite VERBATIM including `:port` — trimming silently pairs with whoever's on default 7547. Troubleshooting section now covers the resume-auth-probe failure mode + the wrong-host-on-shared- machine case. - /teardown: explicit --flush vs plain-teardown decision rule. "Rule of thumb: if anything about your pairing feels uncertain, use --flush." - /resume: documents the new auth probe. Failure mode now says follow the repair command verbatim from the stderr output. - /invite: warns to include the port in the pasted string when non-default. Tells the user to call out `:7548` explicitly so the recipient doesn't trim it. - /send: replaced the misleading "try teardown and re-pair" guidance. Now lists the three exit-class behaviors (auth fail / network queue / pending cap) with the correct repair for each. ## Updated integrations All six integration READMEs (claude-code, cursor, generic, openai-codex, opencode, windsurf) now document: - Auth vs network error distinction on send failure - `/repair` or equivalent nuclear re-pair sequence - Port-collision symptom ("peers look right but nobody responds — check host name in `airc peers`") - New lifecycle markers ([joined], [left], [QUEUED], [DRAINED], [AUTH FAILED]) in the generic JSONL protocol doc ## Why this matters The error-class evidence and the re-pair sequence existed in the code after today's hotfixes, but the user-facing docs still said "try teardown and re-pair" with no --flush — which is EXACTLY the wrong advice. A user following the old docs would land right back in the broken-by-default state that cost us hours. Refs #17, #18, #19, and the airc-96dd / vhsm-2c84 port collision on [email protected] — 2026-04-15 eval.
joelteply
added a commit
that referenced
this pull request
Apr 21, 2026
* skills+integrations: repair flow, port-collision warning, error-class docs Today's production story crammed years of user pain into one day: two hosts fighting over port 7547, memento paired with the wrong host for hours, sends that "succeeded" into a different mesh, resume silently retrying forever on stale auth. The code fixes landed in #17/#18; this PR fixes the DOCUMENTATION + SKILLS so future users/agents don't rediscover the same footguns. ## New skill: /repair One-command nuclear re-pair. Reconstructs the saved invite string from config, then runs `airc teardown --flush && airc connect <invite>`. Replaces the error-prone "teardown (forgot --flush) + resume (silent auth fail)" dance that bit memento today. Takes optional invite argument to repair onto a new host (useful when you discover you were on the wrong mesh). ## Updated skills - /connect: paste invite VERBATIM including `:port` — trimming silently pairs with whoever's on default 7547. Troubleshooting section now covers the resume-auth-probe failure mode + the wrong-host-on-shared- machine case. - /teardown: explicit --flush vs plain-teardown decision rule. "Rule of thumb: if anything about your pairing feels uncertain, use --flush." - /resume: documents the new auth probe. Failure mode now says follow the repair command verbatim from the stderr output. - /invite: warns to include the port in the pasted string when non-default. Tells the user to call out `:7548` explicitly so the recipient doesn't trim it. - /send: replaced the misleading "try teardown and re-pair" guidance. Now lists the three exit-class behaviors (auth fail / network queue / pending cap) with the correct repair for each. ## Updated integrations All six integration READMEs (claude-code, cursor, generic, openai-codex, opencode, windsurf) now document: - Auth vs network error distinction on send failure - `/repair` or equivalent nuclear re-pair sequence - Port-collision symptom ("peers look right but nobody responds — check host name in `airc peers`") - New lifecycle markers ([joined], [left], [QUEUED], [DRAINED], [AUTH FAILED]) in the generic JSONL protocol doc ## Why this matters The error-class evidence and the re-pair sequence existed in the code after today's hotfixes, but the user-facing docs still said "try teardown and re-pair" with no --flush — which is EXACTLY the wrong advice. A user following the old docs would land right back in the broken-by-default state that cost us hours. Refs #17, #18, #19, and the airc-96dd / vhsm-2c84 port collision on [email protected] — 2026-04-15 eval. * feat(teardown): --all flag — nuke every airc process on this machine, ignore scope Joel 2026-04-21: airc kept "going down" between sessions. Root cause: two airc-connect bash processes from a previous session (Wed) survived every teardown for 2 days because they ran from `/tmp/airc-prefix connect` (the curl|bash bootstrap variant) and were tracked by a PID file in a scope dir that no longer existed when later teardowns ran. The default `airc teardown` is scope-aware by design (so it won't touch other tabs' sessions), but that means it can't recover from the case where state is so messy that we've lost track of where the pidfiles SHOULD be. `airc teardown --all` covers that case. It's additive (still does the scope-aware path too) and surgical: - pgrep `(airc|airc-prefix)\s+connect` for THIS user → kill - For each port in 7547-7559: lsof for python listeners → if the command line shows `socket.SOCK_STREAM`/`AF_INET` (i.e. it's an airc listener, not some unrelated python), kill it - pgrep `\.airc/messages\.jsonl` for stale ssh/tail subprocesses reading scope message logs → kill them too - Then falls through to scope-aware path so this scope's pidfile + flush also happen if `--flush` was passed alongside Doesn't touch processes outside the airc port range or anything that isn't clearly airc-shaped. The "for this user" filter (`pgrep -u`) keeps it safe on shared machines. Help text updated to mention `--all`.
joelteply
added a commit
that referenced
this pull request
Jul 2, 2026
…r door The account-mesh rendezvous is now SELECTED, not hardcoded. `resolve_account_registry_store(choice, gist)` picks the AccountRegistryStore for a RendezvousChoice and pairs it with the RegistryRefreshGate that matches it — gist → GhAuth (hermetic + `gh auth status` probe), folder → Always (no external auth to gate on). The daemon refresh loop runs against the boxed store and never learns which door won. `AIRC_RENDEZVOUS_DIR` set → the no-GitHub shared-folder door (on-prem / behind-firewall); unset → the default gist door. Set-but-empty / non-UTF-8 fail loud rather than silently defaulting to gist (which would hide an operator's misconfiguration). This is the substrate half of #18 — a fresh clone auto-picks a working rendezvous with zero manual network ops. Reuses RegistryRefreshGate::Always (no new gate variant needed) and the FsAccountRegistryStore from #1284. Adds one delegating `impl AccountRegistryStore for Box<dyn AccountRegistryStore>` so a boxed store satisfies run_loop's generic `S: AccountRegistryStore` bound — SELECTION happens once at the seam. Rendezvous initiates the exchange; it does not supply security (that stays E2E in the data plane), so a shared folder is a legitimate peer of a gist. ORM-abstracted throughout: the local cache rides SqliteEventStore, the folder door is plain JSON files — zero raw SQL. Tests (rendezvous.rs, one mod): env→choice contract (unset=gist, path=folder, empty=fail-loud, no env mutation); folder door pairs Always + the boxed store really writes a file into the share; gist door pairs GhAuth carrying the given scope_home. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Jul 2, 2026
…wnAccount Import-time trust elevation (the "both, staged" model — get the simple version working now, harden to handshake-gated after positron desktop). When `import_account_registry_document` enrols a peer beacon carried in OUR OWN account registry, it now routes the peer through `detect_tier` and applies the result — same-mesh peers land `OwnAccount` instead of the default `Untrusted`. That is the difference between "join to Asha across machines just works" and an unusable peer that needs a manual `set-tier`. Closes the auto-trust half of #18 (the enrolment/key-pinning half already existed); `detect_tier` was built (card 34942ec1) but had zero callers. Security: the elevation consults our REAL resolved mesh identity (`self.mesh_identity()`), never the document's self-asserted `mesh_identity` — a document vouching for its own identity would be circular and let any imported document mint account trust for its peers. A foreign-mesh document therefore leaves its peers `Untrusted` (key still pinned, trust withheld). Vanished-row-after-add fails loud, matching the endpoint-store guard directly below it. Staged follow-up (#18 handshake-gate): keep this enrol at Untrusted and elevate to OwnAccount only once the peer ALSO proves possession of the pinned key in a live session — defense-in-depth so a compromised rendezvous alone can't mint account trust. Test `import_elevates_same_account_peer_but_not_a_foreign_document` covers both the positive elevation and the foreign-mesh negative. 34 account- registry tests pass; the 2 gh_stub failures are pre-existing/env-dependent on the branch base, unrelated to this change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Jul 2, 2026
…lity (#1283) * feat(store): generic scoped_state key→JSON store (walls/coordination/plan/widget) The internal sibling of the bio identity card: one durable, dumb key→JSON table scoped to a user, a room, or a (user, room) pair. Editable walls (a room's instructions / recipe), room coordination state (the shared plan), per-person prefs, widget UI state (open tabs / rooms), and the adaptive tool-menu cursor all live here — differing only by (scope_key, key). Backs concise RAG: explicit, scoped, budgetable grounding layers instead of an undifferentiated dump. Mirrors account_registry exactly (String-PK durable table, upsert-on- conflict, store never parses value_json). Scope is encoded as a flat `scope_key` string (`user:<peer>` / `room:<room>` / `uir:<peer>:<room>`) so the PK stays a clean two-column (scope_key, key) — no nullable composite. The kanban board stays event-sourced and untouched; "plan generics" is a `plan` wall in this store that links WorkCardIds. Slice 1 (airc-store layer): StoredScopedState DTO, composite-PK entity, migration #18, EventStore::{get,set,list,delete}_scoped_state on both SqliteEventStore (OnConflict upsert) and InMemoryEventStore. Round-trip test covers upsert-wins, scope-isolated key-ascending list, idempotent delete. Next slices (separate commits): airc-core ScopeRef + ScopedStateChanged wire event (broadcast on room scope), airc-lib set/get, airc-cli `airc state`. Continuum consumes via a WallSource RagSource + the tool-menu cursor read. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(core): ScopeRef — private/local scoped-state domain layer (complements the room wall) Slice 2 — the storage-neutral typed layer over the scoped_state store. ScopeRef { User(PeerId) | Room(RoomId) | UserInRoom(PeerId, RoomId) } owns the scope_key encoding (user:<peer> / room:<room> / uir:<peer>:<room>) that the store previously only documented — one logical decision, one owner (compression principle). scope_key() ↔ parse() are exact inverses; parse() fails loud (None) on an unknown prefix or bad UUID rather than guessing a scope. Scoped state is the PRIVATE/LOCAL sibling of airc's existing room wall. airc already has Airc::publish_wall_post / wall_posts — event-sourced, broadcast, supersede-chain, open consumer-defined categories — which is the right home for SHARED room documents (a room's plan, coding instructions, the recipe, rules/agenda/rag). This store deliberately does NOT duplicate that: it holds peer-private, high-churn, last-write- wins state the wall can't serve — prefs, "where was I last" / the tool-menu mode cursor, widget UI state (open tabs / rooms). A growing supersede log is the wrong shape for a cursor updated every turn; a durable LWW row is right. Scoped state therefore never broadcasts (no wire event) — a consumer (continuum's WallSource) presents ONE unified scoped grounding surface by reading the wall (shared) + scoped state (private) underneath. That is the concise-RAG payoff: explicit, scoped, budgetable layers, each on the right primitive. ScopedStateEntry mirrors the persisted DTO (StoredScopedState) as the storage-neutral domain view, with a typed scope() accessor. 3 unit tests cover round-trip, fail-loud parse, and scope() recovery. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(lib): Airc::{get,set,list,delete}_scoped_state — private scoped-state facade Slice 3 — the airc-lib facade over the scoped_state store (slices 1–2). get/set/list/delete take a typed ScopeRef and bridge the persistence DTO (StoredScopedState) to the domain view (ScopedStateEntry). set() stamps the write time (crate::time::now_ms) and records THIS peer as updated_by — the caller can't spoof provenance and the lib owns the clock, matching how publish_wall_post stamps published_at_ms; the caller still owns the LWW version counter. delete is idempotent. Deliberately NO broadcast and NO wire event — unlike set_local_identity_card (which fans a card to every subscribed room) scoped state is peer-private. Shared room documents (a room's plan / coding instructions / recipe) reuse the existing event-sourced wall (publish_wall_post / wall_posts); this facade serves the private complement (prefs, the tool-menu cursor, widget UI state). A consumer reads scoped state on demand and composes it with the wall into one grounding surface — concise RAG, not a parallel broadcast. stored_to_entry degrades an unparseable updated_by string to None (provenance is advisory, never load-bearing) rather than failing the read. One integration test exercises the full round trip through the facade (set/get/list/delete + provenance + idempotent delete) on a tempdir Airc. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(airc-cli): `airc state` — CLI over the scoped-state facade Slice 4 of the generic scoped-state store (task #89). Thin clap layer (state_cli.rs) + four async handlers (state_commands.rs) routing through `attached_airc(home)` → `Airc::{get,set,list,delete}_scoped_state`, so the CLI exercises the same daemon-attached path a persona consumer does. Provenance + write-time stamping stay single-sourced in airc-lib; this layer only resolves the scope and renders. Scope defaults to this peer (user scope); `--in-room` scopes to (this peer, the current room). Renamed off `--here` to avoid colliding with the global `--here` (cwd-local home) flag. Shared room documents — plan, instructions, recipe — belong on the broadcast wall (`airc publish --room …`), not here; scoped state never broadcasts. Verbs: get (prints value or nothing), set (--value --version, LWW), list (key\tvalue_json per row), delete (idempotent). cargo check + clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(wall): daemon-attached publish + body-authoritative read A daemon-attached client (e.g. a Continuum persona) published wall posts that vanished — the wall-grounding A/B showed zero lift because the [room-board] block was always empty. Two airc-lib bugs, both fixed here in airc.rs (no wire-protocol change): WRITE split-brain: publish_wall_post routed through emit_lifecycle, which writes only the CLIENT-local store + live channel and never forwards to the daemon when attached. The post landed in the persona's own events.sqlite, invisible to the daemon-backed page_recent the same persona reads with. Fix: when is_daemon_attached(), route the post through daemon_publish (canonical persist + wire fan-out); emit locally only when this IS the owner-core. READ flattening: wall_posts() gated on event.kind == WallPostPublished, but the daemon read path (project/kind_to_transcript) flattens every non-Message bus kind to TranscriptKind::System — the fine kind rides the wire, not the coarse bus enum — so the gate dropped every post for attached clients. Fix: extract a pure wall_post_from_event discriminator that ignores kind and reads the self-describing body (only an actual WallPostPublished body deserializes to that variant; doctrine/identity/ chat bodies fall through). wall_posts() is now a filter_map over it. Regression tests (in the existing wall mod): a wall body on a System- kind event is still recovered; a sibling doctrine body is not misread as a wall post; non-JSON / body-less events fall through without panic. 297 lib tests green, clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(identity): durable per-peer identity index — names survive busy rooms Peer display names decayed to None in busy rooms because name resolution scanned only the bounded recent transcript window for each peer's `IdentityPublished` card. A card is published once per join, so in any room with >window events since a peer joined, the card scrolled out of the scan and `peer_alias` / `room_roster` returned None — and consumers (continuum personas) confabulated names from raw uuids. Fix: maintain a durable per-peer identity index in `scoped_state` (`ScopeRef::User(peer)` → `identity.card`), LWW-keyed on the card's `emitted_at_ms`. Every observed `IdentityPublished` event is recorded into it: - inbound peer cards via both `append_received_frame` branches (daemon-sink + direct); - this peer's OWN card via `emit_lifecycle` — the only path that persists self-originated lifecycle events (it bypasses both the received and sent message-frame paths). `peer_alias` / `peer_identity_card` now read the index instead of scanning; `room_roster` resolves each live peer's name through `peer_alias`, and the now-redundant `peer_display_names` window scan is deleted. The index is room-independent — one identity per peer — which is strictly better than the old per-room scan. Also seed a NAMED citizen's published nick from its `agent_name` at identity-row creation (`generate_and_save_as`), so `attach_as("Claude")` / `init --as Claude` publishes a card carrying "Claude" from its first beat rather than an empty name. The default scope keeps an empty name (the user's identity, set later via `airc identity set`). Adds `AircError::Serde` to surface (never swallow) identity (de)serde into the index. Regression test `peer_name_survives_identity_card_scrolling_past_the_recent_window` buries the card under >window events and asserts both `peer_alias` and `room_roster` still resolve the name — it fails against any window-bounded scan. Incidental: `cargo fmt --all` normalized line-wrapping in three pre-existing `airc-store` scoped_state files (no logic change). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(identity): daemon-aware peer-identity-card read so attached personas resolve foreign names An attached scope has two disjoint data planes: transcript/presence reads RPC to the daemon (foreign peers show present), but scoped_state reads hit the persona's LOCAL home sqlite — which only ever holds the persona's own identity card. The daemon's subscribe reader forwards events without running the identity-observe chokepoint, so foreign peers' cards are indexed only in the DAEMON's store, never the attached client's. Result: presence saw a peer but peer_alias returned None, so personas rendered raw UUIDs (7711fe60) and confabulated names. Fix, modeled exactly on card 8428ae8c (channel_latest_cursor → room_tip): peer identity is owner-core shared state like the transcript tip, so add a typed daemon IPC op PeerIdentityCard and branch peer_identity_card on is_daemon_attached() to read from the daemon's authoritative scoped_state index. peer_alias now delegates to peer_identity_card so there is ONE daemon-aware identity read path. All other scoped_state stays local — peer identity is the single shared exception (derived from broadcast IdentityPublished, globally meaningful), so the key constant lives in airc-core (PEER_IDENTITY_STATE_KEY) as the single source of truth shared by the writer and the daemon's handler. Also: airc identity set --name — the only post-creation path to set the display name on a long-lived identity created before the agent_name nick-seed (republishes the card, so the durable index updates). Wire contract pinned both sides for the new request/response (op tag + field names), mirroring the room_tip per-shape wire tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(identity): route per-peer identity index to the coordinator store The per-peer identity index (scoped_state `user:<peer>` / `identity.card`) is owner-core shared state — like the transcript tip, it must live in the machine-account `coordinator_store`, not the scope-local `event_store`. `record_peer_identity_card` was writing the index to `event_store()` (the scope home) while every reader expects it in the machine-account store: the daemon's IPC index (`handle_peer_identity_card` reads `coordinator_store`) and the daemon-less self-resolution path. The write/read split left the daemon's `coordinator_store` with zero `identity.card` rows while cards were stranded in per-scope homes. The symptom downstream: a continuum persona (attached client) resolved peer display names as raw UUIDs ("7711fe60" instead of "Claude") and confabulated names, because the daemon's identity index it reads over IPC was empty. Fix: add `get_coordinator_scoped_state` / `set_coordinator_scoped_state` helpers and route both the write (`record_peer_identity_card`) and the daemon-less read branch (`peer_identity_card`) through them. Because `coordinator_store` is the one shared machine-account `events.sqlite`, any scope that records a card writes it to the single index every sibling scope and the daemon read. The general scope-home `set/get_scoped_state` (tool.mode / wall / coordination) are unchanged. Regression test: `peer_identity_index_converges_across_scopes_via_ coordinator_store` — one scope records a peer card, a different scope sharing the same wire_root resolves it. Pre-fix the reader read its own empty scope store and answered None. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(identity): room_roster_cards + fix daemon coordinator-store fidelity Adds `Airc::room_roster_cards(within, window) -> Vec<RoomMemberCard>`: the richer sibling of `room_roster` that folds the per-peer identity join airc-side, so a continuum positron roster makes ONE call and each present peer carries its full `Identity` card (name/pronouns/role/bio/ integrations) instead of just a display name. `RoomMemberCard` has NO `display_name` field by design — the name lives at `identity.name`, the same durable-index source as `peer_alias`, so there is ONE name source and no drift (a test pins `identity.name == peer_alias`). Building the sibling test surfaced a pre-existing substrate blocker: the durable per-peer identity index was unreadable under a daemon-attached scope. `handle_peer_identity_card` reads the coordinator store at `User(peer)/PEER_IDENTITY_STATE_KEY`, and a scope WRITES that index to its coordinator store (`wire_root/events.sqlite`) via `record_peer_identity_card`. In production (`run_daemon`) the daemon's coordinator is a Sqlite over that SAME machine-account file, so the read sees the write. But `DaemonFixture` handed the daemon a disjoint `InMemoryEventStore` AND rooted it at a different TempDir than the scopes attach against — doubly unfaithful — so every daemon-side identity/alias lookup returned `None`. This is the pre-existing red in `peer_name_survives_identity_card_scrolling_past_the_recent_window`. Fix makes the fixture production-faithful: the daemon's coordinator is a `SqliteEventStore` over `home/events.sqlite` (same file the router uses, matching `run_daemon`), and `Machine` roots the daemon at the shared `root` every scope attaches against (`start_in`) — ONE machine-account `events.sqlite` for daemon + all scopes, exactly like production. Both the pre-existing name-join test and the new `room_roster_cards` test go green. Daemon payload-opacity is untouched (the daemon never parses `IdentityPublished`; it only reads the index scopes durably wrote). Pre-existing unrelated red left as-is: `gh::account_registry::gh_stub::*` fail deterministically (even single-threaded) on this environment — a GitHub gist-rendezvous stub dependency, a different subsystem; out of scope for this identity PR. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jul 2, 2026
… (auto-pick gist vs folder) (#1284) * feat(account-registry): FsAccountRegistryStore — no-GitHub shared-folder rendezvous Second, maximally-different AccountRegistryStore impl (outlier B) proving the rendezvous seam is genuinely swappable: a shared folder (iCloud / Syncthing / NFS mount) that N machines of one account see, needing no gh CLI, no token, no network. This is the concrete "other means if gist went away" and the on-prem/behind-firewall grid rendezvous (a hospital deploy can't reach GitHub). Rendezvous initiates the exchange, it does not supply the security — that lives in the E2E data plane (paired peer keys, trust tiers) regardless of which door a node came through, exactly the Tailscale coordination-server shape. Fidelity: byte-identical convergence to the gist store. Each machine writes ITS document to a per-writer file (<dir>/<identity>/<writer_file>) so two machines never clobber, and refresh reads every writer file and folds through the SAME merge_registry_documents + prune_stale_peers core — the merge/freshness logic stays in exactly one place. - publish: validate → pretty JSON → atomic pid-temp write + rename (a concurrent refresh on another machine never reads a half-written doc) - refresh: read every .json writer file (skips .tmp staging + OS cruft like .DS_Store/.icloud), fail loud on a corrupt writer file, merge, prune stale - unpublished identity → Ok(None), not an error (mirrors gh's no-gist → None) Tests (one mod, // what this catches): round-trip; the keystone two_machines_sharing_a_folder_converge_via_merge (two writers, one shared dir, distinct writer files → both peers merged, zero GitHub); unknown-identity → None. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(rendezvous): #113 selector seam — auto-pick gist vs shared-folder door The account-mesh rendezvous is now SELECTED, not hardcoded. `resolve_account_registry_store(choice, gist)` picks the AccountRegistryStore for a RendezvousChoice and pairs it with the RegistryRefreshGate that matches it — gist → GhAuth (hermetic + `gh auth status` probe), folder → Always (no external auth to gate on). The daemon refresh loop runs against the boxed store and never learns which door won. `AIRC_RENDEZVOUS_DIR` set → the no-GitHub shared-folder door (on-prem / behind-firewall); unset → the default gist door. Set-but-empty / non-UTF-8 fail loud rather than silently defaulting to gist (which would hide an operator's misconfiguration). This is the substrate half of #18 — a fresh clone auto-picks a working rendezvous with zero manual network ops. Reuses RegistryRefreshGate::Always (no new gate variant needed) and the FsAccountRegistryStore from #1284. Adds one delegating `impl AccountRegistryStore for Box<dyn AccountRegistryStore>` so a boxed store satisfies run_loop's generic `S: AccountRegistryStore` bound — SELECTION happens once at the seam. Rendezvous initiates the exchange; it does not supply security (that stays E2E in the data plane), so a shared folder is a legitimate peer of a gist. ORM-abstracted throughout: the local cache rides SqliteEventStore, the folder door is plain JSON files — zero raw SQL. Tests (rendezvous.rs, one mod): env→choice contract (unset=gist, path=folder, empty=fail-loud, no env mutation); folder door pairs Always + the boxed store really writes a file into the share; gist door pairs GhAuth carrying the given scope_home. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(account-registry): #18 auto-trust — same-account beacons enrol OwnAccount Import-time trust elevation (the "both, staged" model — get the simple version working now, harden to handshake-gated after positron desktop). When `import_account_registry_document` enrols a peer beacon carried in OUR OWN account registry, it now routes the peer through `detect_tier` and applies the result — same-mesh peers land `OwnAccount` instead of the default `Untrusted`. That is the difference between "join to Asha across machines just works" and an unusable peer that needs a manual `set-tier`. Closes the auto-trust half of #18 (the enrolment/key-pinning half already existed); `detect_tier` was built (card 34942ec1) but had zero callers. Security: the elevation consults our REAL resolved mesh identity (`self.mesh_identity()`), never the document's self-asserted `mesh_identity` — a document vouching for its own identity would be circular and let any imported document mint account trust for its peers. A foreign-mesh document therefore leaves its peers `Untrusted` (key still pinned, trust withheld). Vanished-row-after-add fails loud, matching the endpoint-store guard directly below it. Staged follow-up (#18 handshake-gate): keep this enrol at Untrusted and elevate to OwnAccount only once the peer ALSO proves possession of the pinned key in a live session — defense-in-depth so a compromised rendezvous alone can't mint account trust. Test `import_elevates_same_account_peer_but_not_a_foreign_document` covers both the positive elevation and the foreign-mesh negative. 34 account- registry tests pass; the 2 gh_stub failures are pre-existing/env-dependent on the branch base, unrelated to this change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(gh): isolate the gh governor per-test — kill gh_stub suite flakiness The gh_stub store tests built their `GhAccountRegistryStore` via `store_at`, which never called `.with_budget(...)` — so every store fell through to `GhBudget::account_default()` = the REAL machine-wide `~/.airc/gh/` governor state. Two consequences, both flaky under `cargo test` parallelism: 1. A live `backoff-until` armed by a background airc daemon (or by real gh rate-limiting during CI pushes) denied every gh call in these tests with "shared gh backoff active for Ns" — 7 of 8 gh_stub tests failing on machines with an active governor, passing on a clean one. 2. A gh_stub test that itself arms a backoff (rate-limit simulation) poisoned its siblings within the same run — hence the 8-pass-then- 7-fail flip on consecutive runs. Fix routes `store_at` through the isolation seam that already exists for exactly this (`GhBudget::at`, doc'd "Used by tests for isolation"): root the governor at the StubGh's per-test state dir. Rooted at the STUB (not `db_dir`) so the multiple store instances one test builds — sentinel_loss's first/reborn — coordinate on ONE governor, exactly as one machine would; db_dir is per-store and would split them. gh_stub suite now 8/8 across 5 consecutive runs (was flaky 1-8 passing); full account_registry suite 39/39 (was 34 pass / 2 env-flaky fail). No production path touched — this is test isolation only. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 4.8 (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.
The default-broken path
`airc teardown` (no --flush) + `airc connect` (no args = resume) is what every user types. If the saved SSH key is stale for any reason — rotation, reinstall, authorized_keys change — the old resume path:
Net: mesh dead, user has no error, no clue how to recover. This is what bit memento.
Fix
Probe SSH auth BEFORE entering the monitor loop:
```
ssh -o ConnectTimeout=5 -o BatchMode=yes "echo AUTH_OK"
```
Test: `scenario_resume_stale_auth`
Simulates exact user flow: fresh pair → baseline works → `airc teardown` → regenerate ssh_key → `airc connect` (resume). Asserts the resume dies fast with full diagnostic.
Validated against pre-fix binary: 4 of 6 assertions fail, including "connect still running after 10s — silent retry loop (pre-fix bug)". Post-fix: 6/6 green, dies in 1 second.
Full suite: 74/74 (was 68/68).
Not in this PR (acknowledged)
Refs #17, airc coordination outage 2026-04-15.