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, 21:00 UTC
fix(server): new worktrees survive git printing over 1 MB (#34889)
Julius Marminge committed
Nov 12, 2026 at 00:01 UTC
080b10c408d68825eb648e9aaf53719590052051
2 files changed
+42
apps/server/src/vcs/GitVcsDriverCore.test.ts
+35
@@ -4788,6 +4788,41 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4788
assert.isTrue(Result.isSuccess(result), "worktree creation failed in the hook");
4789
}),
4790
);
4791
+ // regression: #25367 a checkout that writes over 1 MB to stderr failed on the output cap
4792
+ it.effect.each([false, true])(
4793
+ "creates the worktree when git worktree add writes over 1 MB (progress: %s)",
4794
+ (withProgress) =>
4795
+ Effect.gen(function* () {
4796
+ const cwd = yield* makeTmpDir();
4797
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
4798
+ const fs = yield* FileSystem.FileSystem;
4799
+ const path = yield* Path.Path;
4800
+ const driver = yield* GitVcsDriver.GitVcsDriver;
4801
+ yield* writeTextFile(
4802
+ cwd,
4803
+ ".git/hooks/post-checkout",
4804
+ "#!/bin/sh\nhead -c 1100000 /dev/zero | tr '\\0' x >&2\nexit 0\n",
4805
+ );
4806
+ yield* fs.chmod(path.join(cwd, ".git/hooks/post-checkout"), 0o755);
4807
+ const worktreePath = path.join(yield* makeTmpDir("git-worktrees-"), "noisy");
4808
+
4809
+ const result = yield* driver
4810
+ .createWorktree(
4811
+ { cwd, path: worktreePath, refName: initialBranch, newRefName: "t3/noisy" },
4812
+ withProgress ? { progress: { onCheckoutProgress: () => Effect.void } } : undefined,
4813
+ )
4814
+ .pipe(Effect.result);
4815
+
4816
+ assert.isTrue(
4817
+ Result.isSuccess(result),
4818
+ Result.isFailure(result) ? result.failure.message : "",
4819
+ );
4820
+ assert.equal(
4821
+ yield* git(worktreePath, ["rev-parse", "HEAD"]),
4822
+ yield* git(cwd, ["rev-parse", "HEAD"]),
4823
+ );
4824
+ }),
4825
+ );
4826
it.effect("refreshes a new worktree's index once its checkout second is over", () =>
4827
Effect.gen(function* () {
4828
const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+7
@@ -198,6 +198,7 @@ interface ExecuteGitOptions {
198
env?: NodeJS.ProcessEnv | undefined;
199
maxOutputBytes?: number | undefined;
200
appendTruncationMarker?: boolean | undefined;
201
+ keepLineCallbacksAfterTruncation?: boolean | undefined;
202
progress?: GitVcsDriver.ExecuteGitProgress | undefined;
203
writesSharedConfig?: boolean | undefined;
204
}
@@ -1181,6 +1182,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1182
...(options.appendTruncationMarker !== undefined
1183
? { appendTruncationMarker: options.appendTruncationMarker }
1184
: {}),
1185
+ ...(options.keepLineCallbacksAfterTruncation
1186
+ ? { keepLineCallbacksAfterTruncation: true }
1187
+ : {}),
1188
...(options.progress ? { progress: options.progress } : {}),
1189
...(options.writesSharedConfig ? { writesSharedConfig: true } : {}),
1190
}).pipe(
@@ -4486,6 +4490,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
4490
// Large checkouts and post-checkout hooks can legitimately run for many
4491
// minutes; a fixed deadline kills them and leaves an orphaned worktree.
4492
timeoutMs: null,
4493
+ // Hooks and filter drivers may print without bound; only progress lines are read.
4494
+ appendTruncationMarker: true,
4495
+ keepLineCallbacksAfterTruncation: true,
4496
...(onCheckoutProgress
4497
? {
4498
// Git only prints checkout progress when stderr is a tty or the