Repository navigation
fix(sessions): keep selectSession from reverting edits made during its detail read - #2358
Merged
Merged
Conversation
…s detail read selectSession awaited the bounded detail read and then re-cached and committed its window unconditionally. An idle-session edit (message delete, revision switch) that landed while the read was in flight replaces the transcript cache entry, so committing the stale window reverted the edit on screen and in the cache. #2233 taught loadSessionDetail itself to refuse caching such a read; the caller-level commit now applies the same guard: when the cache entry moved during the read for an idle session, the commit keeps the edit writer's cache content and cached window instead. Pinned by session-select-stale-read.test.mjs driving the real slice (superseded read keeps the edit; uneventful re-select still hydrates; running sessions still merge the live tail).
…e compare The guard required a captured cache entry before comparing, so a read that started with no transcript cache entry could never see the movement an in-flight idle edit makes (undefined -> entry). The runtime guard this mirrors (#2233) needs no such precondition; dropping it keeps the caller-level compare aligned with that semantics. Warm re-selects are unaffected: the comparison is the same reference check it always was, and a quiet read whose runtime write replaces the entry still resolves to the same window content.
The guard captured the cache entry just before awaiting the detail, but the read starts earlier and selectSession awaits workspace alignment in between, so an idle edit made while the project activated still got reverted by the stale window. The baseline is now taken right after the selection's own provisional commits and before alignment. It cannot come from loadSessionDetail's own refusal signal: that baseline predates those provisional commits, which move the cache entry themselves, so a retained background pane would be mistaken for an edit and the fresh detail never committed. A cache entry that disappears (eviction) is no longer treated as an edit. fixes #2273
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was previously deployed
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.
Completes #2274 (author's two commits preserved) with the review feedback addressed.
loadSessionDetail: its baseline predatesselectSession's provisional commits (retained pane / reusable empty), which move the cache entry themselves. Honoring it would commit the retained pane instead of the fresh detail; a regression test pins this.Tests:
session-select-stale-read7/7 (adds the alignment-window edit, which fails on the previous head, and the retained-pane hydration guard); fullapps/desktopnode suite matchesmainapart from tests that need a builtout/renderer(not built in the worktree);tsc --noEmitclean.fixes #2273
Supersedes #2274