Repository navigation
feat(host-service): host sessions sync v1 — canonical sessions over tRPC snapshots + /sessions/sync - #5645
feat(host-service): host sessions sync v1 — canonical sessions over tRPC snapshots + /sessions/sync#5645bra1nDump wants to merge 1 commit into
Conversation
…RPC snapshots + /sessions/sync The simplified v1 of the host sessions surface (spec: plans/host-sessions-sync.md, three review layers + rollout + E2E story in one doc). Protocol (@superset/host-service-sync): camelCase wire throughout; 9 tRPC procedures / 12 socket packet types / 2 opaque incarnation-tagged cursor kinds; snapshots ride tRPC only (list/get carry the head cursor, subscribe requires `after`); claimless client tool calls (first resolve wins); no server-derived attention; backwards-only getEvents paging; shared pure projection reducer with golden fixtures. Host: canonical sessions runtime translating ACP into canonical events, sessions.* router (inputs AND outputs schema-validated), /sessions/sync hub with replay/reset semantics (foreign cursor -> CURSOR_INVALID, evicted -> CURSOR_EXPIRED, recovery always refetchSnapshot), fingerprinted idempotency receipts. Client: framework-free zustand store, tRPC-seeded cold path that doubles as reset recovery, reset circuit breaker (3/30s -> error + RESET_LOOP), socket loss downgrades live streams to idle with data intact. Evidence: 602 host-service src tests, 46 sync tests, 11-test realistic scenario (mid-stream disconnect, scrollback parity vs the full journal, session switching under load, host reboot with exactly one reset), and the gym user story 10/10 with a real Opus instance on this exact surface. Also consolidates the design docs into plans/host-sessions-sync.md and purges the stale Mastra/ACP-era chat docs (direction recorded: ACP gets replaced by a direct SDK adapter behind this surface; Mastra chat frozen for existing desktop users only). Claude-Session: https://claude.ai/code/session_01N98A6Rs53rLfRb8Qf5pM3Y
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Ready to review this PR? Stage has broken it down into 11 individual chapters for you: Chapters generated by Stage for commit 2fdbde0 on Jul 12, 2026 9:27pm UTC. |
What
The simplified v1 of the host sessions surface — the agent-agnostic session/thread/event model that mobile and web sync against. One squashed commit, rebased on main.
Read this first:
plans/host-sessions-sync.md— the single design doc, structured as three review layers (1: principles + budgets, 2: state ownership + surface + recovery, 3: one realistic scenario with exact payloads), plus rollout and the E2E gym story.Shape
sessions.list/getcarry theheadcursor); the/sessions/syncsocket carries only small frames;subscribe.afteris required.error).Evidence
ACP_E2E=1 bun test test/integration/sessions-user-story.integration.test.ts).causationIdattribution.Also in here
Doc consolidation: the old protocol/rollout pair and the stale Mastra/ACP-era chat docs are deleted (−5.7k lines); direction recorded — ACP gets replaced by a direct SDK adapter behind this unchanged surface (deferred, prototype in
claude-sdk-session-harness), Mastra chat stays frozen for existing desktop users and is never used by mobile.Out of scope (deferred)
Direct SDK adapter / ACP removal, host control-plane extension (workspace lifecycle etc. — see the "Trajectory" section in the doc). Next up after this: durable history store, React bindings + mobile rewire, Maestro phone replay.
https://claude.ai/code/session_01N98A6Rs53rLfRb8Qf5pM3Y
Summary by cubic
Ships v1 of Host Sessions sync: a canonical session/thread/event model with tRPC snapshots and a lightweight WebSocket for live updates. Adds
sessions.*,/sessions/sync, a shared protocol package, and a small client store; cleans up old Mastra/ACP docs.New Features
@superset/host-service-syncpackage with zod-validated protocol, a shared projection reducer, and a framework-freezustandclient (createSessionsSyncClient).sessions.*tRPC (snapshots vialist/get, idempotent receipts, camelCase wire) and/sessions/synchub (hello/ack,subscribe.afterfromhead, replay/reset with invalid/expired cursor handling).plans/host-sessions-sync.md; removed stale Mastra/ACP-era docs.Migration
sessions.list/sessions.getto seed, then open/sessions/syncand sendsubscribe.afterusing the returnedheadcursor; onreset, refetch the snapshot and resubscribe.@superset/host-service-sync(createSessionsSyncClient).Written for commit 2fdbde0. Summary will update on new commits.