The best way to control Claude Code, Codex and more from any computer or phone
fix(server): avoid expensive diff minimization in status refreshes (#21872)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Lakshmi Tanmay committed
Oct 21, 2026 at 18:45 UTC
370b9ae793bbf2bd7062001bc0b00653dcd61d03
2 files changed
+61
-1
apps/server/src/vcs/GitVcsDriverCore.test.ts
+60
@@ -2100,6 +2100,66 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2100
}),
2101
);
2102
2103
+ it.effect("reads Changes totals without minimizing and keeps review diffs minimal", () =>
2104
+ Effect.gen(function* () {
2105
+ const cwd = yield* makeTmpDir();
2106
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
2107
+ const driver = yield* GitVcsDriver.GitVcsDriver;
2108
+ yield* git(cwd, ["config", "diff.algorithm", "myers"]);
2109
+ // Repeated lines make the default and minimal algorithms choose different edits.
2110
+ const lines = Array.from({ length: 2000 }, (_, index) => index);
2111
+ yield* writeTextFile(
2112
+ cwd,
2113
+ "repeated.txt",
2114
+ lines.map((index) => `${(index ^ (index >> 3)) % 16}\n`).join(""),
2115
+ );
2116
+ yield* git(cwd, ["add", "."]);
2117
+ yield* git(cwd, ["commit", "-m", "repeated lines"]);
2118
+ yield* git(cwd, ["checkout", "-b", "feature/totals"]);
2119
+ yield* writeTextFile(
2120
+ cwd,
2121
+ "repeated.txt",
2122
+ lines.map((index) => `${(index ^ (index >> 5)) % 16}\n`).join(""),
2123
+ );
2124
+ const defaultStat = yield* git(cwd, ["diff", "--numstat", "HEAD", "--"]);
2125
+ const minimalStat = yield* git(cwd, ["diff", "--minimal", "--numstat", "HEAD", "--"]);
2126
+ assert.notEqual(defaultStat, minimalStat);
2127
+ const [insertions, deletions] = defaultStat.split("\t");
2128
+ const status = yield* driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
2129
+ assert.deepStrictEqual(status.branchChanges, {
2130
+ baseRef: initialBranch,
2131
+ insertions: Number(insertions),
2132
+ deletions: Number(deletions),
2133
+ });
2134
+
2135
+ const [additions, removals] = minimalStat.split("\t");
2136
+ const minimalPatch = yield* git(cwd, [
2137
+ "diff",
2138
+ "--minimal",
2139
+ "--patch",
2140
+ "--no-color",
2141
+ "--no-ext-diff",
2142
+ "--no-textconv",
2143
+ "--src-prefix=a/",
2144
+ "--dst-prefix=b/",
2145
+ "HEAD",
2146
+ "--",
2147
+ ]);
2148
+ const preview = yield* driver.getReviewDiffPreview({ cwd });
2149
+ for (const source of preview.sources) {
2150
+ assert.deepStrictEqual(source.files, [
2151
+ {
2152
+ path: "repeated.txt",
2153
+ previousPath: null,
2154
+ additions: Number(additions),
2155
+ deletions: Number(removals),
2156
+ },
2157
+ ]);
2158
+ assert.strictEqual(source.diff.trim(), minimalPatch);
2159
+ }
2160
+ }),
2161
+ );
2162
+
2163
it.effect.skipIf(!symlinksSupported)(
2164
"lists the real repository through a symlink when a decoy repo occupies the lexical common dir",
2165
() =>
apps/server/src/vcs/GitVcsDriverCore.ts
+1
-1
@@ -77,7 +77,6 @@ const REVIEW_DIFF_ARGS = [
77
"--no-color",
78
"--no-ext-diff",
79
"--no-textconv",
80
- "--minimal",
80
...PATCH_RENDER_PREFIX_ARGS,
81
];
82
const STATUS_UPSTREAM_REFRESH_INTERVAL = Duration.seconds(15);
@@ -3080,6 +3079,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3079
3080
const diffArgs = [
3081
...REVIEW_DIFF_ARGS,
3082
+ "--minimal",
3083
...(input.ignoreWhitespace ? ["--ignore-all-space"] : []),
3084
];
3085
const readStats = Effect.fn("GitVcsDriver.getReviewDiffPreview.stat")(function* (