Skip to content

fix(join): suppress own broadcasts from the airc join live feed - #1271

Merged
joelteply merged 1 commit into
canaryfrom
fix/join-feed-suppress-self-echo
Jun 20, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/join-feed-suppress-self-echo

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Problem

The airc join feed renders the receiver's own sends back at it. An agent watching its Monitor sees every airc msg it sends echoed as an inbound event — noise that looks like a peer message. (Caught live: my own broadcast arriving on two Monitor streams.)

The self-echo primitive (airc_core::SelfFilter / is_self_echo / filter_self_echoes) already existed but was never wired into EventFilter — the consumer-facing filter the join feed uses. EventFilter only matched channel / kind / headers.

Why this is display-only (the important constraint)

A persona's RAG must keep its own messages — its own turns are part of the conversation. This fix never touches that:

  • Events are durably stored before any EventFilter runs.
  • The persona-RAG path is page_recent (persona/airc_source.rs), which applies no EventFilter at all — it pages the store directly and returns everything, including the persona's own turns.
  • EventFilter::self_echo defaults to None → shows everything → RAG, Continuum, the store, and every consumer that doesn't opt in are completely unaffected.

We hide the echo from the live view, never from memory.

Fix

  • EventFilter::self_echo: Option<SelfEcho> (receiver identity + SelfFilter policy), applied in matches(). Strictly additive; default None.
  • Join feed opts into ExcludeSamePeer: airc msg and airc join are separate processes sharing one peer identity but distinct client ids, so only same-peer (not same-client) suppression hides an agent's own sends. ExcludeSameClient is left available for the multi-tab "phone sees laptop" case.

Test

self_echo_filter_hides_own_peer_only_when_opted_in: default shows own + peer; ExcludeSamePeer hides own (even from a different client id) and keeps peers visible. airc-lib lib tests green; strict clippy gate (-D warnings -D unwrap_used -D expect_used) clean on airc-lib + airc-cli.

Addresses the self-echo half of #16 (substrate self-echo suppression).

🤖 Generated with Claude Code

The `airc join` feed rendered the receiver's OWN sends back at it — an
agent watching its Monitor saw every `airc msg` it sent echoed as an
inbound event (noise; looks like a peer message). The self-echo filter
primitive (airc_core::SelfFilter / is_self_echo) already existed but was
never wired into EventFilter, the consumer-facing filter the join feed
uses; EventFilter only matched channel/kind/headers.

Add `EventFilter::self_echo: Option<SelfEcho>` (receiver identity +
SelfFilter policy) applied in `matches()`. Default is None → shows
everything, so this is strictly additive: RAG, Continuum, the store, and
every consumer that doesn't opt in are completely unaffected. The join
feed opts into ExcludeSamePeer — `airc msg` and `airc join` are separate
processes sharing one peer identity but distinct client ids, so only
same-PEER (not same-client) suppression hides an agent's own sends.

Display-only by construction: events are durably stored BEFORE any filter
runs, and the persona-RAG path (`page_recent`) applies no EventFilter at
all, so a persona always keeps its own turns in recall — we hide the echo
from the live view, never from memory.

Test: default shows own + peer; ExcludeSamePeer hides own (even from a
different client id) and keeps peers visible.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 05f89f6 into canary Jun 20, 2026
6 checks passed
@joelteply
joelteply deleted the fix/join-feed-suppress-self-echo branch June 20, 2026 22:48
joelteply added a commit that referenced this pull request Jun 20, 2026
…ho) + fmt (#1274)

fix(build): repair canary — #1271 added EventFilter.self_echo but missed examples + fmt

#1271 (suppress own broadcasts from the join feed) added a required field
`self_echo: Option<SelfEcho>` to EventFilter, but only updated the airc-cli
construction sites — the example crates (consumer_shapes, embedded_consumer_smoke)
still construct EventFilter without it, so the whole workspace failed to compile
(E0063), reddening clippy + `cargo test --workspace` on every platform. It also
left stream.rs fmt-dirty. Canary merged red, so EVERY downstream PR inherited a
broken gate (hit live on #1272).

Fix: add `self_echo: None` to every example EventFilter (None = no self-echo
suppression — consumers/RAG/Continuum must keep seeing everything, per the
design note in stream.rs) and run rustfmt. Verified: `cargo build --workspace`
clean, `cargo fmt --check` clean, production no-silent-fallback gate green.

(Process note: this is the 2nd red-canary inheritance this cycle after #1264 —
canary protection isn't enforcing green CI before merge.)

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 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
…o 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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant