Repository navigation
Conversation
This was referenced Oct 28, 2026
Collaborator
Author
|
The stat-then-readFile race only lets a file that grows during a millisecond window overshoot the 10 MiB cap by the bytes written in that window, so the practical impact is negligible. As written, the oversized branch also drops main's TOO_LARGE_BLOB/tooLarge (#34882), which would regress the 'diff too large' message, and the PR conflicts with main. Closing under the strict bar. |
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.
ELI5
Opening a changing file in a Git diff can read far more data than the existing 10 MiB limit allows. Enforce the limit while reading so a concurrent writer cannot make Orca load an arbitrarily large file.
What Changed
readWorkingTreeFilenow uses the existingreadNodeFileWithinLimitreader withregularFileOnly: true. The reader checks the opened file, limits buffer capacity, and probes for growth past the limit. Its handle closes on success and failure.An oversized file keeps the existing binary/omitted-body result. Directories remain absent, ENOENT remains a proven deletion, and other failures remain uncacheable reads. No new reader, limit, process, polling, or cache is introduced.
Why
The previous implementation checked
stat(path).sizeand then called unboundedreadFile(path). A build, log writer, or file replacement between those operations could bypass the size guard. The same race exists when a file grows after opening.The regression test uses a real temporary file and schedules its write immediately after the real path stat completes, without timers. It then calls the production blob reader:
The oversized case fails on the original implementation, which reports a normal text blob. This proves the guard was bypassed; it is not an application-wide memory or latency benchmark. The shared reader additionally bounds growth during the read and avoids blocking if a regular-file path is replaced by a FIFO on supported hosts.
Linked Issue
Internal Git performance/resource audit; no existing issue.
Visual Proof
N/A — the existing over-limit file representation is preserved. The change enforces its resource bound during concurrent writes; no renderer component or interaction changes.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/git/source-control/working-tree-blob-read-limit.test.ts src/main/git/status-diff.test.ts src/main/git/status-diff-settled-cache.test.ts src/main/git/source-control/blob-absence-real-git.test.ts --maxWorkers=2Executed locally on Linux with Node 24.22.0 and the project's test runner. Windows/macOS/WSL/SSH were not executed. The reused reader handles platform-specific file-open flags, and this change leaves existing host-path routing intact. Local and remote runtime callers share the same provider implementation; no RPC, preload, mobile, Git-provider, or mixed-version protocol changes are needed. Folder workspaces do not gain any new Git assumptions.
Combined validation: the six-fix interaction stack passed 110 tests across 14 files; final cache controls passed 32 tests across six files. The canonical
ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2at0e0cefa57befinished 27/28 checks, with unit tests failing; all non-unit checks passed. The results cache recorded 72 failures among 2,977 current file/project entries. No complete broad green pass is claimed.Recovery: 61 originally failed files passed 546 tests on rerun. Three original test failures received reviewed test-only budget-fixture/editor-lifecycle corrections. On final combined source
ecc09aa544c, all 29 tests across the four corrected files pass, and changed-code quality reports zero findings across those four files. The four-file incremental gate atd63f823ac17passed 25/26 checks, including unit tests; its sole casting-annotation finding was then corrected and the quality scan rerun successfully. The final follow-up changes only that annotation.Fresh release fixtures recover five of the eight cross-version suites. Three remain unverified: structured agent-session wire, reported lossy terminal snapshot, and runtime-source fence. Their failed attempts hit archive/extraction deadlines (45 seconds), a setup-hook deadline (180 seconds), and teardown RPC errors; the harness and these suites are unchanged from the audit baseline. The initial generated caches also contained missing files after explicit
ENOSPCerrors on tmpfs inodes. A standalone single-ref preparation also hit its extraction deadline. Main-filesystem extraction, disabled shared caching, and serial retries are documented separately; these results do not establish a complete mixed-version integration pass. Earlier focused mobile and actual Git 2.25.5 checks remain separate evidence. Native macOS/Windows, physical mobile devices and live SSH/WSL are also unexecuted coverage gaps.Review