The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
fix(server): the HEAD watch no longer spawns Git in a removed worktree (#39294)
Co-authored-by: Martin Bergo <14320143+mInrOz@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Martin Bergo committed
Nov 19, 2026 at 20:57 UTC
55e379bb96d8cb1223d9faa453e9ed6f04f2c2f7
2 files changed
+27
-2
apps/server/src/git/GitWorkflowService.test.ts
+23
@@ -56,4 +56,27 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("GitWorkflowServi
56
),
57
),
58
);
59
+
60
+ it.effect("reads no HEAD path from a removed worktree without spawning Git", () =>
61
+ Effect.gen(function* () {
62
+ const fileSystem = yield* FileSystem.FileSystem;
63
+ const parent = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-removed-wt-" });
64
+ const removed = `${parent}/removed`;
65
+ const workflow = yield* GitWorkflowService.GitWorkflowService;
66
+ assert.strictEqual(yield* workflow.headPath(removed), null);
67
+ }).pipe(
68
+ Effect.scoped,
69
+ Effect.provide(
70
+ GitWorkflowService.layer.pipe(
71
+ Layer.provide(Layer.mock(VcsDriverRegistry.VcsDriverRegistry)({})),
72
+ Layer.provide(Layer.mock(GitManager.GitManager)({})),
73
+ Layer.provide(
74
+ Layer.mock(GitVcsDriver.GitVcsDriver)({
75
+ execute: (input) => Effect.die(`spawned Git in ${input.cwd}`),
76
+ }),
77
+ ),
78
+ ),
79
+ ),
80
+ ),
81
+ );
82
});
apps/server/src/git/GitWorkflowService.ts
+4
-2
@@ -398,8 +398,10 @@ export const make = Effect.gen(function* () {
398
invalidateRemoteStatus: gitManager.invalidateRemoteStatus,
399
readRefSnapshot: git.readRefSnapshot,
400
invalidateStatus: gitManager.invalidateStatus,
401
- headPath: Effect.fn("GitWorkflowService.headPath")(function (cwd) {
402
- return git
401
+ headPath: Effect.fn("GitWorkflowService.headPath")(function* (cwd) {
402
+ // Clients keep watching threads whose worktree was removed; spawning there fails noisily.
403
+ if (!(yield* fileSystem.exists(cwd).pipe(Effect.orElseSucceed(() => true)))) return null;
404
+ return yield* git
405
.execute({
406
operation: "GitWorkflowService.headPath",
407
cwd,