perf(vscode): exclude patch from diff hash to reduce memory overhead (#8967)

* perf(vscode): exclude patch from diff hash to reduce memory overhead

The hashFileDiffs function included diff.patch in its hash key, pulling
in multi-MB payloads generated by opencode's context: MAX_SAFE_INTEGER
setting. The extension never renders the patch string — VS Code's native
diff editor uses before/after file contents instead — so the field was
pure overhead.

Closes #8951

* chore(kilo-docs): update source links
This commit is contained in:
Marius
2026-04-15 12:46:09 +02:00
committed by GitHub
parent 84a6284424
commit bd4d85229e
2 changed files with 16 additions and 3 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
# Source Code Links
<!-- Auto-generated by script/extract-source-links.ts — DO NOT EDIT -->
<!-- 79 unique URLs extracted from extension and CLI source -->
<!-- 80 unique URLs extracted from extension and CLI source -->
- <https://api.apertis.ai/v1>
<!-- packages/opencode/src/provider/model-cache.ts -->
@@ -55,6 +55,8 @@
<!-- packages/kilo-vscode/webview-ui/src/components/settings/AboutKiloCodeTab.tsx -->
- <https://github.com/Kilo-Org/kilocode/issues/6986>
<!-- packages/kilo-vscode/src/agent-manager/constants.ts -->
- <https://github.com/Kilo-Org/kilocode/issues/8951>
<!-- packages/kilo-vscode/src/review-utils.ts -->
- <https://github.com/Kilo-Org/kilocode/issues/new?template=bug-report.yml>
<!-- packages/opencode/src/cli/cmd/tui/app.tsx -->
- <https://github.com/Kilo-Org/kilocode/issues/new/choose>
+13 -2
View File
@@ -42,6 +42,19 @@ export async function resolveLocalDiffTarget(
return { directory: root, baseBranch: base }
}
/**
* Produces a lightweight hash key for a list of file diffs.
*
* Intentionally excludes `diff.patch` — the extension never renders the
* unified-diff patch string (VS Code's native diff editor uses before/after
* file contents instead). Including it would pull in multi-MB payloads
* generated by opencode's `context: MAX_SAFE_INTEGER` setting, inflating
* memory for no benefit. The remaining fields (file, status, additions,
* deletions, tracked, generatedLike, summarized, stamp) are sufficient to
* detect when the diff list has meaningfully changed.
*
* See: https://github.com/Kilo-Org/kilocode/issues/8951
*/
export function hashFileDiffs(
diffs: Array<
SnapshotFileDiff & {
@@ -54,7 +67,6 @@ export function hashFileDiffs(
): string {
return diffs
.map((diff) => {
const content = diff.summarized ? "" : diff.patch
return [
diff.file,
diff.status,
@@ -64,7 +76,6 @@ export function hashFileDiffs(
diff.generatedLike ? "generated" : "source",
diff.summarized ? "summary" : "detail",
diff.stamp ?? "",
content,
].join(":")
})
.join("|")