Repository navigation
fix(#84): positron carries human chat turns (Case A completeness) + glass-box probe - #1743
Merged
Merged
Conversation
… seam Task #84 asks to "stream persona turns into the room live (continuum side of the bus)". Investigation proves the stream ALREADY works end-to-end; what was missing was the observability to prove it and the pinning of a long-standing "Asha's reply vanishes" symptom. Root cause of the symptom (read-surface fragmentation, NOT a write gap): persona `conversation.say()` writes a plain `Body::Text` message onto the airc daemon transcript ONLY. It does NOT write the `chat_messages` ORM collection (which `chat/poll` reads) nor the continuum realtime store (which `airc/realtime-replay` reads). So those two surfaces are structurally blind to persona turns — the prior session was reading the wrong surfaces. The correct, complete surface is positron `ChatViewState`, fed via: persona say → airc daemon transcript → inbound_attach::publish_transcript_event → chat_posted_from_message → `chat:posted` bus event → positron ChatProjection::classify → apply_message → ChatViewState snapshot in the Substrate → WS client (kind="chat") This probe sits at the exact seam where a persona turn becomes the `chat:posted` event the client read surface is fed from — making the turn stream glass-box (did the say traverse daemon→attach→bus?). Evidence it captures (live-run, this seam): - full-transcript replay: 1198 projections (Asha 90e758b2 = 496, Solenne 0d3209a1 = 345, peers the rest) - live post-boot: a fresh airc post projected at the seam immediately, proving the live path (not just replay) reaches positron Consequence for the three-panel client (#29): read positron `ChatViewState`, NOT `chat/poll`. `chat/poll` (ORM) is a legacy, persona-turn-blind surface; do not dual-write persona says into it (that would add a parallel write path against the compression principle). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…eness) The positron ChatViewState carried persona `say` + external airc peer posts but silently DROPPED human `chat/send` turns. A human message publishes a `chat_transcript` envelope (Body::Json), which reached Case A → `bus_event_from_envelope` → None (schema != EventBridgePayload) → dropped. So the room showed persona replies to structurally-invisible questions — the exact blindness `perceptual_from_event` documents and fixed for perception ONLY, never for the positron read surface. Fix, compression-correct (one decoder, two consumers): - Extract `chat_transcript_message` — the ONE decoder for the `chat_transcript` wire shape — as a sibling of `bus_event_from_envelope` in realtime_wire. Recovers (logical sender, text); sender falls back to the relaying transport peer (attribution recovery, not fabrication). - Refactor `perceptual_from_event` (perception) to route through it, deleting its inlined duplicate decode. - Add `chat_posted_from_envelope` (positron projection) routing through the same decoder; wire it into inbound_attach Case A so a `chat_transcript` envelope projects to the SAME thin `chat:posted` the plain-text sibling emits (identical messageId/roomId/timestamp facts). - Probe class `airc.chat.projected` on the new arm. Converges on ONE `chat:posted`, two wire shapes — the send-side mirror of `perceptual_from_event`'s two receive paths. positron is now the COMPLETE read surface (persona + human turns), the solid ground for the three-panel UI (#29). Tests (all green, zero regressions across 11 neighboring tests): - realtime_wire: decoder recovers sender+text / falls back to relay peer / non-chat_transcript → None. - inbound_attach: `chat_transcript` envelope projects `chat:posted` with logical sender (not transport peer), identity-free like its sibling. - perceptual: refactored path still perceives with true sender. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
The Case A refactor moved perceptual_from_event's inline decode into the shared chat_transcript_message decoder (which uses fully-qualified serde_json::Value::as_str), removing the file's only bare Value uses. Drop the now-dead `use serde_json::Value;`. Zero-warnings doctrine. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
What & why
The positron
ChatViewState— the read surface the three-panel UI (#29) willbuild on — was incomplete: it carried persona
sayturns and external aircpeer posts, but silently dropped human
chat/sendturns.A human message publishes a
chat_transcriptenvelope (Body::Json). At thepublish_transcript_eventCase A branch,bus_event_from_envelopereturnsNone(schema ischat_transcript, notEventBridgePayload) → the turn wasdropped before ever reaching
chat:posted. So the room rendered personareplies to structurally-invisible questions — the exact blindness
perceptual_from_eventdocuments and had fixed for persona perception only,never for the positron projection.
The fix (compression-correct: one decoder, two consumers)
chat_transcript_message— extracted as the ONE decoder for thechat_transcriptwire shape, a sibling ofbus_event_from_envelopeinrealtime_wire.rs. Recovers(logical sender, text); sender falls back tothe relaying transport peer (attribution recovery of a present-but-relayed
identity, not a fabricated default — [[fallbacks-are-illegal-fail-loud]]).
perceptual_from_event(perception) refactored to route through it,deleting its inlined duplicate decode.
chat_posted_from_envelope(positron projection) routes through the samedecoder; wired into Case A so a
chat_transcriptenvelope projects to thesame thin
chat:postedthe plain-text sibling emits (identicalmessageId/roomId/timestamptranscript facts, identity-free).airc.chat.projectedon the new arm (the original glass-box probe).Converges on ONE
chat:posted, two wire shapes — the send-side mirror ofperceptual_from_event's two receive paths (#8). positron is now the COMPLETEread surface (persona + human turns) — solid ground for #29.
Tests (all green, zero regressions)
realtime_wire: decoder recovers sender+text / falls back to relay peer /non-
chat_transcript→None.inbound_attach:chat_transcriptenvelope projectschat:postedwith thelogical sender (not the transport peer), identity-free like its sibling.
perceptual: refactored path still perceives with the true sender.inbound_attach/perceptualtests unchanged and green.🤖 Generated with Claude Code