Repository navigation
Closed
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.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: refactorStructure changes; behaviour does not. No changeset-visible effect.
Milestone
Description
Part of #1342.
Context
createWebSocketClient is about 1,010 lines (packages/ui-react/src/connection.ts:29-1036) and is only exercised through runtime tests. Inbound frames are routed in three layers, not one per-kind table:
handleServerMessage(connection.ts:328) prefilters and keeps turn bookkeeping.handleFrame(connection.ts:386) is amsg.typeif/else chain that fully handlesretry_receipt,ask_answer_receiptandsession_queue, then runs the demux.- The typed handler map runs last, and registers no-op entries for the frames handled earlier:
retry_receipt: () => {}andask_answer_receipt: () => {}(packages/ui-react/src/hooks/websocket-handlers/chat.ts:403-404),session_queue: () => {}(packages/ui-react/src/hooks/websocket-handlers/connection.ts:45).
The map's exhaustiveness assertions therefore do not prove where a frame is handled.
Scope
- Extract reconnect/backoff, auth refresh, the outbound queue and dispatch into modules with direct unit tests.
- As part of the dispatch extraction, move the handling of
retry_receipt,ask_answer_receiptandsession_queueinto the typed handler map, so the map is the single routing table and its no-op entries go away. Handling order and effects stay the same.
Out of scope
- Protocol or timing changes.
Acceptance criteria
-
createWebSocketClientis under ~200 lines. - Reconnect backoff and outbound queue have unit tests that fail when their ordering is broken (mutation recorded).
- Offline/reconnect browser specs pass unchanged.
- No handler-map entry for a server frame is a no-op; a test asserts that each of the three moved frames is handled by its map entry.
Verification
bun run test packages/ui-reactContract impact
None.
2026-10-24: removed the closed #1380 blocker, refreshed the range, and replaced the inaccurate "per-kind split" description with the three-layer routing from the 2026-10-22 source check; the dispatch extraction now makes the handler map the single routing table.
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.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: refactorStructure changes; behaviour does not. No changeset-visible effect.
Activity
schlessera commentedon Oct 9, 2026
Unblocked: #1380 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Oct 21, 2026
Source check at
dcf5341aaduring the 2026-10-22 repository review:The citation is out of date.
createWebSocketClientis now 1,008 lines,packages/ui-react/src/connection.ts:29-1036. The body says about 870 lines at:20-892.The blocker has already closed. The body still says
Blocked by #1380, but ui-react: stores and lib import from components #1380 is closed. The stale blocker line should be removed (the issue does not carry theblockedlabel).New evidence about the "per-kind split" this body points to. Inbound frame routing actually runs in three layers:
handleServerMessage(connection.ts:328) does prefiltering and turn bookkeeping.handleFrame(connection.ts:386) is a longmsg.typeif/else chain. It fully handlesretry_receipt,ask_answer_receiptandsession_queue, then runs the demux.The map registers no-op entries for frames handled earlier:
retry_receipt: () => {}andask_answer_receipt: () => {}(packages/ui-react/src/hooks/websocket-handlers/chat.ts:403-404), andsession_queue: () => {}(hooks/websocket-handlers/connection.ts:45). The exhaustiveness assertions over the map therefore no longer prove where a frame is handled. Moving that handling into the map would make it the single routing table, and it fits this issue's "dispatch" extraction.schlessera commentedon Nov 2, 2026
Claimed (token
wi-1362-3900e7ec). Branchrefactor/1362-ws-lifecycle-extractionfromepic/1342-turn-path-split@45fe0ecd2; the PR targets that epic branch. Collision report: path overlap with #3371 onpackages/ui-react/src/hooks/websocket-handlers/connection.ts; closure-only overlaps with other open PRs, including #3360 on the same epic branch. My diff stays out of the #3360 chat-slices files.schlessera commentedon Nov 2, 2026
PR #3390 is open and ready against
epic/1342-turn-path-split(head8fa3836f7, base45fe0ecd2).createWebSocketClientis now 164 lines, composed from directly tested parts underpackages/ui-react/src/ws-client/. The three frames are routed through their map entries. Mutation receipts are on the PR. Hosted selected proof is pending. This issue closes when the epic batch lands onmain. Follow-ups: #3388 (CI file-input selection for the moved audit consumer), #3389 (remaining voice- and SDK-consumed no-op map entries, needs scoping).fix(ui-react): send inbox subscriptions and resume revalidation throu…
refactor(ui-react): pull reconnect, auth and outbound-queue lifecycle…
schlessera commentedon Nov 3, 2026
Delivered to its epic integration branch as
2b9a69c60via #3390, after ready-candidate proof passed on the exact epic base. This issue closes when the epic batch lands on main.