Skip to content

fix(filesearch): limit max files to prevent OOM crashes#2048

Open
echoVic wants to merge 2 commits intoQwenLM:mainfrom
echoVic:fix/oom-file-crawler
Open

fix(filesearch): limit max files to prevent OOM crashes#2048
echoVic wants to merge 2 commits intoQwenLM:mainfrom
echoVic:fix/oom-file-crawler

Conversation

@echoVic
Copy link
Contributor

@echoVic echoVic commented Mar 2, 2026

Fixes #2004

When users type '@' in large projects, the file crawler scans the entire
project directory which can cause OOM crashes if there are too many files.

This fix adds a maxFiles limit (default 100,000) to the crawler to prevent
memory issues. When the limit is exceeded, a warning is shown and only
the first N files are used.

Changes

  • Added maxFiles option to CrawlOptions interface
  • Added file count check and limit in crawl() function
  • Shows debug warning when project has too many files

Testing

  • Verified that file crawling stops at maxFiles limit
  • Prevents OOM in projects with 100k+ files

echoVic added 2 commits March 2, 2026 17:07
…ol args

Fixes QwenLM#2032

The model sometimes adds spaces between Chinese characters and numbers in file paths,
causing file read failures (e.g., '测试 1 文件.txt' instead of '测试1文件.txt').

This fix sanitizes tool arguments by removing such spaces before processing.

Changes:
- Added sanitizeToolArgs() function in turn.ts and subagent.ts
- Applied sanitization to all tool arguments before creating ToolCallRequestInfo
Fixes QwenLM#2004

When users type '@' in large projects, the file crawler scans the entire
project directory which can cause OOM crashes if there are too many files.

This fix adds a maxFiles limit (default 100,000) to the crawler to prevent
memory issues. When the limit is exceeded, a warning is shown and only
the first N files are used.

Changes:
- Added maxFiles option to CrawlOptions interface
- Added file count check and limit in crawl() function
- Shows warning when project has too many files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OOM crashes

1 participant