Repository navigation
CONTRACT: refactor(ui-react,ui-sdk): route voice-owned frames through the handler map and drop pong from the consumer union - #4067
Merged
Conversation
… the handler map and drop pong from the consumer union (#3389) The voice conversation client's own frames (dialogue_history, tool_resolution and the six conversation_* frames) now reach it through their handler-map entries, backed by a new receive(frame), instead of being consumed in its frame() prefilter. The map is their only router. The seven frames frame() used to consume are dispatched connection-wide at the same point; tool_resolution keeps its run-state path and is dispatched once after it, also for a session with no buffer. BREAKING (types): the SDK exports ConsumerServerMessage, every ServerMessage except ServerPong. ServerFrameHandlers and onAny are keyed on it, so a pong handler no longer type-checks; the client always consumed pong for liveness. ui-react's handler map is keyed on it and loses its pong entry. The wire, ServerMessage and parseServerMessage keep pong. Maintainer ruling recorded on the issue (Q1 A, Q2 A). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No uploads on this PR yet This PR changes UI files (
Tips for agentsLabel each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one uploads put after.png --pr 4067 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4067 --app ios --screen "Chat" --state afterNo CLI? With the Uploads MCP, call This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with Workspace admins can turn this comment off in Settings → GitHub · docs |
This was referenced Nov 15, 2026
Merged
… entrypoint (#3389) The cross-workspace census requires a runnable owner for every test importing another workspace. The new ui-react .test-d.ts file is checked by the root tsc, like block-contract.test-d.ts, so it joins that list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
…-map-voice-frames # Conflicts: # docs/integration-contract.md
8 of 9 tasks
…-map-voice-frames
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.
Closes #3389
What changed
The ui-react server-frame handler map is now the only router for the voice conversation's own frames.
dialogue_history,tool_resolutionand the sixconversation_*frames each have a map entry that hands the frame to the conversation client (context.conversation, backed by its newreceive(frame)). The client'sframe()prefilter now returns them unchanged instead of consuming them. Separately,pongis no longer a frame a consumer can handle. The SDK exportsConsumerServerMessage(Exclude<ServerMessage, ServerPong>),ServerFrameHandlersand itsonAnyare keyed on it, and ui-react's map is keyed on it, so thepong: () => {}entry is gone. Nothing changes on the wire:ServerMessage,ServerPongandparseServerMessagekeeppong, and the SDK client still consumes it for liveness. Nothing changes for the person using voice.Why this shape
This follows the maintainer ruling: Q1 A (map entries backed by the conversation client) and Q2 A (drop
pongfrom the consumer union, a breaking type change before 1.0).The new map entries are dispatched where
frame()used to consume these frames, so their order and side effects stay the same:dialogue_historyand sixconversation_*) are dispatched once, connection-wide, right afterframe(), and go no further. Before,frame()returnednullfor them, so nothing after it saw them. Sending them into the demux instead would record run state for aconversation_workthat names a session, and would drop frames whose session has no buffer.tool_resolutionwas only observed byframe(), then went on to the demux, where it marks its session's run state. It keeps that path. AfternoteRunStateit is dispatched connection-wide, so voice still sees an outcome for a session with no buffer here. The only change is that its permission update now lands after earlier buffered text is flushed.Alternatives I did not take:
root.connection.handleServerMessagetoConsumerServerMessage. That would be a second, unruled break to a ui-react input. About 70 test and fixture call sites type their frames asServerMessage. It keeps takingServerMessageand ignores apongfed to it at that boundary.permissions.frameto seetool_resolution. It is now a separatepermissions.resolution, so the prefilter really stops routing it.The contract index and
package-api.mddescribe theframe()/receive()split, because the conversation client is reachable fromcreateBrainUiRoot. The split falls under the same ruling.Existing tests touched:
conversation.offline.tsx, three lines handed conversation frames straight toclient.frame()to prove late-frame guards (LATE_CLOSE_CANNOT_RESTORE_DIAGNOSTICand two others). Withframe()passing them through, those lines would pass without proving anything, so they now callclient.receive(). One cast moved fromServerMessagetoConsumerServerMessage.ws-client-lifecycle.test.ts, the socket-lease test used{ type: "pong" }as an arbitrary frame throughonAny, which can no longer carry one. It now usesserver_hello. Its casts moved toConsumerServerMessage.Proof
{"version":1,"kind":"brain-check-pr-receipt","head":"c703538e84ee9524af370ee700856ada3a386880","base":"origin/main","mode":"focused","startedAt":"2026-11-16T07:44:15.018Z","finishedAt":"2026-11-16T07:45:46.284Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":13153.640333000001},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":122.98552600000039},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":90.0356249999968},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":23.4909090000001},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":77857.218838}]}Failing first. I ran the new tests in
packages/ui-react/tests/ws-client-lifecycle.test.tsagainstorigin/main'spackages/ui-react/srcandpackages/ui-sdk/src: 20 pass, 16 fail. Each frame's map test fails onVOICE_FRAME_MAP_ENTRY, because the entries were() => {}. Each frame's socket test fails onVOICE_PREFILTER_PASSES_THROUGH, becauseframe()consumed the frame, or fortool_resolutiononVOICE_FRAME_REACHES_CONVERSATION. The two behaviour tests (durable history lands in voice state; a permission outcome reaches voice without a buffer and still marks run state) pass on main, as behaviour-preservation tests should. With the change: 36 pass, 0 fail.Mutations, each restored afterwards:
conversation_workmap entry set back to() => {}VOICE_FRAME_MAP_ENTRY,VOICE_FRAME_REACHES_CONVERSATION(conversation_work)CONVERSATION_OWNEDdispatch ininbound.tsremovedVOICE_FRAME_REACHES_CONVERSATIONfordialogue_historyandconversation_work(dropped by the demux for a session with no buffer), and the durable-history testtool_resolutionconnection-wide dispatch inhandleFrameremovedVOICE_FRAME_REACHES_CONVERSATION(tool_resolution), and the no-buffer permission testType-level.
packages/ui-sdk/tests/consumer-frames.test-d.tschecks four things: the parser andServerMessagekeepServerPong;ConsumerServerMessagehas nopongand, together withServerPong, is exactlyServerMessage; aponghandler is a@ts-expect-error; andonAnycomparing against"pong"has no overlap.packages/ui-react/tests/handler-map-frames.test-d.tschecks that the map's key set equalsConsumerServerMessage["type"], has nopong, and thatServerMessageHandlerMap<"pong">is a type error. Mutations, each restored:ConsumerServerMessage = ServerMessageTS2344in both test-d files and in the map's_EveryFrameClaimed, plusTS2578unused@ts-expect-errorServerFrameHandlerskeyed onServerMessageTS2578at theponghandleronAnytakingServerMessageTS2578at theonAnycomparisontsc --noEmitover the whole repo is clean.bun run buildpasses.api-report/ui-sdk.txtandapi-report/ui-react.txtare regenerated withConsumerServerMessage,receive,permissions.resolutionand the retypedframe.scripts/source-browser-dispatch.tsre-audits and re-pinsindex.ts,chat.ts,connection.tsandinbound.ts, with a note on what changed in each.Full package suites in the agent sandbox:
bun run test packages/ui-sdkgave 1378 pass and 48 fail, andbun run test packages/ui-reactgave 2615 pass and 7 fail. Every failure is in a sandbox-only file: the worker sandbox, governed and maintenance workers, staging, and cgroup files (unshare: write failed /proc/self/uid_map), plusapi-client-sync.test.ts. None of them imports the changed code. I reran those 13 files on anorigin/mainworktree. The failing names churn between runs on both trees, andworker-sandbox.test.tson its own gives identical results on both (31 pass, 4 fail, same names).Real-browser voice tests (
packages/ui-react/tests/browser/conversation*.offline.tsx,dialogue-*.offline.tsx) run in the pinned offline image. Hosted draft heavy feedback (run 43767085844, head47857b935, basecc326cc64; feedback, not proof):conversation.offline.tsx, the voice file this PR changed, among the selected changed files.tests/unit-test-consumers.test.ts› "the whole cross-workspace source class retains every independently discovered unit owner" failed withUNRESOLVED_OWNERSHIP: packages/ui-react/tests/handler-map-frames.test-d.ts. The new type-only file imports@schlessera/brain-ui-sdk/protocolfrom ui-react tests and had no runnable owner in the census. Likeblock-contract.test-d.ts, it is checked by the roottsc. The fix is commit71127b7b7, which lists it with the census's explicit compile-only entrypoints intests/helpers/unit-consumer-audit.ts. Reproduced failing locally on the same assertion before the fix; after it,bun run test tests/unit-test-consumers.test.tsgives 48 pass, 0 fail. The receipt above is for headc703538e8, the merge oforigin/mainatfcae4b79d. The only conflict wasdocs/integration-contract.md, where both sides added an index entry; both are kept. After the merge, the API reports regenerate unchanged,bun run typecheckandbun run buildpass, and the repaired citations still anchor.Collisions (
bun scripts/collisions.ts --json --pr <pr>): 36 reports at head71127b7b7(29 at47857b935). Textual overlaps:conversation-client.ts,conversation.offline.tsxandapi-report/ui-react.txt.docs/integration-contract.md, index entries only.The other 31 are closure (shared affected-category) reports only, with no shared lines.
Checklist
.changeset/3389-consumer-frames-without-pong.md, minor, names the break).package-api.md/wire.mdcomponents are updated in this same commit.docs/reflect the change. I also repaired seven citations this change moved (answer-delivery.md,hardening.md,test-waits.md).Anything left open
Other map entries are still
() => {}for frames a client consumes beside the demux:safety_*,attachment_read,live_settingsandlive_persona. They are out of this issue's scope and filed as #4063 (needs scoping).chat_retiredstays inert on purpose until #3231.🤖 Generated with Claude Code