fix(web): stop replays from duplicating the transcript on reconnect - #94
Draft
shadaj wants to merge 1 commit into
Draft
fix(web): stop replays from duplicating the transcript on reconnect#94shadaj wants to merge 1 commit into
shadaj wants to merge 1 commit into
Conversation
* `infinity-web/src/App.tsx`: a `Replay` always carries the complete transcript for the connected thread, so the handler now clears the message state (bumping the generation to invalidate MessageList's prefix cache), pending choices, and streaming flag before processing the replayed history. Previously the WS-reconnect path (`Welcome` → re-`Connect`) never reset the transcript — unlike `navigateTo` / `MigrateComplete` — so each reconnect appended a full extra copy of the history to the messages array and DOM, making the page progressively laggier with every disconnect/reconnect cycle. The input draft is deliberately preserved (unlike `resetMessages`). * `crates/infinity-daemon/src/session/thread_worker.rs`: `handle_subscribe` now replaces an existing subscription on the same channel (`same_channel`) instead of pushing a duplicate. The web client re-sends `Connect` every 5s until `Connected` arrives; when a resume was slow, each retry stacked another subscriber for the same client, causing every display event (and another full `Replay`) to be delivered N times from then on. Co-authored-by: Infinity 🤖 <infinity@hydro.run>
Deploying infinity with
|
| Latest commit: |
ad2e37a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://abb09ada.infinity-dc7.pages.dev |
| Branch Preview URL: | https://sandbox-fd248ca1-ee54-4173-8.infinity-dc7.pages.dev |
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.
infinity-web/src/App.tsx: aReplayalways carries the completetranscript for the connected thread, so the handler now clears the
message state (bumping the generation to invalidate MessageList's
prefix cache), pending choices, and streaming flag before processing
the replayed history. Previously the WS-reconnect path (
Welcome→re-
Connect) never reset the transcript — unlikenavigateTo/MigrateComplete— so each reconnect appended a full extra copy ofthe history to the messages array and DOM, making the page
progressively laggier with every disconnect/reconnect cycle. The
input draft is deliberately preserved (unlike
resetMessages).crates/infinity-daemon/src/session/thread_worker.rs:handle_subscribenow replaces an existing subscription on the samechannel (
same_channel) instead of pushing a duplicate. The webclient re-sends
Connectevery 5s untilConnectedarrives; when aresume was slow, each retry stacked another subscriber for the same
client, causing every display event (and another full
Replay) to bedelivered N times from then on.