You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(remote-files): cap search replies, say when a diff is too large, and measure a 100 MB read on WSL - #34882
Three follow-ups from auditing large files on WSL hosts:
Searching a remote project with a huge number of matching lines could fail outright. Now it returns as many results as fit and says the list was cut short.
Opening a diff of a text file over 10 MB said "Binary file changed", which is wrong. It now says the file is too large to diff.
The real-WSL CI lane now times reading a 100 MB file through a WSL host and records the server's peak memory, to give us real numbers.
What Changed
Search (files.search RPC, new src/shared/search-result-transport-budget.ts):
Before: a search whose reply passed the remote reply cap (about 4 MiB) failed as a whole with reply_too_large.
After: the host keeps the whole files that fit the request's budget, marks the result truncated: true and recounts totalMatches for what it kept. This matches what files.listAll and quick-open search already do. Local (in-process) callers stay uncapped.
Diff too large (git-blob-read.ts, diff-result.ts, the diff builders, DiffTooLargeNotice):
Before: a side past the 10 MiB read cap came back as isBinary, so the diff said "Binary file changed".
After:
The blob read marks it tooLarge, and the binary diff result carries an optional tooLarge.
Both diff views show "File too large to diff — one version of this file is over 10 MB…".
An image over the cap shows that message too, instead of an empty image compare.
buildDiffResult now builds its binary sides without a type cast.
Lane measurement (wsl-orcad-real-distro-lane.test.ts, plain distro only):
After the shared control connection is up, it writes a 100 MB file, resets orcad's peak RSS (clear_refs), and pages the file with files.readChunk in the editor's 384 KiB chunks over that same socket.
It records the time, chunk count and VmHWM in the receipt.
Record-only: it asserts nothing, and any failure is written into the receipt.
Why
Search: truncating is the existing contract (truncated is already in SearchResult and the UI shows it), so a big search degrades instead of failing.
Too large vs binary: the diff result is wire data that paired clients read. A new optional field is safe: older clients ignore it and keep the binary view, which they showed before.
Measuring first: the read path is chunked and capped by design. The lane will show whether the time and orcad's memory are acceptable before anything is changed.
Linked Issue
N/A (internal).
Visual Proof
N/A: the too-large message is static copy in the existing binary-diff layout. There is no new interaction.
Testing
search-result-transport-budget.test.ts:
a result that fits, or an uncapped local one, is unchanged;
an oversized one keeps a prefix of whole files, under the budget, marked truncated with matching counts.
diff-too-large-real-git.test.ts (real Git): an 11 MB text file is marked tooLarge (and still binary) from the working tree and from the index; a real binary is not marked.
pnpm tc, check:code-quality:changed, the localization checks, and the max-lines, flaky-test and test-runner checks pass. The source-control, diff, files RPC and editor diff suites pass locally. One unrelated real-Git staging test timed out at load 172 and passed on rerun.
The WSL lane runs in CI (this PR touches src/main/wsl/**).
Review
Self-reviewed.
Agent skill upstream boundary
Not applicable.
Notes
Compatibility: both host changes only add optional fields or truncate within the existing contract.
SSH and paired hosts: they run the same host code, so they get the same search cap and too-large marker.
…and measure a 100 MB read on WSL
Follow-ups from the large-file audit (E7):
- files.search had no byte budget: a result past the remote reply cap failed outright with
reply_too_large. It now keeps the whole files that fit and marks the result truncated, as
files.listAll and searchPaths already do. Local callers stay uncapped.
- A diff side past the 10 MiB read cap came back as binary, so the diff said "Binary file
changed" for a large text file. Blob reads mark it `tooLarge`, the binary diff result carries an
optional `tooLarge`, and both diff views say "File too large to diff". Older clients ignore the
field and keep the binary view. buildDiffResult builds its binary sides without a cast.
- The real-WSL lane pages a 100 MB file over the plain distro's shared control socket in the
editor's 384 KiB chunks and records the time, chunk count and orcad's VmHWM. Record-only: it
asserts nothing, and a failure is recorded in the receipt.
Git diff results now identify oversized blobs separately from binary content, and the renderer displays a dedicated notice for those results. The files.search RPC limits results using the requesting client's remote content budget. The WSL lane adds a chunked 100 MiB file-read measurement for non-systemd distros.
Priority: Normal
Merge Risk: Low · up to 8b767
The change is mergeable with bounded follow-up: measurement receipts can be inaccurate, and a truncated search can misleadingly say there are no results.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly summarizes the three main changes: capping remote search replies, reporting oversized diffs, and measuring large WSL reads. It is specific and related to the changeset.
Description check
The description covers the required user impact, implementation details, rationale, testing, visual proof, compatibility, and review notes. It marks the issue as internal and explains why visual proof…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description covers the required user impact, implementation details, rationale, testing, visual proof, compatibility, and review notes. It marks the issue as internal and explains why visual proof is not applicable. The repository checklist is not included, but the description is otherwise substantially complete.
Full details: Docstring Coverage
Explanation
Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 13 functions across 15 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
set -e
nl -ba src/shared/search-result-transport-budget.ts
nl -ba src/main/runtime/rpc/methods/files.ts | sed -n '165,205p'
nl -ba src/renderer/src/components/right-sidebar/SearchResultsPane.tsx | sed -n '70,175p'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'useFileSearchPanel' -e 'SearchResult' src/renderer/src/components/right-sidebar src/renderer/src/runtime | head -80
Repository: stablyai/orca
Length of output: 18145
Suppress the no-results state for truncated searches.
When the first matching file exceeds the remote budget, the RPC returns files: [], totalMatches: 0, and truncated: true. SearchResultsPane displays the truncation label, but its separate totalMatches === 0 branch also displays “No results,” which incorrectly suggests that the search found no matches. Render that state only when the result is not truncated.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Check whether the peak reset succeeded.
asRoot returns a nonzero exit code instead of throwing. If the write to clear_refs fails, the receipt can report an earlier process peak as the read's peak. Check the exit code and record an error when the reset fails. (kernel.org)
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Check each chunk response before recording success.
control.request resolves RPC failures as responses with ok: false; it does not throw them. (raw.githubusercontent.com) A failed or short read therefore still produces a receipt claiming that all 100 MiB were read. Check ok, advance by bytesRead, and record an error for an incomplete read.
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
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.
ELI5
Three follow-ups from auditing large files on WSL hosts:
What Changed
files.searchRPC, newsrc/shared/search-result-transport-budget.ts):reply_too_large.truncated: trueand recountstotalMatchesfor what it kept. This matches whatfiles.listAlland quick-open search already do. Local (in-process) callers stay uncapped.git-blob-read.ts,diff-result.ts, the diff builders,DiffTooLargeNotice):isBinary, so the diff said "Binary file changed".tooLarge, and the binary diff result carries an optionaltooLarge.buildDiffResultnow builds its binary sides without a type cast.wsl-orcad-real-distro-lane.test.ts, plain distro only):clear_refs), and pages the file withfiles.readChunkin the editor's 384 KiB chunks over that same socket.VmHWMin the receipt.Why
truncatedis already inSearchResultand the UI shows it), so a big search degrades instead of failing.Linked Issue
N/A (internal).
Visual Proof
N/A: the too-large message is static copy in the existing binary-diff layout. There is no new interaction.
Testing
search-result-transport-budget.test.ts:diff-too-large-real-git.test.ts(real Git): an 11 MB text file is markedtooLarge(and still binary) from the working tree and from the index; a real binary is not marked.pnpm tc,check:code-quality:changed, the localization checks, and the max-lines, flaky-test and test-runner checks pass. The source-control, diff, files RPC and editor diff suites pass locally. One unrelated real-Git staging test timed out at load 172 and passed on rerun.src/main/wsl/**).Review
Self-reviewed.
Agent skill upstream boundary
Notes