Skip to content

fix(#84): positron carries human chat turns (Case A completeness) + glass-box probe - #1743

Merged
joelteply merged 3 commits into
canaryfrom
fix/84-persona-turn-stream-observability
Jul 3, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fix/84-persona-turn-stream-observability

Conversation

@joelteply

@joelteply joelteply commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

What & why

The positron ChatViewState — the read surface the three-panel UI (#29) will
build on — was incomplete: it carried persona say turns and external airc
peer posts, but silently dropped human chat/send turns.

A human message publishes a chat_transcript envelope (Body::Json). At the
publish_transcript_event Case A branch, bus_event_from_envelope returns
None (schema is chat_transcript, not EventBridgePayload) → the turn was
dropped before ever reaching chat:posted. So the room rendered persona
replies to structurally-invisible questions — the exact blindness
perceptual_from_event documents 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 the
    chat_transcript wire shape, a sibling of bus_event_from_envelope in
    realtime_wire.rs. Recovers (logical sender, text); sender falls back to
    the 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 same
    decoder; wired into Case A so a chat_transcript envelope projects to the
    same thin chat:posted the plain-text sibling emits (identical
    messageId/roomId/timestamp transcript facts, identity-free).
  • Probe class airc.chat.projected on the new arm (the original glass-box probe).

Converges on ONE chat:posted, two wire shapes — the send-side mirror of
perceptual_from_event's two receive paths (#8). positron is now the COMPLETE
read 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_transcript envelope projects chat:posted with the
    logical sender (not the transport peer), identity-free like its sibling.
  • perceptual: refactored path still perceives with the true sender.
  • 11 neighboring inbound_attach/perceptual tests unchanged and green.

🤖 Generated with Claude Code

… 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
@joelteply joelteply changed the title observability(#84): glass-box probe at persona-turn → chat:posted seam fix(#84): positron carries human chat turns (Case A completeness) + glass-box probe Jul 3, 2026
@github-actions github-actions Bot added size: L and removed size: S labels Jul 3, 2026
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
@joelteply
joelteply merged commit 92a2d31 into canary Jul 3, 2026
4 checks passed
@joelteply
joelteply deleted the fix/84-persona-turn-stream-observability branch July 3, 2026 14:38
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