Repository navigation
[fs-search] grep/glob hard-fail with SEARCH_RAW_OUTPUT_OVERFLOW once raw rg --json stdout exceeds the seam cap — spill-backed full parse
#4407
edisonzerolam
started this conversation in
General
Replies: 1 comment
|
A complementary approach to the same failure, shared under Show Your Plugins: an in-process backend for |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Title:
[fs-search] grep/glob hard-fail with SEARCH_RAW_OUTPUT_OVERFLOW once raw rg --json stdout exceeds the seam cap — spill-backed full parseLabels: bug
Summary
grep/globthrowSEARCH_RAW_OUTPUT_OVERFLOWwhenever raw ripgrep stdout exceedsrawOutputMaxBytes(default 20 MB). The presentation layer already bounds what the model sees (first 250 matches × per-line previews), so truncation was clearly the intended contract — but the transport fails first. Any sufficiently broad search becomes a dead end, and the documented full-result spill (ctx.spillStore.saveText) never gets a chance to run.Why this is easy to hit
node_modules, vendored bundles).--jsonstream, and--max-columns=4000does not change it (max-columns does not apply to JSON output).Root cause
completeStdout()throws whenever the seam reports a lossy read. Meanwhile the subprocess seam already supports complete-stream capture via collect-spill dispositions —stdout: { maxBytes, spill: { maxBytes } }— which the bash/pwsh tools already use. fs-search just doesn't opt in.Proposed fix (~40 lines)
stdout: { maxBytes: rawOutputMaxBytes, spill: { maxBytes: RAW_OUTPUT_SPILL_MAX_BYTES } }(budget 2e8).completeStdout(): on a lossy read withspillPath, return{ spillPath }instead of throwing; keep the hard error only when nothing recoverable exists or the stream exceeds even the spill budget.rawRunLines()async generator: within the in-memory window split the retained text; overflowed runs stream-parse the spill file line-by-line and unlink it when iteration ends.rawRunLines(run.stdout); grep parses records per line.Result: the hard failure becomes "parse everything → let the existing inline caps bound the page", exactly mirroring the existing >250-match cap path. Streams beyond the spill budget still fail as today.
Verified red/green with a harness that mirrors the seam's tail-window/spill semantics plus the real packaged rg binary: pre-patch reproduces the throw on a single 31 MB-line fixture; post-patch returns matches with truncated-line preview markers, spill temps are cleaned up, and small-region behavior is unchanged.
Patch against
lib/index.js(packages/fs/tool-fs-search, @deepseek-ai/dsh-tool-fs-search 0.1.1-rc.2)Environment
DSH desktop install;
@deepseek-ai/*0.1.1-rc.2 (patches applied to the compiledlib/index.js); Windows. Both patches verified red/green with independent harnesses that mirror the seam/compaction semantics against the real packaged rg binary.All reactions