Skip to content

Commit 3ba8af2

Browse files
t3dotggclaude
andcommitted
fix(server): name the real cost of indexing untracked files
Measured on 50k untracked files: git add --pathspec-from-file took 26 of 29.5 seconds. Also guard the test against an empty source list. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 60d16a6 commit 3ba8af2

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
21762176
assert.isUndefined(status.branchChanges);
21772177

21782178
const preview = yield* driver.getReviewDiffPreview({ cwd });
2179+
assert.isNotEmpty(preview.sources);
21792180
assert.isTrue(preview.sources.every((source) => source.truncated));
21802181
}),
21812182
);

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ const RANGE_DIFF_SUMMARY_MAX_OUTPUT_BYTES = 19_000;
5959
const RANGE_DIFF_PATCH_MAX_OUTPUT_BYTES = 59_000;
6060
const REVIEW_DIFF_PATCH_MAX_OUTPUT_BYTES = 120_000;
6161
const REVIEW_METADATA_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
62-
// Counting untracked files copies the index and stats every one of them on each status refresh.
63-
// Past this many, the cost is a CPU spike per agent turn, so the totals are reported incomplete.
62+
// Every status refresh adds the untracked files to a temporary index, and git add's cost grows
63+
// much faster than the file count (50k files took about 30 seconds). Past this many, the
64+
// totals are reported incomplete instead.
6465
const REVIEW_UNTRACKED_MAX_FILES = 5_000;
6566
const REVIEW_DIFF_FILE_MAX_OUTPUT_BYTES = 1024 * 1024;
6667
// Patches the clients render are parsed against git's default a/ and b/ path

0 commit comments

Comments
 (0)