@devries-cameron20 / t3code Mirror · read-only / commits / 6da3ff23d2
Fork 0

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, 19:45 UTC

fix(server): automatic pulls and pull request refresh let slow checkouts finish (#35014)

Julius Marminge committed Nov 12, 2026 at 02:38 UTC 6da3ff23d2f14c9cbaee868903a5740eef30af2f
2 files changed +46 -2
apps/server/src/vcs/GitVcsDriverCore.test.ts
+42
@@ -1167,6 +1167,48 @@ describe("pullCurrentBranch", () => {
1167 ),
1168 ),
1169 );
1170 +
1171 + // A slow smudge filter (LFS) can hold the checkout past 30 seconds; killing it there leaves a
1172 + // half-updated working tree. The automatic pulls and pull request refresh use these defaults.
1173 + it.effect.each(["pull", "merge"] as const)(
1174 + "lets a slow %s checkout finish instead of killing it at 30 seconds",
1175 + (subcommand) =>
1176 + Effect.gen(function* () {
1177 + const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
1178 + const { cwd, remoteHead } = yield* cloneBehindRemote;
1179 + yield* git(cwd, ["fetch", "origin"]);
1180 + const checkoutStarted = yield* Deferred.make<void>();
1181 + const releaseCheckout = yield* Deferred.make<void>();
1182 + const spawner = ChildProcessSpawner.make((command) =>
1183 + Effect.gen(function* () {
1184 + const handle = yield* delegate.spawn(command);
1185 + if (!ChildProcess.isStandardCommand(command) || command.args[0] !== subcommand) {
1186 + return handle;
1187 + }
1188 + yield* Deferred.succeed(checkoutStarted, undefined);
1189 + return ChildProcessSpawner.makeHandle({
1190 + ...handle,
1191 + exitCode: Deferred.await(releaseCheckout).pipe(Effect.andThen(handle.exitCode)),
1192 + });
1193 + }),
1194 + );
1195 + const driver = yield* makeGitVcsDriverCore().pipe(
1196 + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
1197 + );
1198 +
1199 + const move =
1200 + subcommand === "pull"
1201 + ? Effect.asVoid(driver.pullCurrentBranch(cwd))
1202 + : Effect.asVoid(driver.refreshCheckedOutBranch({ cwd, targetCommit: remoteHead }));
1203 + const moving = yield* move.pipe(Effect.forkChild({ startImmediately: true }));
1204 + yield* Deferred.await(checkoutStarted);
1205 + yield* TestClock.adjust("60 seconds");
1206 + yield* Deferred.succeed(releaseCheckout, undefined);
1207 +
1208 + yield* Fiber.join(moving);
1209 + assert.equal(yield* git(cwd, ["rev-parse", "HEAD"]), remoteHead);
1210 + }).pipe(Effect.provide(layerTest)),
1211 + );
1212 });
1213
1214 it.effect("retries an in-flight ref snapshot invalidated by a mutation", () =>
apps/server/src/vcs/GitVcsDriverCore.ts
+4 -2
@@ -2984,8 +2984,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2984 // After a successful pull, HEAD before and after decides the result, so its output is not
2985 // needed. A large fast-forward's diffstat can exceed the output cap, which must not fail a
2986 // pull Git applied.
2987 + // A deadline would kill git mid-checkout (e.g. a slow LFS smudge) and strand a half-updated tree.
2988 const options = {
2988 - timeoutMs: 30_000,
2989 + timeoutMs: null,
2990 appendTruncationMarker: true,
2991 allowNonZeroExit: true,
2992 };
@@ -4773,7 +4774,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
4774 ? ["merge", "--ff-only", input.targetCommit]
4775 : ["reset", "--merge", input.targetCommit],
4776 {
4776 - timeoutMs: 30_000,
4777 + // Killing a slow checkout partway through strands a half-updated working tree.
4778 + timeoutMs: null,
4779 fallbackErrorDetail: "git failed to move the checkout onto the pull request head",
4780 },
4781 );