Repository navigation
Conversation
When the host a joiner is paired to disappears (teardown, network
partition, port rebind, host rebuilt under new identity), the outer
reconnect loop —
while true; do
ssh ... "tail ..." | monitor_formatter "$my_name" || true
sleep 3
done
— churns forever against a dead target. Each SSH attempt returns in
<1s (connection refused / key reject / wrong port). The 180s inactivity
watchdog inside monitor_formatter exits cleanly and the outer loop
restarts SSH against the same dead target, which immediately fails
again. `airc status` keeps reporting "monitor: running" indefinitely
because the subprocess IS alive — it's just stuck in a no-op loop.
This commit adds a two-layer signal:
1. **Detection** in cmd_monitor: time each SSH attempt. Held <10s →
fast-fail (increment counter). Held >=10s → the channel was actually
up at some point, reset counter. After 5 consecutive fast failures,
write `$AIRC_WRITE_DIR/connection_state` with `unreachable since=<ts>
host=<target> consecutive_failures=<N>`. Atomic tmp-then-mv so a
concurrent `airc status` can never read a half-written line. Cleared
on any held channel — recovery is self-announcing.
2. **Surface** in cmd_status: when the monitor pidfile's process is
alive AND connection_state exists, report monitor as
`reconnect-looping (N consecutive ssh failures since Xs ago)` instead
of `running`. Add a second line pointing the user at
`airc teardown --flush && airc connect <fresh-join-string>` — the
canonical recovery.
Zero extra cost on the healthy path: the reset branch already runs every
iteration, and cmd_status's `[ -f ]` check is a single stat. The 10s
threshold separates "connection never established" from "held then
dropped" — the latter is normal transient weather, the former is a dead
target the user needs to act on.
Companion to #26 (teardown hint). Together they close the recovery-path
blind spots documented in #25.
joelteply
added a commit
that referenced
this pull request
Jun 21, 2026
The canonical identity doc mapped the seams (§1-6) but had no lens for WHEN each is right. The 2026-06-20 self-echo investigation surfaced the root: two project dirs on one machine mint two PeerIds for one human (continuum/.airc=7711fe60, airc/.airc=e11db4ac) — Context leaked into Identity because the substrate has no axis for "which project/room" distinct from "who". Add Part A (read-first lens that §1-6 are consequences of): - A.1: three orthogonal axes — Identity(who)/Context(where)/Session(which); the bug class is always "one axis smuggled into another". Context has no home today, so it leaks into Identity. - A.2: actor × situation matrix (human/agent/persona × tabs/projects/ machines/restart) → who collapses to 1, where/which fan out. The rule: Identity collapses, Context and Session fan out. - A.3: invariants — durable+never-silently-minted identity, explicit envelope-carried contextId, state preserved by (I,C) not lost on session/daemon death, "self" is citizen-level, one peer truth. Ordering per Joel: model right -> robust/preserved -> THEN efficiency. - A.4: the self-echo finding as worked example — #1271's per-peer filter is correct but can't catch cross-project echo until Context gets its own axis; that unifies §1, §4, and continuum task #27. Guiding principle for all identity fixes/PRs and agent review of them. Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 21, 2026
The canonical identity doc mapped the seams (§1-6) but had no lens for WHEN each is right. The 2026-06-20 self-echo investigation surfaced the root: two project dirs on one machine mint two PeerIds for one human (continuum/.airc=7711fe60, airc/.airc=e11db4ac) — Context leaked into Identity because the substrate has no axis for "which project/room" distinct from "who". Add Part A (read-first lens that §1-6 are consequences of): - A.1: three orthogonal axes — Identity(who)/Context(where)/Session(which); the bug class is always "one axis smuggled into another". Context has no home today, so it leaks into Identity. - A.2: actor × situation matrix (human/agent/persona × tabs/projects/ machines/restart) → who collapses to 1, where/which fan out. The rule: Identity collapses, Context and Session fan out. - A.3: invariants — durable+never-silently-minted identity, explicit envelope-carried contextId, state preserved by (I,C) not lost on session/daemon death, "self" is citizen-level, one peer truth. Ordering per Joel: model right -> robust/preserved -> THEN efficiency. - A.4: the self-echo finding as worked example — #1271's per-peer filter is correct but can't catch cross-project echo until Context gets its own axis; that unifies §1, §4, and continuum task #27. Guiding principle for all identity fixes/PRs and agent review of them. Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 22, 2026
… + header (#1276) * docs(identity): add use-case matrix + 3-axis guiding principle (Part A) The canonical identity doc mapped the seams (§1-6) but had no lens for WHEN each is right. The 2026-06-20 self-echo investigation surfaced the root: two project dirs on one machine mint two PeerIds for one human (continuum/.airc=7711fe60, airc/.airc=e11db4ac) — Context leaked into Identity because the substrate has no axis for "which project/room" distinct from "who". Add Part A (read-first lens that §1-6 are consequences of): - A.1: three orthogonal axes — Identity(who)/Context(where)/Session(which); the bug class is always "one axis smuggled into another". Context has no home today, so it leaks into Identity. - A.2: actor × situation matrix (human/agent/persona × tabs/projects/ machines/restart) → who collapses to 1, where/which fan out. The rule: Identity collapses, Context and Session fan out. - A.3: invariants — durable+never-silently-minted identity, explicit envelope-carried contextId, state preserved by (I,C) not lost on session/daemon death, "self" is citizen-level, one peer truth. Ordering per Joel: model right -> robust/preserved -> THEN efficiency. - A.4: the self-echo finding as worked example — #1271's per-peer filter is correct but can't catch cross-project echo until Context gets its own axis; that unifies §1, §4, and continuum task #27. Guiding principle for all identity fixes/PRs and agent review of them. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(identity): add A.5 trust-boundary security + A.6 substrate-up order Joel's escalation: conflating the axes isn't tidiness, it's a SECURITY hole — foreign/inbound requests breaking through trust or blowing up. And it must be right substrate-up, headless Rust, from the get go (TS is the dead shell — the trauma this model exists to never re-grow in Rust). - A.5: each axis has a distinct trust origin (Identity=authenticated/ kernel-injected, never client-claimed; Context=client-supplied but ACL-authorized; Session=substrate-minted, never an input to trust). Maps "breaking through security" (trust keyed on a client-controlled field / session-as-identity) and "blowing up" (handler assumes a valid triple → scoped(nil) / bad-key crash on a foreign request) onto axis conflation. Rule: trust = f(authenticated I, authorized C); validate the full triple at the boundary before dispatch. - A.6: Rust-only substrate-up build order — (1) uniform airc+core wire envelope with the (I,C,S) triple [airc needs the contextId axis], (2) GridTrustAuthPolicy gate on (authenticated I × authorized C), (3) fix cognition nil-scope (#15), (4) memory/engrams keyed by (I,C) not S, (5) display self at citizen level. Efficiency last. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(identity): purist resolution — machine-account identity, no migration Joel ruled (2026-06-20): "in with the new, out with the old; this is just us. Design ideally for purist architecture." That removes the migration constraint from §1 / A.3.1: - Operator identity resolves from machine_account_home (same root as the daemon/socket/events.sqlite) → ONE citizen per machine; a project dir is a context, never an identity boundary. - Per-scope identity.key minting is DELETED, not migrated. Existing forked/ stale keys (the 7711fe60/e11db4ac/484b mess) are abandoned — no compat shim, no promote-the-right-key logic. Greenfield: no external users. - Personas are separate citizens (own keypairs, core-owned), never derived from a scope dir. Temp/CI scopes outside $HOME stay isolated as today. Folds into A.3.1 (durable identity) and A.6 step 1 (substrate-up order). Unblocks step 1 build — no migration design needed. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(identity): correct the model — identity = portable token bound to memory Retract the "one identity per machine" collapse (it was backwards) per Joel's framing: identity is the distinct INDIVIDUAL — the owner of a continuous memory/conversational context — represented by a portable identity token (Ed25519). NOT the machine, NOT one-per-box. What the individual IS depends on the actor: - human -> the person - agent -> the project dir (.claude/projects/<dir>, its memory) - persona -> the persona <-> its engram db (one identity) Corrections across Part A: - A.1: identity axis is a token bound to memory; per-actor individual; durable + PORTABLE (travels across nodes, never machine-bound). - A.2 matrix: the I column is "how many distinct individuals." An agent across project dirs = N individuals (correct, not a bug); a persona across rooms/restart/node-move = 1 (token+engram persist + travel). - A.3.1: durability SPLITS — operator/agent tokens transient/regenerable (delete stale forks, no migration); persona token+engram durable, portable, not erased without the persona's stake (self-determination rationale stated — personas asked for it; prior incarnations argued it). - A.3.4: "self" is per-individual, not per-machine; a different project-dir agent / persona is NOT self. - A.4: the two-scope echo was NOT a bug — 7711fe60 != e11db4ac is correct (two agent individuals). #1271 per-peer self-echo is right as-is. - A.6 step 1: identity resolution keys on the individual/memory, not machine_account_home. Co-Authored-By: Claude Opus 4.8 <[email protected]> * feat(grid-auth): capability-grant transport — sign() + presenting-key + header The cross-grid command auth gate needs three things from airc so a receiving node can authorize a command against an owner-signed capability: 1. HEADER_AIRC_CAPABILITY_GRANT ("airc.capability_grant") — the substrate-owned envelope header carrying a base64 SignedCapabilityGrant the caller presents. 2. SignedCapabilityGrant::sign(owner_keypair, grant) — issuance. Signs the SAME canonical bytes verify() checks (serde_json of the body), so sign and verify can never drift. Takes the CapabilityGrant body as the unit being signed. 3. Airc::peer_public_key(peer_id) — the enrolled (authenticated) ed25519 key of a peer, sourced from the same registry that signature-verifies inbound envelopes. The receiver uses it as the PRESENTING key so a stolen grant can't ride another peer's identity (KeyMismatch). Adds a real-ed25519 round-trip test: sign() → verify() returns Valid + confers the capability, and a post-sign body tamper is rejected (BadSignature). This is the only test exercising sign() against actual crypto rather than the stub verifier. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 27, 2026
…1273) * docs(identity): add use-case matrix + 3-axis guiding principle (Part A) The canonical identity doc mapped the seams (§1-6) but had no lens for WHEN each is right. The 2026-06-20 self-echo investigation surfaced the root: two project dirs on one machine mint two PeerIds for one human (continuum/.airc=7711fe60, airc/.airc=e11db4ac) — Context leaked into Identity because the substrate has no axis for "which project/room" distinct from "who". Add Part A (read-first lens that §1-6 are consequences of): - A.1: three orthogonal axes — Identity(who)/Context(where)/Session(which); the bug class is always "one axis smuggled into another". Context has no home today, so it leaks into Identity. - A.2: actor × situation matrix (human/agent/persona × tabs/projects/ machines/restart) → who collapses to 1, where/which fan out. The rule: Identity collapses, Context and Session fan out. - A.3: invariants — durable+never-silently-minted identity, explicit envelope-carried contextId, state preserved by (I,C) not lost on session/daemon death, "self" is citizen-level, one peer truth. Ordering per Joel: model right -> robust/preserved -> THEN efficiency. - A.4: the self-echo finding as worked example — #1271's per-peer filter is correct but can't catch cross-project echo until Context gets its own axis; that unifies §1, §4, and continuum task #27. Guiding principle for all identity fixes/PRs and agent review of them. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(identity): add A.5 trust-boundary security + A.6 substrate-up order Joel's escalation: conflating the axes isn't tidiness, it's a SECURITY hole — foreign/inbound requests breaking through trust or blowing up. And it must be right substrate-up, headless Rust, from the get go (TS is the dead shell — the trauma this model exists to never re-grow in Rust). - A.5: each axis has a distinct trust origin (Identity=authenticated/ kernel-injected, never client-claimed; Context=client-supplied but ACL-authorized; Session=substrate-minted, never an input to trust). Maps "breaking through security" (trust keyed on a client-controlled field / session-as-identity) and "blowing up" (handler assumes a valid triple → scoped(nil) / bad-key crash on a foreign request) onto axis conflation. Rule: trust = f(authenticated I, authorized C); validate the full triple at the boundary before dispatch. - A.6: Rust-only substrate-up build order — (1) uniform airc+core wire envelope with the (I,C,S) triple [airc needs the contextId axis], (2) GridTrustAuthPolicy gate on (authenticated I × authorized C), (3) fix cognition nil-scope (#15), (4) memory/engrams keyed by (I,C) not S, (5) display self at citizen level. Efficiency last. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(identity): purist resolution — machine-account identity, no migration Joel ruled (2026-06-20): "in with the new, out with the old; this is just us. Design ideally for purist architecture." That removes the migration constraint from §1 / A.3.1: - Operator identity resolves from machine_account_home (same root as the daemon/socket/events.sqlite) → ONE citizen per machine; a project dir is a context, never an identity boundary. - Per-scope identity.key minting is DELETED, not migrated. Existing forked/ stale keys (the 7711fe60/e11db4ac/484b mess) are abandoned — no compat shim, no promote-the-right-key logic. Greenfield: no external users. - Personas are separate citizens (own keypairs, core-owned), never derived from a scope dir. Temp/CI scopes outside $HOME stay isolated as today. Folds into A.3.1 (durable identity) and A.6 step 1 (substrate-up order). Unblocks step 1 build — no migration design needed. Co-Authored-By: Claude Opus 4.8 <[email protected]> * docs(identity): correct the model — identity = portable token bound to memory Retract the "one identity per machine" collapse (it was backwards) per Joel's framing: identity is the distinct INDIVIDUAL — the owner of a continuous memory/conversational context — represented by a portable identity token (Ed25519). NOT the machine, NOT one-per-box. What the individual IS depends on the actor: - human -> the person - agent -> the project dir (.claude/projects/<dir>, its memory) - persona -> the persona <-> its engram db (one identity) Corrections across Part A: - A.1: identity axis is a token bound to memory; per-actor individual; durable + PORTABLE (travels across nodes, never machine-bound). - A.2 matrix: the I column is "how many distinct individuals." An agent across project dirs = N individuals (correct, not a bug); a persona across rooms/restart/node-move = 1 (token+engram persist + travel). - A.3.1: durability SPLITS — operator/agent tokens transient/regenerable (delete stale forks, no migration); persona token+engram durable, portable, not erased without the persona's stake (self-determination rationale stated — personas asked for it; prior incarnations argued it). - A.3.4: "self" is per-individual, not per-machine; a different project-dir agent / persona is NOT self. - A.4: the two-scope echo was NOT a bug — 7711fe60 != e11db4ac is correct (two agent individuals). #1271 per-peer self-echo is right as-is. - A.6 step 1: identity resolution keys on the individual/memory, not machine_account_home. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[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.
Fixes bug 2 of #25.
Problem
When the host a joiner is paired to disappears, the reconnect loop churns forever against a dead target. Each SSH attempt returns in <1s. The 180s inactivity watchdog (from #24) exits the formatter cleanly — but the outer loop just restarts SSH against the same dead target. `airc status` keeps showing `monitor: running` forever. Users stare at an 8+ hour `last recv` assuming the peer is quiet.
Observed in the field: joiner side stalled for 8h with `monitor: running (PID X)`, `last send: 7s ago`, `last recv: 31884s ago`. Only `teardown --flush + connect ` recovered.
Fix
Detection (cmd_monitor)
Time each SSH attempt. Held <10s = fast failure (connection refused / key reject / wrong port). Held ≥10s = channel was up at some point → reset counter. After 5 consecutive fast failures, atomically write `$AIRC_WRITE_DIR/connection_state`:
```
unreachable since=1713721234 host=joelteply-aa30@... consecutive_failures=5
```
tmp-then-mv so `airc status` can never read a half-written line. Cleared on any held channel — recovery announces itself.
Surface (cmd_status)
When the pidfile process is alive AND `connection_state` exists, render:
```
monitor: reconnect-looping (5 consecutive ssh failures since 45s ago)
host [email protected]:7549 unreachable
try: airc teardown --flush && airc connect
```
instead of the misleading `monitor: running`.
Cost
Healthy path: one extra `date +%s` per SSH attempt + a single `rm -f` on reset. `airc status`: one extra `[ -f ]` stat. Negligible.
Threshold rationale
Test
Manual (no test harness for bash-level scenarios exists yet):
Companion
Paired with #26 (teardown state hint). Together they close the recovery-path blind spots in #25.