You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): multi-repo worktree threads start when the project path's letter case differs from disk - #48481
On macOS (and other case-insensitive volumes), a project added with a path whose letter case differs from the folder on disk (for example ~/developer/app for ~/Developer/app) made every turn in a multi-repo worktree thread fail with "The thread's folder holds a separate checkout instead of the thread's worktree." Git writes a worktree's .git pointer in the case on disk, and linkedGitDir compared it as a string with paths built from the stored project path. Those paths went through Effect's FileSystem.realPath, Node's JS realpath, which does not change letter case. linkedGitDir now resolves paths with Node's native realpath, which returns the case on disk on macOS and Windows, so T3's own worktrees are recognised again.
Commit 9ba2879 (origin/main). No Mac was free in the shared pool (two 20-minute waits), so I made a case-insensitive volume on the Linux VM instead: a 512 MB ext4 loop image formatted with -O casefold, mounted, and a directory in it marked chattr +F. I checked that it behaves like macOS APFS by creating Developer/ and confirming developer/ resolves. I added one test to apps/server/src/workspace/TaskFolders.test.ts ('resumes a thread whose project path differs from disk only in letter case'). It uses the real TaskFolders service, real git and real files: it makes repositories at <tmp>/Developer/app and <tmp>/Developer/lib, sets the project workspaceRoot to <tmp>/developer/app and the tracked folder to <tmp>/developer/lib (lowercase d, as in the report), creates a worktree task folder on branch feature with lib selected, then calls restore with both worktrees still in place. Run: TMPDIR=<casefold dir> vp test run src/workspace/TaskFolders.test.ts -t "letter case" in apps/server. Result: it fails with TaskFolderCheckoutBlockedError: The thread's folder holds a separate checkout instead of the thread's worktree. Move it away and try again., thrown at TaskFolders.ts:1759 from recreateMissing because linkedGitDir returned null. That is the reporter's error and stack. On a case-sensitive volume, such as Linux CI, the lowercase path does not exist, so the test returns early and passes. I did not run the desktop app on macOS.
Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
TMPDIR=<casefold ext4 dir> vp test run src/workspace/TaskFolders.test.ts -t "letter case" (apps/server, before the fix): fails with TaskFolderCheckoutBlockedError at TaskFolders.ts:1759, the reported bug
vp test run src/workspace/TaskFolders.test.ts (apps/server, after the fix, case-sensitive tmp): 44 passed, 1 skipped
vp run typecheck (apps/server): passes, no errors in TaskFolders.ts
vp run check:changed: fmt, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all pass
macOS run of the repro test: not run, because the Mac pool had no free place (two 20-minute waits)
Not in this change
Linux casefold volumes stay affected because glibc realpath does not correct letter case there; comparing stat identity would fix that.
Other fileSystem.realPath path comparisons in TaskFolders.ts (for example wasLinked in add-repository) may have the same case sensitivity, but no report reaches them.
Who did the work
Written by Claude Opus 5.5, in Claude Code
Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5
Macroscope's review found this PR requires human approval — The change normalizes path letter case during Git worktree validation while preserving the existing error fallback. It also adds a static-analysis suppression for the Node filesystem import, which requires human review.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
The checkout path helper now uses Node’s promise-based realpath API. A new test checks task folder restoration when project and repository paths use different casing from the on-disk paths.
Changes: Task folder path casing
Layer / File(s)
Summary
Resolve checkout paths and test restore apps/server/src/workspace/TaskFolders.ts, apps/server/src/workspace/TaskFolders.test.ts
The real helper calls NodeFSP.realpath and falls back to the input path if resolution fails. The test uses alternate-case paths and asserts that restoration does not invoke the recreation callback.
This change resolves checkout paths with Node's native realpath so that task folders are restored when a project path's letter case differs from the folder on disk. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual change: multi-repo worktree threads that failed when the project path's letter case differed from disk on case-insensitive volumes. It follows the conventional commit format…
Description check
The description follows the template's sections: Problem, Change, Scope, Verification, and agent attribution. It explains the bug, the native realpath fix, and the linked issue #48418. It gives a deta…
Linked Issues check
[#48418] Requires that worktree turns start when the stored project path differs from the on-disk letter case on macOS. The root cause in the issue is that linkedGitDir compares paths produced by `f…
Out of Scope Changes check
The whole-PR diff (merge base 9ba2879 to head 4adcf02) changes two files. In TaskFolders.ts, the change adds a node:fs/promises im…
Full details: Title check
Explanation
The title names the actual change: multi-repo worktree threads that failed when the project path's letter case differed from disk on case-insensitive volumes. It follows the conventional commit format and matches the linked issue and the diff's realpath fix in linkedGitDir.
Full details: Description check
Explanation
The description follows the template's sections: Problem, Change, Scope, Verification, and agent attribution. It explains the bug, the native realpath fix, and the linked issue #48418. It gives a detailed reproduction on a casefold volume and lists the test commands and results. The Evidence section is explicitly pending, and the macOS run was not performed. The template asks for before/after evidence for UI changes, but this is a server fix, so this gap is non-critical. The Scope section links the issue but does not explicitly say why a bug fix is needed without one. That is covered by the linked issue.
Full details: Linked Issues check
Explanation
[#48418] Requires that worktree turns start when the stored project path differs from the on-disk letter case on macOS. The root cause in the issue is that linkedGitDir compares paths produced by fileSystem.realPath, which keeps the input case. The diff at the reviewed head replaces that helper in linkedGitDir with NodeFSP.realpath from node:fs/promises, which calls the native realpath binding. On macOS this returns the on-disk case, so the .git pointer written by Git and the paths built from the stored project path compare equal. This matches the issue's suggested fs.realpath.native fix. The added test 'resumes a thread whose project path differs from disk only in letter case' covers the reported path shape. It returns early on case-sensitive volumes. The author reports it fails before the fix on a casefold ext4 volume. After-fix behavior on a case-insensitive volume and on macOS was not run, so the runtime result is not executed here. Missing sub-requirement: none identified in code. The issue's workaround-row cleanup is not a coding requirement of this PR.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base 9ba2879 to head 4adcf02) changes two files. In TaskFolders.ts, the change adds a node:fs/promises import with a diagnostic suppression comment and changes only the local real helper inside linkedGitDir. In TaskFolders.test.ts, it adds one regression test for the reported case. Both changes directly support the objective in #48418. The PR description's 'Not in this change' items (Linux casefold volumes, other fileSystem.realPath comparisons such as wasLinked) are left unchanged, so they add no out-of-scope code.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between efbd62a and 4adcf02.
Files selected for processing: 2
apps/server/src/workspace/TaskFolders.test.ts
apps/server/src/workspace/TaskFolders.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The automated pipeline stopped on this pull request and will not merge it:
the fix is written and reviewed, but proving it needs something no worker has:
Permanent blocker: The reproduction depends on macOS APFS case-insensitive path resolution and a real app run with captures; no Mac lease became available during this run.
Checked on macOS (case-insensitive APFS), Node 26, Git 2.50, since no Mac was available for the PR. Your test 'resumes a thread whose project path differs from disk only in letter case' fails on 9ba2879 with TaskFolderCheckoutBlockedError: The thread's folder holds a separate checkout instead of the thread's worktree. Move it away and try again. (TaskFolders.ts:1759), and with 4adcf02 all 45 cases in TaskFolders.test.ts pass. A second test with the same setup (project and tracked folder added as <tmp>/developer/... for <tmp>/Developer/..., then restore with both worktrees in place) also fails on main and passes with this change.
This branch has not been deployed
No deployments
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
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
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.
On macOS (and other case-insensitive volumes), a project added with a path whose letter case differs from the folder on disk (for example
~/developer/appfor~/Developer/app) made every turn in a multi-repo worktree thread fail with "The thread's folder holds a separate checkout instead of the thread's worktree." Git writes a worktree's.gitpointer in the case on disk, andlinkedGitDircompared it as a string with paths built from the stored project path. Those paths went through Effect'sFileSystem.realPath, Node's JS realpath, which does not change letter case.linkedGitDirnow resolves paths with Node's native realpath, which returns the case on disk on macOS and Windows, so T3's own worktrees are recognised again.Fixes #48418
Reproduction on main
Commit 9ba2879 (origin/main). No Mac was free in the shared pool (two 20-minute waits), so I made a case-insensitive volume on the Linux VM instead: a 512 MB ext4 loop image formatted with
-O casefold, mounted, and a directory in it markedchattr +F. I checked that it behaves like macOS APFS by creatingDeveloper/and confirmingdeveloper/resolves. I added one test to apps/server/src/workspace/TaskFolders.test.ts ('resumes a thread whose project path differs from disk only in letter case'). It uses the real TaskFolders service, real git and real files: it makes repositories at<tmp>/Developer/appand<tmp>/Developer/lib, sets the project workspaceRoot to<tmp>/developer/appand the tracked folder to<tmp>/developer/lib(lowercase d, as in the report), creates a worktree task folder on branchfeaturewith lib selected, then callsrestorewith both worktrees still in place. Run:TMPDIR=<casefold dir> vp test run src/workspace/TaskFolders.test.ts -t "letter case"in apps/server. Result: it fails withTaskFolderCheckoutBlockedError: The thread's folder holds a separate checkout instead of the thread's worktree. Move it away and try again., thrown at TaskFolders.ts:1759 fromrecreateMissingbecauselinkedGitDirreturned null. That is the reporter's error and stack. On a case-sensitive volume, such as Linux CI, the lowercase path does not exist, so the test returns early and passes. I did not run the desktop app on macOS.Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
TMPDIR=<casefold ext4 dir> vp test run src/workspace/TaskFolders.test.ts -t "letter case"(apps/server, before the fix): fails with TaskFolderCheckoutBlockedError at TaskFolders.ts:1759, the reported bugvp test run src/workspace/TaskFolders.test.ts(apps/server, after the fix, case-sensitive tmp): 44 passed, 1 skippedvp run typecheck(apps/server): passes, no errors in TaskFolders.tsvp run check:changed: fmt, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all passNot in this change
fileSystem.realPathpath comparisons in TaskFolders.ts (for examplewasLinkedin add-repository) may have the same case sensitivity, but no report reaches them.Who did the work
Run by the t3code factory in T3 Code.