Skip to content

fix(server): capture checkpoints through symlinked repository subdirectories - #78

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/fix-symlink-checkpoint-capture-redo2-9e22
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/fix-symlink-checkpoint-capture-redo2-9e22

Conversation

@macodev00

Copy link
Copy Markdown
Owner

Problem

Opening a project through a symlink that points at a repository subdirectory made every turn fail checkpoint capture with exit 128. Git's relative --git-common-dir is computed from the physical working directory, and path.resolve applied .. to the symlink string, so the temporary index was created in a directory that does not exist. When that lexical path happened to exist, the index was written into a different repository. Diffs and Go back stayed unavailable for that thread.

The same join in repository path lookup could cache the missing directory, or the other repository's .git.

Accepted in pingdotgg#13187.

Change

Checkpoint capture and repository path lookup now ask Git for an absolute --git-common-dir before joining it with the project path. realPath still runs afterward so Windows 8.3 short names collapse.

The regression tests plant a decoy repository at the lexical common-dir path before the only lookup. Checkpoint capture records GIT_INDEX_FILE during the command and requires that directory to be the real .git. Repository listing calls listRefs once, on a cwd that has never been resolved, and requires decoy-only to be absent and real-only to be present. A second listRefs on the same cwd would be served from the refresh cache and would not check the decoy.

Fixes pingdotgg#13187
Supersedes pingdotgg#13223

Scope and approval

Server checkpoint and repository-path resolution only. No UI, contract, or provider changes.

pingdotgg#13187 was triaged and accepted as a server checkpoint bug: pingdotgg#13187 (comment)

Verification

Node v24.13.1, Linux. From apps/server at 7e895b123:

vp test run src/vcs/GitVcsDriver.test.ts src/vcs/GitVcsDriverCore.test.ts

Result: 2 files passed, 156 tests passed (16.64s).

The same two tests were also run against the previous path.resolve join, with the decoy repository already in place:

vp test run src/vcs/GitVcsDriver.test.ts src/vcs/GitVcsDriverCore.test.ts -t "symlinked subdirectory|lexical common dir"

Result: 2 failed. Checkpoint capture recorded GIT_INDEX_FILE under <sandbox>/.git (the decoy) instead of <sandbox>/repo/.git. listRefs returned the decoy-only branch (expected true to be false on the decoy assertion). With the absolute common dir, that filtered run passed: 2 files passed, 2 tests passed, 154 skipped (1.91s).

vp run --filter t3 typecheck

Result: tsc --noEmit exited 0 (cache disabled). The compiler printed suggestion diagnostics in unrelated files and no error TS lines.

Limitations

Checked on Linux, where symlink creation is supported, so the new skipIf(!symlinksSupported) cases ran. Not checked on Windows.

Open in Web Open in Cursor 

…ctories

Git's relative --git-common-dir is computed from the physical working
directory. Joining it with path.resolve walked out of a symlink into a
repository subdirectory, so checkpoint capture wrote its index into a
missing directory or a different repository.

Ask for an absolute common dir in checkpoint capture and repository path
lookup. The regression tests create the decoy repository before the only
lookup, so a cached pre-decoy result cannot hide the wrong path.

Co-authored-by: maco <macodev00@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Oct 2, 2026
@macodev00

Copy link
Copy Markdown
Owner Author

Opened upstream.

@macodev00 macodev00 closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Checkpoint capture fails with exit 128 on every turn when the project path is a symlink to a repository subdirectory

1 participant