Skip to content

ui-react: server-frame handler map still has no-op entries for voice- and SDK-consumed frames #3389

Closed

Description

@schlessera

Found while working #1362 (delivered by #3390).

Context

#1362 made the typed server-frame handler map (packages/ui-react/src/hooks/websocket-handlers/index.ts, exhaustive via satisfies ServerMessageHandlerMap<ServerMessageType> at :63) the single routing table for retry_receipt, ask_answer_receipt and session_queue. Several map entries are still no-ops, because something upstream of the map consumes those frames:

  • pong: the SDK client answers its own liveness probes and returns before any consumer handler (private receive, packages/ui-sdk/src/client/ws-client.ts:295-314), so the frame never reaches a consumer. ui-react still carries pong: () => {} (packages/ui-react/src/hooks/websocket-handlers/chat.ts:405-406; listed in the chat frame union at :33) because the map is keyed on the public ServerMessage union (export type ServerMessage, packages/ui-sdk/src/protocol.ts:796, member ServerPong at :817). The SDK client's public consumer handler type is keyed on the same union (packages/ui-sdk/src/client/ws-client.ts:79-82).
  • dialogue_history, tool_resolution and conversation_opened/closed/event/work/output/permission: the voice conversation client reads them in its frame prefilter before the map runs (function frame(message: ServerMessage), packages/ui-react/src/voice/conversation-client.ts:547). Some of them are returned unchanged and then reach the no-op entries in packages/ui-react/src/hooks/websocket-handlers/connection.ts (dialogue_history at :11, tool_resolution at :44, the six conversation_* entries at :50-55).

Citations re-verified at main d990c0ab3 (the protocol and connection.ts lines moved since 3d3516a02). On epic/1342-turn-path-split (b93ced200) they read protocol.ts:793/:814 and connection.ts:47-52.

Sequencing: #3390 (for #1362) is what turns the retry_receipt, ask_answer_receipt and session_queue entries into real handlers. It merged into epic/1342-turn-path-split, not main. On main those three entries are still () => {} (chat.ts:403-404, connection.ts:46). This issue edits the same two handler files, and its "no () => {} entry for these frames" criterion assumes #3390's map, so it starts from main after #1362 closes when that epic's batch lands.

Blocked by #1362

Decision (maintainer, 2026-11-03)

  1. Voice-owned frames: A. Move handling of dialogue_history, tool_resolution and the six conversation_* frames into handler-map entries backed by the conversation client, so the map is the only router. The voice frame prefilter stops routing these frames. This is the riskier option, so voice regression proof is required.
  2. pong: A. Remove pong from the consumer-facing frame union, so no handler entry is needed. ServerMessage and ServerPong are exported from the public @schlessera/brain-ui-sdk/protocol entry point and key the public ./client handler type, so this is a breaking type contract change (see Contract impact). The wire frame itself and the SDK client's own liveness handling stay as they are.

Rejected: B on both questions ("consumed upstream" markers with proving tests).

Scope

  • Voice: add real map entries for the eight voice-owned frames that call into the conversation client; remove the corresponding routing from the conversation client's frame prefilter; no behaviour change for the person using voice.
  • pong: define the consumer-facing frame union without pong (the wire-level union that parseServerMessage validates keeps it), key the SDK client's consumer handlers (ws-client.ts:79-82) and ui-react's ServerMessageHandlerMap on it, and delete the pong entry and union member from ui-react.
  • Contract docs, changeset naming the break, contract + breaking labels on the PR.

Out of scope

  • Wire protocol changes: pong stays on the wire and in the parser's union.
  • Changing what the voice client does with any of these frames (only where it is routed from).
  • Frames whose map entries already do work.
  • chat_retired: () => {} (connection.ts:49 on main). It is inert on purpose until ui-react: design own-chat deletion and targeted cache retirement #3231 decides chat deletion, because this client does not declare chatDeletion.

Acceptance criteria

  • No handler-map entry for these frames is a () => {}: each of the eight voice-owned frames is handled by a map entry backed by the conversation client, and the voice prefilter no longer routes them.
  • pong is absent from the consumer-facing frame union, the SDK client's consumer handler type and ui-react's handler map; the map stays exhaustive over the consumer union (satisfies), and the SDK client still consumes pong for liveness.
  • Voice regression proof: existing voice/conversation-client tests pass unchanged, plus a test per voice-owned frame showing it reaches the conversation client through the map, failing if the map entry is removed (mutation receipt).
  • A type-level test (or tsc fixture) shows a consumer pong handler is no longer accepted and the parser still accepts a wire pong.
  • Contract docs updated for the removed consumer type member; changeset names the break.
  • Existing websocket-handler tests pass.

Verification

bun run test packages/ui-react and bun run test packages/ui-sdk, typecheck and lint, with mutation receipts for the new map-routing tests. Real-browser voice runtime tests in the pinned offline image if any exist for these frames.

Contract impact

Breaking (type-level): removing pong from the consumer-facing frame type of the public @schlessera/brain-ui-sdk/protocol / ./client entry points. Before 1.0 it ships in a minor with the breaking label, this ruling, and a changeset naming the break; CONTRACT: commit with the contract doc updated in the same commit. No wire change.

Triage 2026-11-03: folded the maintainer ruling (Q1 A: map routes voice-owned frames; Q2 A: drop pong from the consumer union, breaking type change).

Triage 2026-11-03 (second pass): refreshed the drifted citations to main d990c0ab3 and declared #1362 as the blocker, because #3390 has not reached main and touches the same handler files. Added chat_retired to out of scope. Milestone 0.45.0: a direct follow-up of #1362's 0.45.0 work with a recorded ruling, bounded to the handler map, the voice prefilter and one consumer type. No epic parent: #1342 is a pure refactor whose constraints forbid protocol and signature changes, and this issue makes a ruled breaking type change. priority: p2 kept, equal to its blocker #1362. agent-ready together with blocked.

Activity

  1. added
    type: refactorStructure changes; behaviour does not. No changeset-visible effect.
    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 2, 2026
  2. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03: the two open questions now carry options and recommendations in the body. For voice-owned frames, keep the prefilter and mark the entries "consumed upstream" with a proving test. For pong, keep it with a marker unless its union is internal. needs: decision.

  3. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.
    breakingBreaks a published API or documented behaviour. Needs a maintainer ruling before code.
    and removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): Q1 A — move voice-owned frame handling (dialogue_history, tool_resolution, the six conversation_*) into handler-map entries backed by the conversation client, so the map is the only router; voice regression proof is part of the acceptance criteria. Q2 A — remove pong from the consumer-facing frame union.

    Contract check: ServerMessage (with ServerPong) is exported from the public @schlessera/brain-ui-sdk/protocol entry point and keys the public ./client handler type (packages/ui-sdk/src/client/ws-client.ts:79-82), so dropping pong from the consumer union is a breaking type-level contract change. Added contract and breaking; the body's Contract impact gives the breaking treatment (pre-1.0 minor, breaking label, changeset naming the break). The wire frame and the parser's union keep pong. This comment is the ruling the breaking change requires. Removed needs: decision; agent-ready.

  5. added
    area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 3, 2026
  6. added this to the 0.45.0 milestone on Nov 3, 2026
  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03 (second pass): updated the drifted citations to main d990c0ab3 (protocol.ts:796/:817, connection.ts:50-55). #3390 is on epic/1342-turn-path-split, not main. On main, retry_receipt, ask_answer_receipt and session_queue are still no-ops in the same files this issue edits, so #1362 is now the declared blocker. Added chat_retired (#3231's deliberately inert entry) to out of scope. Milestone 0.45.0. No epic parent: #1342's constraints allow only pure refactors with no protocol or signature change, and this issue makes a ruled breaking type change. priority: p2 kept, equal to #1362. agent-ready and blocked.

  8. removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 3, 2026
  9. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Unblocked: every Blocked by issue here is closed. #1362 and #2515 closed when epic #1342 batch 1 landed on main in #3520 (merge 9805f52fd).

  10. self-assigned this
    on Nov 15, 2026
  11. schlessera commented on Nov 15, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-87a6ac46. Branch: refactor/3389-handler-map-voice-frames.

    path overlap on protocol.ts/ws-client.ts with many open drafts; no closure collision known

  12. schlessera commented on Nov 16, 2026

    @schlessera
    OwnerAuthor

    Merged in #4067 as 087ffdd5e through the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-reactReact chat/files/voice components, stores, WebSocket transport.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.breakingBreaks a published API or documented behaviour. Needs a maintainer ruling before code.contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: refactorStructure changes; behaviour does not. No changeset-visible effect.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions