Repository navigation
Conversation
…ary WebSocket RPC codec and binary framing
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — Web and supported iOS clients now prefer binary WebSocket RPC when the server advertises support, with JSON retained for other peers. This changes an existing product default and requires human acceptance of the rollout. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosNo All 64 scenario measurements
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
WebSocket RPC traffic currently serializes every request, response, stream chunk, and heartbeat as JSON text, sending repeated field names, string-escaped JSON metadata, and text frame-split envelopes across both uncompressed local/desktop sockets and compressed remote/relay connections.
Stacked on #48440 (
nbr/ws-control). This change introduces a capability-negotiatedSchemaBinaryWebSocket RPC codec across server, contracts, shared, client-runtime, Web/Desktop, and iOS while keeping JSON as the default fallback for legacy clients, older servers, and Android:ServerEnvironment.ts,ws.ts,session.ts): advertisecapabilities.wsRpcCodecs: ["schema-binary", "json"]and negotiate?rpcCodec=schema-binaryon Web, Desktop, and iOS (using the native iOST3WebSocketbinary module; Android stays on JSON because RN's AndroidWebSocketModulebase64-encodes binary frames across the bridge).socketFrameParts.ts,socketHeartbeat.ts,OutputProtocol.ts,ws.ts):layerSocketSchemaBinarybypasses JSON-onlywithRecordIdTableoverhead, unwrapsModelSelectionBinaryWire, encodes split frames with a zero-overhead0x00magic prefix on split frames only, supports binary heartbeat frames, and keeps terminal backpressure byte-windowed.baseSchemas.ts,orchestrationV2.ts,socketFrameParts.ts): preserves JSON-equivalent forward compatibility underSchemaBinaryversion skew acrossForwardCompatibleUnionArray,OrchestrationV2ProjectedTurnItems,OrchestrationV2ThreadStreamEvent,OrchestrationV2PendingBackgroundTask,OrchestrationV2NotificationSource,ForwardCompatibleArray(ServerConfigeditors/issues/keybindings/whenAst), andLenientThreadOpens(verified with cross-version binary skew tests insocketFrameParts.test.tswhile malformed known variants still fail loudly).Verified with
vp run check:changed(format, lint, knip, graphql, 39-package typecheck, 19 test files / 262 tests, React Compiler coverage).Created with Gemini 4 Neon in Antigravity.