The best way to control Claude Code, Codex and more from any computer or phone
fix(server): storage cleanup's merge-check fetch no longer times out at 30 s or starts git gc (#38174)
Julius Marminge committed
Nov 17, 2026 at 07:29 UTC
47888ec2269408b6e749d7d0bfa30e95a572ae52
2 files changed
+31
-10
apps/server/src/vcs/GitVcsDriverCore.test.ts
+15
-2
@@ -5444,7 +5444,11 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
5444
}),
5445
);
5446
5447
- it.effect("does not start Git auto-maintenance from background upstream fetches", () =>
5447
+ it.effect.each([
5448
+ { fetch: "statusDetailsRemote" },
5449
+ // Storage cleanup's merge check fetches the default branch on every sweep.
5450
+ { fetch: "fetchRemoteTrackingBranch" },
5451
+ ] as const)("does not start Git auto-maintenance from background $fetch fetches", ({ fetch }) =>
5452
Effect.gen(function* () {
5453
const cwd = yield* makeTmpDir();
5454
const remote = yield* makeTmpDir("git-vcs-driver-remote-");
@@ -5461,12 +5465,21 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
5465
yield* git(cwd, ["config", "gc.autoPackLimit", "1"]);
5466
yield* git(cwd, ["config", "gc.autoDetach", "false"]);
5467
yield* git(cwd, ["config", "maintenance.autoDetach", "false"]);
5468
+ // The test template's global config turns auto-maintenance off.
5469
+ yield* git(cwd, ["config", "maintenance.auto", "true"]);
5470
const packCount = git(cwd, ["count-objects", "-v"]).pipe(
5471
Effect.map((stdout) => stdout.match(/^packs: (\d+)$/m)?.[1]),
5472
);
5473
assert.equal(yield* packCount, "2");
5474
5469
- yield* (yield* GitVcsDriver.GitVcsDriver).statusDetailsRemote(cwd);
5475
+ const driver = yield* GitVcsDriver.GitVcsDriver;
5476
+ if (fetch === "statusDetailsRemote") yield* driver.statusDetailsRemote(cwd);
5477
+ else
5478
+ yield* driver.fetchRemoteTrackingBranch({
5479
+ cwd,
5480
+ remoteName: "origin",
5481
+ remoteBranch: initialBranch,
5482
+ });
5483
5484
assert.equal(yield* packCount, "2");
5485
}),
apps/server/src/vcs/GitVcsDriverCore.ts
+16
-8
@@ -5839,14 +5839,22 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
5839
5840
const fetchRemoteTrackingBranch: GitVcsDriver.GitVcsDriver["Service"]["fetchRemoteTrackingBranch"] =
5841
Effect.fn("fetchRemoteTrackingBranch")(function* (input) {
5842
- yield* runGit("GitVcsDriver.fetchRemoteTrackingBranch", input.cwd, [
5843
- "fetch",
5844
- "--quiet",
5845
- "--no-tags",
5846
- "--",
5847
- input.remoteName,
5848
- `+refs/heads/${input.remoteBranch}:refs/remotes/${input.remoteName}/${input.remoteBranch}`,
5849
- ]);
5842
+ // Storage cleanup runs this every sweep: like the status fetch, a killed fetch strands a
5843
+ // `tmp_pack_*` and a failing `gc --auto` repeats each time, so allow time and skip gc.
5844
+ yield* runGit(
5845
+ "GitVcsDriver.fetchRemoteTrackingBranch",
5846
+ input.cwd,
5847
+ [
5848
+ "fetch",
5849
+ "--quiet",
5850
+ "--no-tags",
5851
+ "--no-auto-gc",
5852
+ "--",
5853
+ input.remoteName,
5854
+ `+refs/heads/${input.remoteBranch}:refs/remotes/${input.remoteName}/${input.remoteBranch}`,
5855
+ ],
5856
+ { timeoutMs: FETCH_REMOTE_TIMEOUT_MS },
5857
+ );
5858
});
5859
5860
const setBranchUpstream: GitVcsDriver.GitVcsDriver["Service"]["setBranchUpstream"] = Effect.fn(