Repository navigation
fix(server): review diff previews reuse the cached repository layout #38451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
juliusmarminge
merged 3 commits into
pingdotgg:main
from
amv146:fix/review-preview-cached-layout
Nov 18, 2026
+58
−28
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b1bc63a
fix(server): review diff previews reuse the cached repository layout
amv146 c0c81c2
Merge remote-tracking branch 'origin/main' into fix/review-preview-ca…
juliusmarminge 1faf8db
test(server): drop worktree invalidation case already covered elsewhere
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key the review layout cache by the physical working directory.
The layout cache key at
apps/server/src/vcs/GitVcsDriverCore.ts:1650keeps a symlink path as written. If that symlink is retargeted from repository A to repository B within the 10-minute TTL,resolveReviewRepositoryreturns A's cachedworktreeRoot(lines 1667-1673).getReviewBranchCommitsandgetReviewDiffPreviewthen run their Git commands in A (line 4082 and the matching diff-preview path). Branch-dependent requests also pair B's fresh branch with A's root. For up to 10 minutes, review previews can therefore show diffs and commits from the wrong repository.The trigger is narrow. It needs a project path that is a symlink retargeted between repositories within the TTL.
listRefs(line 4935) uses the same cache and has the same limitation, so this is an existing cache-design gap that the review methods now inherit.A cached layout must apply only to the physical directory the request targets. When that physical identity changes, the layout must be rediscovered. Reuse must continue when the identity is unchanged. The author chooses how to detect the change. If the cache key changes to the physical path,
listRefsand the status paths that share this cache change with it.Impact: Read-only review previews can show the wrong repository for at most the cache TTL, in a narrow retargeting case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissing for this PR. The review methods now share the same cwd-keyed layout cache as
listRefsand the status paths, so a symlinked cwd retargeted to another repository within the 10-minute TTL is handled the same way across all of them, and the PR description notes it. Validating physical identity only in the review path would diverge from those consumers instead of fixing the gap, so a fix belongs in the cache itself, in a separate change, so every consumer changes together. The impact is read-only and bounded by the TTL.