fix(ripgrep): return partial results instead of failing when output exceeds maxBuffer - #6
Merged
Conversation
…xceeds maxBuffer On large repos ripgrep stdout could exceed the 200 KB maxBuffer, which rejected the whole search and left the tree with zero todos. Raise the default taskvision.ripgrep.ripgrepMaxBuffer to 20480 (20 MB) and, when the limit is still hit, flag the results as truncated, stop the process, and resolve with the partial matches so the tree still populates. A one-time non-fatal warning advises raising the limit; the SIGINT interrupted path is preserved. Fixes #4 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
# Conflicts: # agent/tasks.md # agent/timeline.md # package.json # package.nls.json # package.nls.zh-cn.json # src/ripgrep.js
# Conflicts: # agent/tasks.md # agent/timeline.md
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.
Summary
On large repositories, ripgrep's stdout could exceed the default 200 KB
maxBuffer. When that happened,ripgrep.searchkilled the process and rejected the entire promise, so the TaskVision tree showed zero todos — the symptom reported in the issue.This PR raises the default buffer and, more importantly, degrades gracefully when the limit is still exceeded so the tree keeps populating.
Changes
package.json— Raise the defaulttaskvision.ripgrep.ripgrepMaxBufferfrom200to20480(20 MB).package.nls.json/package.nls.zh-cn.json— Update the setting description to note the new 20 MB default and that it can be raised further; TaskVision now shows partial results and warns instead of failing.src/ripgrep.js— On buffer overflow, set atruncatedflag, stop the process (SIGINT), and in theclosehandler resolve with the partialformatResults(...)(array carriestruncated+maxBuffermarkers) instead of rejecting. A clear warning is logged tooptions.outputChannel. The genuine SIGINTinterruptedpath and non-zero exit-code handling are preserved.src/extension.js—search()detectsmatches.truncatedand shows a one-time, non-fatal warning advising the user to raisetaskvision.ripgrep.ripgrepMaxBuffer(reuses the existingOpen Settingspattern). The one-time flag resets at the start of eachrebuild().test/ripgrep.tests.js— New regression test asserting that a buffer overflow resolves with partial results (truncatedflag set) rather than rejecting.Verification
npm test— 120 passing (119 baseline + 1 new truncation test; the existingripgrep.kill forwards SIGINTinterrupted test still passes, confirming no regression).npm run webpack— build succeeded.Fixes #4
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com