Repository navigation
fix: guard write_file replacements with complete-read proof - #294
Merged
Merged
Conversation
This was referenced Oct 6, 2026
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
Addresses #269.
write_filenow creates missing paths exclusively. Replacing an existing small text file requiresexpected_revisionand an executor-scopedreplace_tokenfrom the same complete byte-moderead_fileresult. Partial reads, old path/content-only calls, stale or cross-session proofs, binary targets, and files beyond one complete read page are rejected before any old content is changed.Writes are staged and synced in a sibling file. New files commit with an atomic create-only hard link; existing files are checked against the digest-backed revision immediately before same-directory rename. Success reports prior and new revisions. The local tool schema, hosted request flag, protocol type, diff preview, and documentation use the same contract. Large-file callers are directed to
patch_file.The documented concurrency limit is that a non-cooperating external writer can change a path between the final revision check and rename; strict serializability against such writers needs a workspace lock.
Verification
npm run buildnpm ci, build, and 93 focused tests: 92 passed, 1 expected permission-mode skip.git diff --checkGitHub Actions jobs on this PR did not start: GitHub annotated them "The job was not started because your account is locked due to a billing issue." This is an account gate, so the Windows and Linux results above provide the executable test evidence.
The companion AETHER-CLOUD PR advertises the new schema and rejects older coding hosts that request
write_filewithout the capability flag.