Skip to content

fix(server): resolve git common dirs through symlinked subdirectories - #18152

Merged
juliusmarminge merged 4 commits into
pingdotgg:mainfrom
macodev00:cursor/fix-symlink-checkpoint-capture-redo2-9e22-v2
Oct 20, 2026
Merged

juliusmarminge merged 4 commits into
pingdotgg:mainfrom
macodev00:cursor/fix-symlink-checkpoint-capture-redo2-9e22-v2

Conversation

@macodev00

@macodev00 macodev00 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Projects opened through a symlink into a repository subdirectory could resolve Git’s relative common directory into a missing directory or another repository. Checkpoint capture then failed or placed its scratch index in the wrong repository; ref discovery could list the wrong repository’s branches.

Resolve relative common-directory paths against the physical working directory at both call sites. This keeps older Git working without requiring rev-parse --path-format. Existing path normalization remains in place.

Fixes #13187. Maintainer takeover of this PR, with credit to @macodev00 for the original fix and decoy-repository reproduction. Contributor history is preserved, with current main merged into the branch.

Verification of 487a72baf1 on headless Linux (Node 24.21.0, Git 2.43.0):

  • Two regression tests in the existing GitVcsDriver suites cover checkpoint index placement/content and ref discovery through a symlink with a decoy repository. Both fail with main’s production code and pass with this change. Simplified from 119 to 74 test lines, retaining both behaviors.
  • Scoped server typecheck, four-file lint and formatting pass. Lint reports two warnings on unchanged lines.
  • The two full suites contain 227 tests. Prior runs: 226 passed, one unrelated previousPath review-diff failure, reproduced with main’s production files. The final rerun has the same result: 226 passed and that one failure.
  • Two independent review rounds (Claude Opus 5.5 and Codex Sol). Round one identified the older-Git flag compatibility risk, which the physical-path implementation resolves. Round two: both reviewers found no blockers.

Proof uses real temporary Git repositories through the server driver. No client UI changed, so screenshots are not applicable. No browser or running application was used. macOS, Windows, iOS, Android, and Electron desktop were not verified; no pre-2.31 Git binary was available. CI on this head remains a separate readiness gate. No merge was performed.

Implementation: Codex GPT-6.1-Sol (high), tests: Codex GPT-6-Astra (high), reviews: Claude Opus 5.5 and Codex GPT-6-Sol, all through T3 Code’s delegated agents; parent: GPT-6.1-Sol in the Codex harness.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 11, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 11, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at a476a75

Macroscope's review found this PR approvable — This is a focused server bug fix that resolves Git’s relative common-directory paths against the physical working directory, correcting checkpoint and ref discovery for symlinked subdirectories while preserving ordinary behavior. Regression tests cover both affected flows, with no schema, configuration-default, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 526c5c63-ca6d-4800-9a5c-cd928f3253e6
📥 Commits

Reviewing files that changed from the base of the PR and between 7389f15 and a476a75.

📒 Files selected for processing: 4
  • apps/server/src/vcs/GitVcsDriver.test.ts
  • apps/server/src/vcs/GitVcsDriver.ts
  • apps/server/src/vcs/GitVcsDriverCore.test.ts
  • apps/server/src/vcs/GitVcsDriverCore.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e02cc160-13ad-4da0-b292-ffea4e6d68fa
📥 Commits

Reviewing files that changed from the base of the PR and between f725ef5 and 6572c84.

📒 Files selected for processing: 3
  • apps/server/src/vcs/GitVcsDriver.ts
  • apps/server/src/vcs/GitVcsDriverCore.test.ts
  • apps/server/src/vcs/GitVcsDriverCore.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

Git common-directory lookups now request absolute paths for repository discovery and checkpoint capture. Symlink-focused tests check repository identification and checkpoint index placement when a decoy repository occupies the corresponding lexical path.

Changes: Symlinked repository paths

Layer / File(s) Summary
Repository path discovery
apps/server/src/vcs/GitVcsDriverCore.ts, apps/server/src/vcs/GitVcsDriverCore.test.ts
Repository path resolution requests an absolute Git common directory. Tests check that listRefs identifies the real repository rather than a decoy reached through the symlink-relative path.
Checkpoint common-directory resolution
apps/server/src/vcs/GitVcsDriver.ts, apps/server/src/vcs/GitVcsDriver.test.ts
Checkpoint capture requests an absolute Git common directory. The test checks that temporary index files use the real repository’s common directory and that capture includes a file from the symlink target.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • pingdotgg/t3code#14736: Both changes request an absolute Git common directory and test symlink-based repository resolution.

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 6572c

This change fixes checkpoint and repository path lookup for projects opened through a symlink to a repository subdirectory. No actionable merge-blocking risk was identified.

### Architecture Summary

Architecture risk: 🔵 Low · up to 6572c

The change affects 1 system.

Changed systems: apps/server

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — apps/server (service) was modified; 4 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/server/src/vcs/GitVcsDriver.test.ts: Adds the symlinksSupported test utility import.
  • observed — Modified behavior in apps/server/src/vcs/GitVcsDriver.test.ts: Adds a test that runs only when symlinks are supported. It sets up a real repository accessed through a symlink and a decoy repository matching the lexical resolution of Git’s relative common directory, then checks that capture uses the real common directory for temporary index files, leaves none in the decoy, and captures the target repository’s nested file.
  • observed — Modified behavior in apps/server/src/vcs/GitVcsDriver.ts: resolveGitCommonDir now uses rev-parse --path-format=absolute --git-common-dir instead of requesting a potentially relative common-directory path; the subsequent absolute-path check and fallback resolution remain.
  • observed — Modified behavior in apps/server/src/vcs/GitVcsDriverCore.test.ts: The test file now imports symlinksSupported to conditionally run symlink-specific coverage.
Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed Issue [#13187] requires checkpoint capture for a project opened through a symlink to a repository subdirectory. The current implementation requests `git rev-parse --path-format=absolute --git-common-d…
Out of Scope Changes check Passed The current changes stay within server checkpoint capture and repository-path resolution. The added tests directly verify those changes. No UI, contract, or provider changes are reported. The reposito…
Title check Passed The title clearly and concisely describes the server fix for resolving Git common directories through symlinked subdirectories.
Description check Passed The description covers the problem, fix, linked issue, scope, verification results, known limitations, and agent attribution. It provides focused regression-test details and explains the incomplete fu…
Full details: Linked Issues check

Explanation

Issue [#13187] requires checkpoint capture for a project opened through a symlink to a repository subdirectory. The current implementation requests git rev-parse --path-format=absolute --git-common-dir before it builds checkpoint index paths. The repository-path lookup uses the same absolute common-directory result and preserves realPath. The added regression tests verify the real index directory, checkpoint contents, and real repository refs while excluding decoy refs. The reported focused tests passed 201 tests.

Full details: Out of Scope Changes check

Explanation

The current changes stay within server checkpoint capture and repository-path resolution. The added tests directly verify those changes. No UI, contract, or provider changes are reported. The repository lookup change supports the linked symlink-path bug by preventing a missing or decoy repository path.

Full details: Description check

Explanation

The description covers the problem, fix, linked issue, scope, verification results, known limitations, and agent attribution. It provides focused regression-test details and explains the incomplete full-suite results.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 11, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 11, 2026 08:34

Dismissing prior approval to re-evaluate f725ef5

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 11, 2026
@cursor
cursor Bot force-pushed the cursor/fix-symlink-checkpoint-capture-redo2-9e22-v2 branch 2 times, most recently from c34f027 to 6572c84 Compare October 18, 2026 06:42
…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.
@cursor
cursor Bot force-pushed the cursor/fix-symlink-checkpoint-capture-redo2-9e22-v2 branch from 6572c84 to 7389f15 Compare October 18, 2026 07:41
@juliusmarminge juliusmarminge self-assigned this Oct 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Taking over this one as maintainer for batch worktree-git-08. I’ll preserve the symlink-resolution fix, reduce regression coverage to the necessary behaviors, merge current main, and push follow-up commits here. Thanks @macodev00 for the reproduction and fix.

@juliusmarminge juliusmarminge changed the title fix(server): use absolute git common dir for checkpoints through symlinked subdirectories fix(server): resolve git common dirs through symlinked subdirectories Oct 19, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 19, 2026 05:10

Dismissing prior approval to re-evaluate 487a72b

@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Oct 19, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 19, 2026
# Conflicts:
#	apps/server/src/vcs/GitVcsDriver.test.ts
#	apps/server/src/vcs/GitVcsDriver.ts
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 20, 2026 04:13

Dismissing prior approval to re-evaluate a476a75

@juliusmarminge
juliusmarminge merged commit 6e1bf41 into pingdotgg:main Oct 20, 2026
30 checks passed
Pipyakas pushed a commit to Pipyakas/t3code that referenced this pull request Oct 21, 2026
…pingdotgg#18152)

Co-authored-by: macodev00 <macodev00@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 6e1bf41)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in 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

2 participants