The best way to control Claude Code, Codex and more from any computer or phone
fix(server): background status fetch no longer breaks a concurrent git pull (#26568)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 12, 2026 at 12:18 UTC
3406bd78d482d3a8700a84b5ef42981e671c2d06
2 files changed
+33
apps/server/src/vcs/GitVcsDriverCore.test.ts
+31
@@ -4416,6 +4416,37 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4416
}),
4417
);
4418
4419
+ it.effect("leaves FETCH_HEAD to the user's own pulls in background upstream fetches", () =>
4420
+ Effect.gen(function* () {
4421
+ const cwd = yield* makeTmpDir();
4422
+ const remote = yield* makeTmpDir("git-vcs-driver-remote-");
4423
+ const updater = yield* makeTmpDir("git-vcs-driver-updater-");
4424
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
4425
+ yield* git(remote, ["init", "--bare"]);
4426
+ yield* git(cwd, ["remote", "add", "origin", remote]);
4427
+ yield* git(cwd, ["push", "-u", "origin", initialBranch]);
4428
+
4429
+ yield* git(updater, ["clone", remote, "."]);
4430
+ yield* git(updater, ["config", "user.email", "test@test.com"]);
4431
+ yield* git(updater, ["config", "user.name", "Test"]);
4432
+ yield* writeTextFile(updater, "remote.txt", "remote\n");
4433
+ yield* git(updater, ["add", "remote.txt"]);
4434
+ yield* git(updater, ["commit", "-m", "remote commit"]);
4435
+ yield* git(updater, ["push", "origin", initialBranch]);
4436
+ const fetchHeadPath = (yield* Path.Path).join(cwd, ".git", "FETCH_HEAD");
4437
+ assert.equal(NodeFS.existsSync(fetchHeadPath), false);
4438
+
4439
+ const status = yield* (yield* GitVcsDriver.GitVcsDriver).statusDetailsRemote(cwd);
4440
+
4441
+ assert.equal(status.behindCount, 1);
4442
+ assert.equal(
4443
+ NodeFS.existsSync(fetchHeadPath),
4444
+ false,
4445
+ "background status fetch wrote .git/FETCH_HEAD, which an overlapping `git pull` merges from",
4446
+ );
4447
+ }),
4448
+ );
4449
+
4450
it.effect("uses origin HEAD for default-branch detection with a non-origin upstream", () =>
4451
Effect.gen(function* () {
4452
const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+2
@@ -1387,6 +1387,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1387
"--quiet",
1388
"--no-tags",
1389
"--no-auto-gc",
1390
+ // FETCH_HEAD is written without a lock; overlapping a user's `git pull` makes that pull fail.
1391
+ "--no-write-fetch-head",
1392
"--",
1393
remoteName,
1394
];