Skip to content

fix: resume WebSocket trace from cursor instead of replaying from start#321

Open
Babigdk wants to merge 1 commit into
Toolbox-Lab:mainfrom
Babigdk:fix/websocket-resume-from-cursor
Open

fix: resume WebSocket trace from cursor instead of replaying from start#321
Babigdk wants to merge 1 commit into
Toolbox-Lab:mainfrom
Babigdk:fix/websocket-resume-from-cursor

Conversation

@Babigdk

@Babigdk Babigdk commented Jul 16, 2026

Copy link
Copy Markdown

closes #318

The example WebSocket client had no reconnection logic and the server treated
every (re)connection as a brand-new client, so a reconnect after a dropout
replayed the entire trace - forcing the client to re-download and dedupe
megabytes of already-received trace nodes.

- Track a persistent `lastSeenNodeId` (the last node index seen) outside the
  connection scope and update it on every parsed `trace_node`.
- Add a reconnection engine with capped exponential backoff.
- Augment the reconnect `ws.send()` payload with `resume_from: lastSeenNodeId`
  so the server fast-forwards the replay to only unseen nodes.
- Add defensive client-side dedup for any node already delivered.
- Server now accepts `resume_from: Option<usize>` on TraceRequest and skips
  broadcasting nodes with index <= cursor.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task 22: Reconnected WebSocket Replays the Entire Trace Instead of Resuming Where It Left Off

1 participant