@devries-cameron20 / t3code-1 / commits / 1e3e3a8dfd
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): allow large git status metadata (#25207)

Co-authored-by: Alex Southwell <4596216+saphid@users.noreply.github.com>

maria committed Oct 29, 2026 at 17:53 UTC 1e3e3a8dfd87cfc085828a7ae4de995b7addcb4f
2 files changed +55 -13
apps/server/src/vcs/GitVcsDriverCore.test.ts
+39
@@ -1003,6 +1003,45 @@ describe("rejected git refs", () => {
1003 });
1004
1005 it.layer(layerTest)("GitVcsDriver core integration", (it) => {
1006 + it.effect("keeps large change sets available for status and commit preparation", () =>
1007 + Effect.gen(function* () {
1008 + const cwd = yield* makeTmpDir();
1009 + const fs = yield* FileSystem.FileSystem;
1010 + const path = yield* Path.Path;
1011 + const driver = yield* GitVcsDriver.GitVcsDriver;
1012 + yield* git(cwd, ["init"]);
1013 + yield* git(cwd, ["config", "user.email", "test@test.com"]);
1014 + yield* git(cwd, ["config", "user.name", "Test"]);
1015 + const files = Array.from(
1016 + { length: 6_000 },
1017 + (_, index) => `file-${String(index).padStart(5, "0")}-${"x".repeat(160)}.txt`,
1018 + );
1019 + yield* Effect.forEach(files, (file) => fs.writeFileString(path.join(cwd, file), "before\n"), {
1020 + concurrency: 16,
1021 + discard: true,
1022 + });
1023 + yield* git(cwd, ["add", "."]);
1024 + const unborn = yield* driver.statusDetailsLocal(cwd);
1025 + assert.lengthOf(unborn.workingTree.files, files.length);
1026 + assert.equal(unborn.workingTree.insertions, files.length);
1027 + const initial = yield* driver.commit(cwd, "initial", "");
1028 + assert.match(initial.commitSha, /^[a-f0-9]{40}$/);
1029 + assert.isFalse((yield* driver.statusDetailsLocal(cwd)).hasWorkingTreeChanges);
1030 + yield* Effect.forEach(files, (file) => fs.writeFileString(path.join(cwd, file), "after\n"), {
1031 + concurrency: 16,
1032 + discard: true,
1033 + });
1034 + const status = yield* driver.statusDetailsLocal(cwd);
1035 + assert.isTrue(status.hasWorkingTreeChanges);
1036 + assert.lengthOf(status.workingTree.files, files.length);
1037 + assert.equal(status.workingTree.insertions, files.length);
1038 + assert.equal(status.workingTree.deletions, files.length);
1039 + const context = yield* driver.prepareCommitContext(cwd, undefined, { includePatch: false });
1040 + assert.isNotNull(context);
1041 + assert.isAbove(context!.stagedSummary.length, 1_000_000);
1042 + assert.lengthOf(context!.stagedSummary.split("\n"), files.length);
1043 + }),
1044 + );
1045 describe("structured errors", () => {
1046 it.effect("does not retain git arguments or stderr in command failures", () =>
1047 Effect.gen(function* () {
apps/server/src/vcs/GitVcsDriverCore.ts
+16 -13
@@ -2097,6 +2097,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2097 statusArgs,
2098 {
2099 allowNonZeroExit: true,
2100 + maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES,
2101 },
2102 ).pipe(
2103 Effect.catchTags({
@@ -2137,24 +2138,25 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2138 "GitVcsDriver.statusDetails.numstat",
2139 cwd,
2140 ["diff-index", "-M", "--numstat", "-z", "HEAD", "--"],
2140 - { allowNonZeroExit: true },
2141 + { allowNonZeroExit: true, maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2142 ).pipe(
2143 Effect.flatMap((result) => {
2144 if (result.exitCode === 0) return Effect.succeed(parseReviewNumstat(result.stdout));
2145 if (isUnbornHeadStderr(result.stderr)) {
2146 return Effect.map(
2147 Effect.all([
2147 - runGitStdout("GitVcsDriver.statusDetails.numstat.unborn", cwd, [
2148 - "diff-files",
2149 - "--numstat",
2150 - "-z",
2151 - ]),
2152 - runGitStdout("GitVcsDriver.statusDetails.numstat.unborn.staged", cwd, [
2153 - "diff",
2154 - "--cached",
2155 - "--numstat",
2156 - "-z",
2157 - ]),
2148 + runGitStdoutWithOptions(
2149 + "GitVcsDriver.statusDetails.numstat.unborn",
2150 + cwd,
2151 + ["diff-files", "--numstat", "-z"],
2152 + { maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2153 + ),
2154 + runGitStdoutWithOptions(
2155 + "GitVcsDriver.statusDetails.numstat.unborn.staged",
2156 + cwd,
2157 + ["diff", "--cached", "--numstat", "-z"],
2158 + { maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2159 + ),
2160 ]),
2161 ([unstagedStdout, stagedStdout]) => [
2162 ...parseReviewNumstat(stagedStdout),
@@ -2444,7 +2446,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2446 "GitVcsDriver.prepareCommitContext.stagedSummary",
2447 cwd,
2448 ["diff", "--cached", "--name-status"],
2447 - { env },
2449 + { env, maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2450 ).pipe(Effect.map((stdout) => stdout.trim()));
2451 if (stagedSummary.length === 0) {
2452 return null;
@@ -2508,6 +2510,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2510 options.progress?.onOutputLine?.({ stream: "stderr", text: line }) ?? Effect.void,
2511 };
2512 yield* executeGit("GitVcsDriver.commit.commit", cwd, args, {
2513 + maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES,
2514 ...(options?.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
2515 ...(progress ? { progress } : {}),
2516 }).pipe(Effect.asVoid);