Skip persisted tool_progress entries during session replay#3909
Open
silvaitamar wants to merge 1 commit into
Open
Skip persisted tool_progress entries during session replay#3909silvaitamar wants to merge 1 commit into
silvaitamar wants to merge 1 commit into
Conversation
Interactive `studio code sessions resume` could hang on "Resuming session..." because replaySessionHistory re-emitted every persisted studio.tool_progress entry to the loader. On sessions with tens of thousands of progress ticks this is an O(n) UI redraw before the session becomes usable. Tool progress is ephemeral UI state with no value when rehydrating history (finishReplay clears the loader anyway), so skip it during replay. Conversation context (messages, tool results, site selection, agent questions) is unchanged. Adds a unit test covering that progress entries are not replayed while the surrounding conversation still is. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Related issues
How AI was used in this PR
Used Cursor to locate the affected code path (
replaySessionHistory) and todraft the change and its unit test. I reviewed the diff myself and validated it
locally (see Testing Instructions). The change is intentionally minimal and
scoped to the resume hang.
Proposed Changes
Interactive
studio code sessions resumecould hang on "Resuming session…"because session replay re-emitted every persisted
studio.tool_progressentryto the loader. On sessions that accumulated tens of thousands of progress ticks,
this is an O(n) UI redraw before the session becomes usable.
Tool progress is ephemeral UI state with no value when rehydrating history
(
finishReplay()clears the loader at the end anyway), so this skips thoseentries during replay. Conversation context — messages, tool results, site
selection, and agent questions — is unchanged, and live progress during a run is
not affected.
Out of scope (tracked in #3865): progress is still persisted to the JSONL, and
studio code sessions liststill parses full session files. Those are separateconcerns better addressed in follow-up PRs.
Testing Instructions
studio.tool_progressentries (a realbloated session, or one crafted with thousands of such lines).
studio code sessions resume <id>(interactive TUI).selected site correctly.
Unit test:
npm run test -- apps/cli/ai/sessions/tests/replay.test.tsPre-merge Checklist