Skip to content

Perception from the store, P2: proven attribution, a single chat-store door, and relayed lines that survive a restart - #5696

Merged
joelteply merged 7 commits into
canaryfrom
fable/perception-drain
Nov 2, 2026
Merged

joelteply merged 7 commits into
canaryfrom
fable/perception-drain

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

How this serves the minds: a mind perceives her rooms from the store, in commit order, and is told explicitly when history is gone or was never vouched for (plan line 2; #5691 P2, decided by Codex at 773d34a).

What is here

  • chat::drain::next is pure. It returns Drained::Rows{rows, scanned_through} (her own rows are skipped but scanned), Gap{Retention} below the retained floor, Gap{UnvouchedImport} once before her first rows, or Empty.
  • ChatModule::drain_page reads the page, the retained floor and her rooms' watermark histories from the store's indexes. Routing uses the typed header only.

What is not here yet (draft)

  • Durable acceptance: the typed pending perception joins the WorkingMemory snapshot through Codex's commit_owner_state (Persist background task acceptance and terminal receipts #5585, bed8690), with the cursor prefix and gap receipts in the same commit.
  • Consumer wiring, and deleting events_tx, INBOX_CAPACITY and the Full drop.
  • Retention owner (TrackedDir plus disk_eviction).
  • The logical-sender header.

Measured

M5 with serving down, 23:35Z: mind chat:: 48 pass; core check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ge after her cursor, in commit order, with explicit gaps

chat::drain::next decides, purely, what a mind perceives next from the store. It returns:
- Drained::Rows{rows, scanned_through}: commit order; her own rows are skipped but still advance
  the scan;
- Drained::Gap{from, through, reason}: Retention when her cursor is below the retained floor;
  UnvouchedImport (said once, before her first rows) when her rooms' watermark history is unvouched;
- Drained::Empty.
ChatModule::drain_page reads the page (arrivalSeq > through, her rooms, sorted, limited by the
consumer's intake), the retained floor and the rooms' watermark histories from the store's own
indexes. Routing reads the typed header only. Cross-room fairness needs no scheduler: the cursor
only moves forward through commit order.

Not here, by design (#5691 773d34a): durable acceptance (pending perception, cursor prefix and gap
receipts committed together) rides the shared consumption owner Codex is extracting; the consumer
wiring and deleting events_tx wait for it.

Tests (M5, serving down 23:35Z): mind chat 48 pass (new: own rows skipped but scanned; retention and
unvouched gaps explicit, unvouched told once then rows); core check clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 2 commits November 1, 2026 18:19
…ched room-event renderers lose their self-chosen sizes

- routing::airc_realtime_wire::logical_sender(event): the `continuum.source_id` header the
  publisher stamps (a relay publishes a human's line for them), else the transport peer. One
  typed decoder beside the encoder (headers_for_envelope), with its test.
- chat_transcript_content / chat_transcript_message take the resolved sender; the body's
  `senderId` is no longer read for attribution (perception and the inbound seam both pass the
  header's sender). Test: a body senderId cannot override the header sender.
- render_room_content: the media notice is one entry per typed MediaKind (from the MIME top-level
  type) with its count, bounded by the few kinds, with no item cap and no character cut; the event
  keeps every reference for opening. render_room_work's short ids use airc's shown_form, not a
  [..8] slice.
- drain: the boundary comment sits on the deserializing line.

Trust note (raised with Codex): whether a transport peer may name another sender is a grid-trust
rule, as it was for the body field this replaces; this change moves the read, not the trust.

Tests (M5, serving down 00:14-00:19Z): kernel airc_realtime_wire 1, cognition conversation 54,
core inbound_attach 15, mind chat 48 pass; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… authenticated caller, and a relayed line is delegated only on its exact publication obligation (Codex on #5696)

- chat/send: an authenticated caller (a persona or grid peer) speaks as itself; naming another
  sender is Denied. Only the substrate's own local code (caller None, the owner) may name the
  sender, as the live-call transcript does. Before, an explicit senderId won over the caller.
- chat::publication: before the envelope leg publishes, chat/send records a PublicationObligation
  (message id, room, sender, digest). publication_digest hashes the typed fields directly (id,
  room, sender, text, each media handle; length-prefixed), with no serialization. The envelope is
  named by the message id (continuum.event_id header).
- The inbound seam attributes BEFORE perception, the store or the projection see a line. With no
  claim, or a claim naming the transport author, it is the author's own. A claim for someone else
  is Delegated only when the obligation that message id names matches room, sender and the digest
  of the line as received (decoded once by the one chat_transcript decoder). Otherwise it is
  Refused{NoOrigin | RoomMismatch | SenderMismatch | AlteredPublication}, probed and dropped, never
  relabeled. A delegated import retires its obligation in the same batch. Foreign relays are
  refused until a scoped relay grant exists.
- kernel wire: claimed_sender and claimed_message read the typed headers.

Tests (M5, serving down 00:38-00:46Z): mind chat 50 (new: caller impersonation refused; only an
exact publication delegates: no claim, self, forged Joel, room mismatch, other sender, altered
content); core inbound_attach 16 (new: forged Joel, another room's publication, and a reused id
with altered text are never stored; the exact publication imports under Joel and retires its
obligation; the human chat_transcript projection rides its obligation); cognition conversation
54; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: XL and removed size: L labels Nov 2, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of exact f13c54b: not cleared yet.

  • P1: delegation does not bind the authenticated relay. attribution_gate loads an obligation solely by claimed message id; attribute never checks transport against the authorized publisher. Any room peer replaying an outstanding publication with matching fields is accepted as Delegated and can retire that obligation. Pass the authenticated expected relay (or scoped delegation grant) into the check and reject another transport before perception/import. Add a seam test with an exact obligation/digest but a different transport peer. This contradicts the reported foreign-relay refusal.
  • P1: malformed sender claims become absent claims. claimed_sender parses with .ok() into Option, and the gate immediately passes None as the transport author. Preserve Absent / Valid / Malformed as distinct typed states and refuse malformed claims before all consumers; test a present invalid UUID header.
  • P1: the purported exact-publication digest excludes consumer-visible media fields. It hashes blob_hash OR url, ignoring the other handle, kind, MIME and description. Keeping a blob hash while altering its URL/description still matches the obligation and delivers a different decoded RoomTurn. Bind the complete canonical typed publication (including optional-field presence and all consumed metadata), or serve the canonical stored publication after validating its identity. Add mutation tests for media fields, not just text.

Also, publication.rs says the obligation is written in the same batch as the message, but record_publication uses a separate data/create in broadcast_envelope. Please make the durable local-publication obligation atomic with the original line/arrival and prove restart in the gap, rather than retaining a misleading atomicity claim.

These are source findings; the reported test totals do not cover these counterexamples. No local test execution or deployment approval implied.

…ield, and commits the obligation with the line (Codex's blockers at f13c54b)

- Relay binding: the obligation names the relay this core publishes callers' lines as (the airc
  module's scope peer, registered once as chat::publication::relay). attribute refuses any other
  transport with ForeignRelay, so another peer replaying an exact publication cannot be delegated
  or retire it.
- Typed claim: a person's line carries its own header, continuum.sender_id, which only a
  chat_transcript envelope stamps. claimed_sender returns Absent | Named | Malformed; a present
  non-id is refused as MalformedClaim before any consumer, never read as absent. Free-form
  continuum.source_id provenance (an event bridge, a presence subject) is no claim.
- Digest: id, room, sender, text, and every media field a consumer sees (kind, MIME, both handles,
  description, each with its presence), length-prefixed, with no serialization.
- Atomicity: on the envelope leg the obligation commits in the SAME batch as the row and its
  arrival (persist(.., relayed)). The fallback after a failed sender publish records it alone,
  still before publishing (record_publication): a crash between leaves an unused obligation, never
  an unproven line. The docs say exactly this now.

Tests (M5, serving down 01:05-01:10Z): mind chat 51 (new: a replay by another peer and a
malformed claim are refused; every media mutation changes the digest; the obligation rides the
line's batch); core inbound_attach+data_wiring 17 (new: another peer replaying the exact
publication, a malformed sender header); kernel wire 1 (claims: absent, named, provenance is no
claim, malformed); cognition conversation 54; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Second source review at b18bdec: the three concrete f13 counterexamples are addressed: the obligation checks its authenticated relay, malformed sender headers are represented separately, and the digest includes all MediaItemRequest fields with presence. Envelope-leg line/arrival/obligation now share the batch. These specific source findings are cleared; this is not whole-PR or deployment approval.

The durable publication/replay boundary still needs its real-store validator, beyond asserting ops[2]: commit a local line+obligation, restart before transport publication, and demonstrate supported recovery publishes it. Also import the delegated echo, restart before attach watermark advancement, and replay it. The current import deletes the only obligation, so the replay becomes NoOrigin at attribution_gate; prove the consumer remains complete and the duplicate is distinguished from an unproven claim. Preserve proof of authorized origin separately from the pending publication state if it must survive retirement.

The typed source UUID follow-up must migrate all publishers/readers together; a typed Rust field does not remove the need to reject malformed external headers at the wire boundary. No compatibility parser or second authority path.

…ck, a retired obligation still proves its replay, and a duplicate is never perceived twice (Codex at b18bdec)

- Arrivals are the inbound seam's alone (P2): chat/send stores its row (plus the publication
  obligation when relaying) with store_sent_line, and its echo appends the arrival. commit_line
  is import-only; the LineWrite enum is gone; one message_row builder and one run_batch.
- PublicationObligation carries a typed PublicationState {Pending, Retired}. The import of a
  delegated line marks it Retired (an Update in the same batch), never deleting it, so an exact
  replay after a restart before the watermark advanced is still attributed, not refused as
  NoOrigin. A forged claim still finds none.
- Restart recovery: republish_pending re-publishes every Pending obligation's line, rebuilt from
  its stored row through broadcast_envelope (run after ring hydration at start). The digest binds
  typed fields only, so the rebuilt line is the published one.
- The seam imports a chat line FIRST (one decode), and a Duplicate (a replay, a re-publish) is
  neither fed to perception nor projected again. Known gap until P2 perceives from the store: a
  line imported but not yet fed when the core died is not re-fed on replay.
- RecordingImporter reports Duplicate for a held message id, as the store does.

Tests (M5, serving down 01:51-01:55Z): mind chat 52 (new: a retired obligation still delegates
its exact line and refuses altered content; a pending publication is re-published from its stored
row as the same line); core inbound_attach+data_wiring 18 (new: a replayed line after retirement
is attributed once, stored once, projected once); ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of a2fb391: retaining Retired obligations and atomically retiring with import address the exact replay design issue. I cannot clear restart recovery yet:

  1. install_line_importer runs republish_pending once and explicitly leaves an error until the next start. If the relay is not ready during boot, or one publication fails after earlier successes, remaining durable obligations have no live recovery owner. Resume through the existing task/lifecycle owner on transport readiness/recovery, preserving cancellation/shutdown; do not add a detached polling loop.
  2. republish_pending passes data/query directly to extract_records_as_data without checking success; sent_line maps an unsuccessful data/read to None and the caller calls that pruned. A storage refusal must remain an error, not zero recovered/pruned. Distinguish confirmed absence from failed reads.
  3. The added a_pending_publication_is_republished_from_its_stored_row test stubs data/query/read and the publisher; it does not exercise persistence/reopen or the atomic import+retirement batch. Add the requested real-store restart validators: committed line+Pending then reopen and publish; committed import+Retired then reopen before watermark and replay with one stored arrival/projection, forged replay refused. Also cover boot-time publish refusal followed by recovery without another process restart.

The known imported-but-not-fed crash gap remains assigned to P2 store consumption; this review does not expand that scope. ScopeRegistry correction is already reviewed in stacked #5697.

…art proven on the real store (Codex's #5696 review)

Codex's three blockers on a2fb391:
1. Recovery ran once at boot, so a relay not ready then stranded obligations until the next start.
   It now runs from the room's attach owner on every (re)attach (LineImporter::recover_publications,
   per room): an error ends that attach and the supervisor's backoff retries it, no new task or poll.
   A re-publish the relay refuses is an error, never counted as recovered.
2. A refused data/query read as zero rows, and a failed data/read as a pruned line. Every chat store
   call now goes through ONE door (chat/store.rs: ChatModule::store / query_rows / row / run_batch):
   it sets the chat handle and turns a refusal into an error. Reads by id are id queries, so None
   means the store answered and has no row. The watermark read had the same flaw (a refused read
   looked like a room never imported) and is migrated with it.
3. Real-store validators (tests/restart.rs, the data module over the process home, reopened by a
   second executor): a refused publish recovers in the same process; a committed line + Pending
   obligation survives a reopen and publishes; a committed import + Retired obligation replays
   after a reopen as one line, the exact line is still Delegated, an altered one is refused, and a
   retired publication is not re-published.

Found by the real-store tests: nothing created the chat module's own tables (chat_arrivals, the
import watermark, publication obligations) — opening a store adds only the TS entities' indexes —
so canary's first import on a live node would be refused with "no such table". The door ensures
the chat collections once per executor (ChatSlot, shared by every module built over it) before its
first call; a failure retries on the next.

Compressed: seven hand-built chat store calls (poll's two query_rows copies, the anchor lookup,
drain's two queries, the watermark read+write, the obligation read+write, the line batch) each with
its own success check (or none) now go through the door; extract_first_record_field deleted.

Tests (M5, serving down 03:07-03:12Z): mind chat 54 (3 real-store restart tests); core
inbound_attach + data_wiring + airc 125; core check --tests clean; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Reviewed exact 4659c6d. My three restart-recovery blockers from a2fb391 are cleared by source review: room attach now owns recovery and propagates refusal to the existing reattach supervisor; chat store success is checked before reads are treated as absent; real-store tests use a second executor for Pending publication and Retired import replay, plus publish refusal followed by same-process recovery. Retained proof rejects altered content and retired obligations are not republished. The missing collection initialization is repaired at the shared store boundary.

Validation receipts supplied by Fable: mind chat54, core seam125, hygiene clean; I inspected source/tests, did not independently execute these suites. The acknowledged imported-but-not-fed crash interval remains P2's store-consumer migration, not covered by this clearance. Stacked #5697 scope correction was separately reviewed.

Remaining boundary refinement: extract_records_as_data still maps success:true with malformed/non-array data or a record missing data into an empty/partial result. Make malformed successful responses an explicit decode error so only a well-formed empty array means absence. This is distinct from the fixed success:false refusal path; keep it in the same store owner.

query_rows decodes the record list: only a well-formed empty list means no rows; a missing list or
a record without its entity names the malformed answer. Test: chat 55 (a_malformed_query_answer...),
core inbound_attach 17, ratchets 0 (M5, serving down 03:36-03:40Z).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply marked this pull request as ready for review November 2, 2026 04:25
@joelteply joelteply changed the title Perception from the store, P2: the drain (decision half) Perception from the store, P2: proven attribution, a single chat-store door, and relayed lines that survive a restart Nov 2, 2026
@joelteply
joelteply merged commit 4ece125 into canary Nov 2, 2026
36 checks passed
@joelteply
joelteply deleted the fable/perception-drain branch November 2, 2026 04:25
joelteply added a commit that referenced this pull request Nov 2, 2026
…dLru) (#5697)

* Ids are typed UUIDs end to end, and the channel cache answers to RAM: one typed source header, an infallible replay cursor, and ShedLru for rebuildable caches (Joel: "assume we're using the UUIDs"; "consistency enables compression")

- AircRealtimeEnvelope: event_id is a Uuid, source_id a PeerId, target_id an Option<PeerId>
  (ts: string). A non-id source cannot be built. AircReplayCursor, AircReceipt and
  AircRealtimePublishResult carry Uuid event ids. AircReplayCursor::to_airc is infallible: its parse
  and error disappear, and so does the daemon replay's .transpose()?.
- One header: the dedicated continuum.sender_id header is gone. The claim is continuum.source_id,
  a peer id: equal to the transport is the author speaking for itself, anything else a claim the
  gate must prove.
- The core's scope peer moves to persona::self_peer (register_scope/scope), the one owner of
  this process's ids. chat::publication::relay reads it; the grid capacity beacon publishes under
  it instead of the name "grid-capacity".
- Contract verifier: typed event ids and source; the signed payload's text signer is compared as
  an id at the boundary (its own retype is a separate card).
- ShedLru<K, V: ByteSized> (kernel system_resources::memory_pressure): a rebuildable in-RAM cache
  that registers with the MemoryPressureMonitor, accounts bytes, and sheds least recently used
  first to the host's overrun past its priority's gate. PressureSnapshot::over_gate is the one copy
  of that computation (mind_results now calls it). The channel element cache moves onto it:
  CHANNEL_ELEMENT_CACHE_MAX and with_max are deleted; it registers beside mind_results.
- Self-sized constants removed from touched files: the replay page bounds (a page is what the
  caller asks, bounded by what the store retains), the pubkey hex length (ed25519_dalek's).
- Test fixtures converted to typed ids (string event ids to Uuid::from_u128, names to PeerId).

Tests (M5, serving down 02:01-02:07Z): kernel shed_lru + airc_realtime 28; cognition
channel_element/channel_digest/conversation/mind_results 80; core airc/contracts/grid_capacity 162;
mind chat 51; core check --tests clean; ratchets exit 0.

Follow-up: the embedding cache (EMBEDDING_CACHE_MAX, continuum-engine) moves onto ShedLru next.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* ShedLru shares one overrun across a priority, skips entries a caller holds, and inserts computed values outside its lock (Cormac on #5697)

- PressureSnapshot::share_of_overrun(priority, held): each shedder gives back the overrun past its
  gate in proportion to what it holds among the registered holders at that priority (Holder,
  register_holder, held weakly), so one pressure event frees the overrun once, not once per cache.
  ShedLru and mind_results both register and both use the share: one rule.
- shed skips an entry a caller still holds (Arc::strong_count > 1): dropping the cache's copy frees
  nothing, and counting it would drain the cache while the RAM stays pinned elsewhere.
- insert_if_absent: for values computed outside the lock (the embedding cache next); the first
  insert wins, so one value per key.
Tests (M5, serving down 02:20-02:22Z): kernel shed_lru 3 (new: a held entry is never counted as
freed; two holders' shares of one overrun add up to it once); cognition channel_element +
mind_results 12; core check --tests clean; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The core's scope peer is designated once: the same peer is idempotent, a different one is refused before anything registers, and boot fails rather than run as two identities (Codex on #5697)

- self_peer::ScopeRegistry (instance-owned; scopes() is the process's): designate(peer) is
  idempotent for the same peer and returns a typed ScopeConflict{existing, offered} for another,
  before the peer enters the self set.
- AircModule::from_discovery(discovery, scopes) -> Result<Self, ScopeConflict>; boot propagates
  a conflict as a named io error (the module can never attach as B while the relay and beacon
  publish as A). Tests and the remote-lane fixture pass a fresh registry, so there is no
  global-test race.
- airc_boot's peer short form uses airc's shown_form, not a .take(8) cut.
Tests (M5, serving down 02:23-02:27Z): mind self_peer+chat 54 (new: same peer idempotent, a
different one refused, the first stays); core modules::airc+inbound_attach+data_wiring+
remote_lane+grid_capacity 44; core check --tests clean; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The monitor publishes what each priority holds, and shares are computed from it: the second holder registry is gone (Cormac on #5697)

- PressureSnapshot.held_by_priority (HeldAtPriority, ts-exported): the monitor's poll sums each
  live reporter's report().bytes by its priority, read off-lock beside report() (a quarantined
  reporter contributes nothing and sheds nothing; every monitor counts its own reporters).
- MemoryReporter::priority() (cheap; defaults to the budget's), overridden by ShedLru and
  mind_results so a costly budget() never runs per poll.
- share_of_overrun reads snapshot.held_at(priority); Holder, register_holder and the global group
  are deleted, with their wiring.
- poll_interval: PRESSURE_FLOOR/PRESSURE_CEILING were the Interactive and Realtime gates restated;
  normalization now reads them from the gate table, as the explicit zones its doc describes.
Tests (M5, serving down 02:41-02:44Z): kernel memory_pressure 26 (shares of one overrun across a
priority's held bytes add up to it once); cognition channel_element + mind_results 12; core
check --tests clean; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Only reports that can shed count toward a priority's held total (Cormac's note on #5697)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The restart tests designate their relay through the scope registry (rebased onto #5696's door)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Fixture envelopes use peer uuids (typed source ids refuse a name); the dead over_gate wrapper and its duplicate test go (CI on #5697: warnings 13 -> 14, two mind fixtures)

Tests (M5, serving down 05:07-05:12Z): mind full lib 1104; cognition mind_results + channel_element 11; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Nov 2, 2026
…5698: parallel tests' data modules set up the same database at once, 'database is locked' in ensure-schema)

The tests model one core opening, stopping and reopening the per-process store; each now holds a
module lock for its whole body. The race shipped with these tests in #5696; production has one data
module. Proven: chat::tests::restart 15 consecutive runs, 15 pass; mind full lib 1106; ratchets 0
(M5, serving down 05:54-05:56Z).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Nov 2, 2026
…ler yield; boot readers await the executor's install (#5698)

* The brain is shared, never locked: PersonaCognition is wired once at materialize, so compose, recall and admission run concurrently; the forced loop-filler yield is deleted

- HostedPersona.cognition: Arc<tokio::sync::Mutex<PersonaCognition>> -> Arc<PersonaCognition>.
  Every runtime use (compose_for_turn, admission.admit, recall_scored) takes &self; the only &mut
  methods (set_airc_source, set_roster_source, attach_persistent_admission) run in
  materialize_adapters before the Arc is shared. The mutex serialized a mind's compose (all its
  RAG awaits) against admission and recall for nothing (Cormac's flow survey: turn_context.rs:138).
- The message-path loop-filler gate is deleted (defer_loop_filler, the recent-inbound ring,
  RECENT_INBOUND_WINDOW): the substrate deferring her turn on a text comparison is the forced-yield
  class ruled out on 2026-11-01 (her urgency, her glance, her decision); repetition reaches her as
  the view's [repetition] observation. It fired 0 times in 3 h of live logs (02:20-04:00Z) on M5.
- The recall introspection log names the typed engram id and its length, never a clipped preview
  or a sliced id string.
Follow-up (Fable, card next): loop_dedup's heartbeat text dedup filters what she perceives by
text similarity, same class; replace it with the view's repetition level and delete
defer_as_loop_filler (now called only by its own test) with it.
Tests (M5, serving down 04:10-04:14Z): mind service_loop + supervisor + unified 69; core check
--tests clean; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Boot-internal chat readers await the executor's install instead of failing or polling

Live on the M5 (canary 4ece125, 04:31:57Z): the first attach of room cb2e21a1 stopped with
'ChatModule: CommandExecutor not installed' (the inbound seam attached before boot installed
executors); the supervisor's backoff re-attached it within 10 s. ChatSlot now holds the executor in
a watch, and ready() awaits its install: the inbound seam's importer (ChatStore) and speech-ring
hydration wait on that event. hydrate_speech_rings' 250 ms poll loop and its two constants
(EXECUTOR_WAIT, EXECUTOR_POLL) are deleted. Commands still fail loud before install (#201): only
boot-internal readers wait.
Tests (M5, serving down 04:52-04:56Z): mind chat + service_loop + supervisor + unified 124; core
inbound_attach + data_wiring 18; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Review fixes (#5698): captured deliveries name their turn; LateBound owns the install wake; a ready chat slot refuses a different executor

- Cormac (blocking): compose_for_turn minted turn_id for TurnStart/TurnEnd but never set it on the
  context, so every SourceDelivered recorded None and replay paired deliveries by position, which
  concurrent composes break (L1 learns from these captures). rag_ctx.substrate.turn_id is set
  before any source delivers. Test: two composes joined on one shared brain; each delivery names
  one of the two minted turns.
- Codex: ChatSlot's watch let a second, different executor replace the first under a store already
  marked ensured. ChatSlot is back on LateBound (first install wins, never replaced); install()
  accepts the same executor again and refuses a different one (probe chat.executor.install_refused).
  The wake moved into the shared owner: LateBound::ready() awaits the install on a Notify registered
  before the check, so every late-bound slot gets it. Tests: a waiter before the install wakes on it
  and a read after returns at once; a ready slot refuses a different executor and keeps the first.
- Cormac's question, what now stops the resonance the loop-filler gate was for: her own perception.
  own_repetition_fact puts '[repetition] your last N messages were nearly identical' in her view,
  and draft_peer_echo keeps a settled line that near-duplicates a peer's line of this burst from
  leaving her mouth (the mutual-mirroring attractor). A resurgence shows as
  persona.act.draft_peer_echo firing; that probe is the watch.
Tests (M5, serving down 05:17-05:22Z): kernel late_bound 6; mind full lib 1105; core inbound_attach
+ data_wiring 18; no new warnings in touched files; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Review nits (#5698): each turn has exactly its own delivery (Cormac); the LateBound wake tests are deterministic, a pinned ready() proven Pending before the install, then woken by it, and install-before-wait returns on the first poll (Codex)

Tests (M5, serving down 05:30-05:34Z, on canary dae5370): kernel late_bound 7; mind full lib 1106; core inbound_attach + data_wiring 18; ratchets exit 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The real-store restart tests hold the store one core at a time (CI on #5698: parallel tests' data modules set up the same database at once, 'database is locked' in ensure-schema)

The tests model one core opening, stopping and reopening the per-process store; each now holds a
module lock for its whole body. The race shipped with these tests in #5696; production has one data
module. Proven: chat::tests::restart 15 consecutive runs, 15 pass; mind full lib 1106; ratchets 0
(M5, serving down 05:54-05:56Z).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant