fix(cli): prevent OOM crash by limiting file search traversal and adding timeout (#16696)

This commit is contained in:
Gal Zahavi
2026-01-15 12:04:22 -08:00
committed by GitHub
parent 48fdb9872f
commit e77d7b2e1e
7 changed files with 126 additions and 3 deletions
@@ -24,6 +24,7 @@ export interface FileSearchOptions {
enableRecursiveFileSearch: boolean;
disableFuzzySearch: boolean;
maxDepth?: number;
maxFiles?: number;
}
export class AbortError extends Error {
@@ -109,7 +110,9 @@ class RecursiveFileSearch implements FileSearch {
cache: this.options.cache,
cacheTtl: this.options.cacheTtl,
maxDepth: this.options.maxDepth,
maxFiles: this.options.maxFiles ?? 20000,
});
this.buildResultCache();
}