feat: guard against OOM on oversized workspace roots#1
Merged
Conversation
Add version-control, dependency, build-output, language-cache, and home-directory bloat dirs (AppData, Library, .cache, .cargo, vendor, etc.) to SKIP_DIRS so a misaimed workspace root pulls in far less.
Bound a single index pass to CONTINUUM_MAX_FILES (default 50000, 0 disables). A workspace rooted at a huge tree no longer loads unbounded symbols, tokens, and embeddings into memory; truncation is logged.
Refuse background indexing and recursive watching when the workspace root is a filesystem root or the user's home directory, the cases that trigger OOM. Memory and on-demand text search still work; override with CONTINUUM_ALLOW_LARGE_ROOT=1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Indexer walks the whole tree via
ignore::WalkBuilderwith no guard on root size. Adapter defaults the workspace to cwd, so opening an agent session inC:\or%USERPROFILE%makes the daemon index the entire drive/home — every file content, symbol, BM25 token, and embedding lives in RAM → OOM. Only per-file defenses existed (SKIP_DIRS,MAX_FILE_BYTES).Changes (3 layers)
continuum-daemon): refuse background indexing and recursive watching when the workspace root is a filesystem root or the user home dir. Daemon still serves memory + on-demand text search. OverrideCONTINUUM_ALLOW_LARGE_ROOT=1.continuum-indexer): bound a pass toCONTINUUM_MAX_FILES(default 50000,0= unlimited); truncation logged. Backstop for big trees that arent home/drive.SKIP_DIRS: add VCS, dependency, build-output, language-cache, and home bloat dirs (AppData,Library,.cache,.cargo,vendor, …).Plus README env-var docs.
Verify
cargo build -p continuum-daemon -p continuum-indexer— clean.cargo test -p continuum-indexer— 18 passed (newSKIP_DIRSassertions for.venv,AppData).--workspace C:\→ logskipping automatic indexing: ... is a filesystem root, daemon stays up; setCONTINUUM_ALLOW_LARGE_ROOT=1→ indexes (capped at 50k).Risks
out/build/Libraryas skip names could hide a real source dir sharing those names; mitigated by the0-disable cap and standard naming.