Repository navigation
Conversation
An approval could outlive what it was about: while the panel was open, a file could change, and approving then overwrote that change. In Next, Write, Edit, BatchEdit, ApplyPatch and NotebookEdit now note the file's size and modified time before asking. If either differs after the answer, they write nothing and tell the model to read the file again. Only metadata is taken before approval, so nothing is read before it is allowed and devices or huge files cost nothing to look at. The handler opts in through ContentBoundApprovals, which only the Next path applies, so Classic, headless and ACP keep their existing behavior. Refs #411
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 4, 2026
The journey waited for "Write", which the typed prompt also contains. On a slower host the other writer's change could then land before the tool noted the file, so the approval really was current and the Write went through. Refs #411
This was referenced Nov 4, 2026
This branch was successfully deployed
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
In Next, an approval now covers a file as it stood when the approval was asked for. If the file changes while the panel is open,
Write,Edit,BatchEdit,ApplyPatchandNotebookEditwrite nothing and tell the model to read it again.Before this, on a real binary: a
Writeapproved after someone else changed the file replaced their change with the model's text, and the model was told it had succeeded. AnEditwhoseold_stringstill matched applied on top of content nobody had reviewed.This covers the engine-local half of #411's "a changed file invalidates stale review". Nothing here touches protected, daemon-backed approvals.
Context
ContentBoundApprovals, and any other handler keeps the default of no binding. A probe confirmed Classic still overwrites: the same steps leftfrom the modelon Classic andchanged by someoneon Next.How it works
Each tool notes the file's size and modified time before asking, and compares them after the answer.
It takes metadata rather than content on purpose:
ApplyPatchalready promises for path-scoped rules./dev/zero, a FIFO or a huge file costs nothing and can't hang before the panel opens. Reading content first would.The limits are documented in
docs/tools.md:touchalso counts as a change. That fails safe: the model reads again and asks again.Worth a look
While checking this for false refusals, I found a separate bug that is already on main: two
Editcalls to one file in one response lose one of them, while both report success. That reproduces in both renderers and isn't caused or fixed by this PR, which adds no false refusal in that flow (0 refusals across the runs). It's filed as #451 and gets its own PR, because the fix belongs in the shared engine.Validation
from the model, andapproval_bindingfailed 4 of its 6 tests before the tools were wired up.crates/tools/tests/approval_binding.rs: all five tools refuse a changed or deleted file, aWriterefuses a file created during the wait, an unchanged file is written as approved, and handlers that don't opt in keep today's behaviour.cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warnings.cargo test --workspace --locked: 2917 passed, 0 failed.git diff --checkis clean.Not tested: Windows, Linux, network filesystems.