Repository navigation
Conversation
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
read-only.
O_WRONLYandO_RDWRopens.copy-up.
Problem
OverlayFS::open()previously ignored itsflagsargument. Opening any inodefrom the base layer called
copy_up_and_update_mapping(), includingO_RDONLYopens made by tools such asgrep,cat, and repository scanners.For regular files, copy-up reads the entire base file and writes it into the
SQLite delta. A read-only repository scan could therefore materialize thousands
of unchanged files even when the agent edited only one or two files.
Change
The base-layer branch now checks the requested access mode:
O_WRONLYorO_RDWR: copy up and open the delta file as before.O_RDONLYand return it withoutcreating a delta file or origin mapping.
O_RDONLYis zero, so the implementation detects write access throughO_WRONLYandO_RDWRrather than testingO_RDONLYdirectly.The pass-through path intentionally supplies
O_RDONLYinstead of forwardingall caller flags. On Linux,
HostFSreopens an inode through/proc/self/fd/<fd>, which is a symlink; forwardingO_NOFOLLOWcan otherwisecause
ELOOPfor read-oriented tools such as recursive copy operations.Tests
Added two Rust SDK regression tests:
test_overlay_read_only_open_does_not_copy_uptest_overlay_read_write_open_copies_upTargeted test result:
Measured impact
The released
v0.6.4binary and a binary containing this change were comparedon five SWE-bench instances. “From base” counts file content associated with an
fs_originrow and excludes files newly created by the agent.django-14999django-11179matplotlib-23913sklearn-13497sympy-16503The remaining patched footprint is primarily agent-created cache data rather
than read-induced repository copy-up.
Additional validation
The patched binary was validated on a 58 MB repository containing 1,235 files:
O_RDONLYbase open.