From 44d4a2b361a5cbfe8182e51ddb8ae4b028483601 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 3 Dec 2026 20:26:38 +0000 Subject: [PATCH 1/2] test(server): restore a task folder whose project path differs from disk in letter case Reproduces #48418 on case-insensitive volumes (macOS). Co-Authored-By: Claude Opus 5.5 --- apps/server/src/workspace/TaskFolders.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/apps/server/src/workspace/TaskFolders.test.ts b/apps/server/src/workspace/TaskFolders.test.ts index 43e140c70d51c..fd64e68b7a587 100644 --- a/apps/server/src/workspace/TaskFolders.test.ts +++ b/apps/server/src/workspace/TaskFolders.test.ts @@ -1386,6 +1386,31 @@ it.live("resumes once an excluded dependency's worktree is replaced by a clone", ), ); +// Git writes a worktree's `.git` with the folder's case on disk, not the case the project was added with. +it.live("resumes a thread whose project path differs from disk only in letter case", () => + withState((state) => + Effect.gen(function* () { + const { fileSystem, path, tmp, repository } = yield* fixture; + const app = yield* repository("Developer/app"); + const lib = yield* repository("Developer/lib"); + const lower = (folder: string) => + path.join(tmp, path.relative(tmp, folder).replace("Developer", "developer")); + // Only a case-insensitive volume, like macOS's default, has both spellings. + if (!(yield* fileSystem.exists(lower(app)))) return; + state.workspaceRoot = lower(app); + state.trackedFolders = tracked(lower(lib)); + const { taskFolder } = yield* create("feature", [{ path: lower(lib) }]); + + yield* (yield* TaskFolders.TaskFolders).restore({ + taskFolder, + branch: "feature", + projectCommands: "permitted", + recreate: () => Effect.die("nothing is missing"), + }); + }), + ), +); + // A project whose `t3.json` lays its own folder out, with a marker file per command that ran. const layoutProject = Effect.gen(function* () { const { fileSystem, path, tmp, run, repository } = yield* fixture; From 4adcf0278081c2f776930e7490aca027681353f8 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 3 Dec 2026 21:02:43 +0000 Subject: [PATCH 2/2] fix(server): multi-repo worktree threads start when the project path's letter case differs from disk Co-Authored-By: Claude Opus 5.5 --- apps/server/src/workspace/TaskFolders.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/server/src/workspace/TaskFolders.ts b/apps/server/src/workspace/TaskFolders.ts index 1b85a9c7ab450..c9c889a86a5de 100644 --- a/apps/server/src/workspace/TaskFolders.ts +++ b/apps/server/src/workspace/TaskFolders.ts @@ -1,3 +1,6 @@ +// @effect-diagnostics-next-line nodeBuiltinImport:off -- FileSystem.realPath is Node's JS realpath, which keeps the letter case it is given. +import * as NodeFSP from "node:fs/promises"; + import { GitCommandError, isRuntimeModeAbove, @@ -569,8 +572,9 @@ const make = Effect.gen(function* () { // rename: a worktree linked to the repository, on the thread's branch. Null when it is. /** The checkout's own Git directory when it is a worktree linked to its repository. */ const linkedGitDir = Effect.fnUntraced(function* (checkout: TaskFolderCheckout) { + // Git records the case on disk; native realpath corrects a project path typed in another case. const real = (target: string) => - fileSystem.realPath(target).pipe(Effect.orElseSucceed(() => target)); + Effect.promise(() => NodeFSP.realpath(target).catch(() => target)); const resolved = yield* gitDirPointer(checkout.worktreePath); if ( resolved === null ||