Repository navigation
Conversation
…once it stays open
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Issue for this PR
Closes #53428
Type of change
What does this PR do?
Opening a session waited for its last 100 messages. For a long session that fetch is most of the time it takes to open: about 290–430 ms in my logs, against 7–8 ms for the last 20 messages of the same sessions.
sync.session.sync(sessionID, { firstPage: true })loads only the last 20 messages. A later call withoutfirstPageloads the usual 100. A full sync asked for while a first page is still loading runs after it rather than returning early, and it reuses the first page's hydration tracker, so events that arrived in between are still not overwritten by stale server data.Other callers of
sync.session.syncare unchanged and still do a full sync.How did you verify your code works?
Two new tests in
test/cli/cmd/tui/sync-live-hydration.test.tsx. One checks that a first page loads the latest 20 messages, that a second first page doesn't fetch again, and that a full sync then loads all 50 (requests made:[20, 100]). The other checks that a full sync asked for while a first page is loading still ends with the full history. The fullpackages/tuisuite (196 tests) passes. Typecheck shows only thedialog-move-session.tsxerrors that are already ondev.I've also used it in my build while switching between long sessions.
Screenshots / recordings
No recording. On demo sessions generated locally both builds open in under a frame, so a video shows no difference. The gap shows up on real long sessions with large tool output, which I can't share. The timings above are from those.
Checklist