Repository navigation
fix(tools): apply a unique exact edit without a fresh read (T19) - #281
Conversation
|
Requesting an independent review (docs/plans/workflow.md § 4): this slice changes the read-before-edit safety rule (ADR-0057). Focus areas: the unique-exact check in |
T19 (ENG-1030), tool-layer plan § D10. Traced shapes (a)-(i): an exact edit after an outside rewrite, a unique exact edit on an unread file, a duplicate old, a fuzzy-only match, an if_hash mismatch, an anchor-only insert, a write_file overwrite, a mixed batch, and a write that lands between plan and apply. Adds a test-only hook between planning and the apply-time exclusive section.
T19 (ENG-1030), tool-layer plan § D10, ADR-0057. An edit_file batch for a file with no recorded read (or a recorded read of other content) and no if_hash now applies when every edit for that file has an old that occurs exactly once, byte for byte, in the plan-time content and in the text as earlier edits left it. The header gains note=unread or note=changed_since_read, joined with existing notes by a comma before the result is bounded. Anchor-only inserts, fuzzy-only, absent, and repeated olds still refuse not_read/stale_file; an if_hash mismatch is still stale_file, and every if_hash in a batch is checked. Every remaining not_read/stale_file, in edit_file and write_file and at apply time, carries the current h:<12 hex>. The plan-time before_hash and the apply-time re-hash under the exclusive section are unchanged. The edit_file description and the read-before-edit prompt bullet change: tool-schema digest 568cef80… -> cc630679…, prompt 18 -> 19, descriptor golden moves.
T19 (ENG-1030).
T19 (ENG-1030). The plan amended after PR #280 review (3f36c94): a refusal that returns h: would let the next call pass it as if_hash and apply the refused fuzzy edit or overwrite blind. Refusals now name the fix (extend old, or read the lines around the edit) instead, write_file messages are back to their original text, and every refusal regression asserts the current hash is absent. Prompt, ADR-0057, and tools.md follow.
T19 (ENG-1030).
c83a25a to
3b068a5
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b068a5d1a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…' into fix/t19-edit-freshness-exact-match # Conflicts: # docs/plans/progress/root.md # docs/plans/progress/tool-layer.md
… matches - if_hash mismatch on edit_file and write_file no longer names the current hash (it would authorize the refused edit on the next call) - uniqueness counts overlapping occurrences (aa in aaa is two) - a later if_hash no longer erases note=unread/changed_since_read Also renumbers the ADR to 0058 (#277 holds 0057). ENG-1030.
…' into fix/t19-edit-freshness-exact-match
…' into fix/t19-edit-freshness-exact-match # Conflicts: # docs/plans/progress/tool-layer.md
…shness-exact-match
…shness-exact-match
…shness-exact-match
…ommand rules by construction - T19 row owns specs.rs and prompt.rs (both already changed in #281) - T18: assignment allowlist; unknowable command starts judge every suffix
…shness-exact-match
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54e490aac9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…file description ENG-1030.
…n, env NAME=, ENG-1032; T19 overlap case - sed -n on /tmp or .. operands only hints under strict - past the depth cap a clean launcher chain reaches its program (no false Forbidden); env NAME=VALUE carries assignments - timeout process-group cancellation is ENG-1032 (pre-existing) - T19 lists the overlapping-repeat regression (already in #281)
…shness-exact-match # Conflicts: # docs/plans/progress/tool-layer.md
…shness-exact-match
…shness-exact-match
…shness-exact-match
There was a problem hiding this comment.
💡 Codex Review
qq/crates/qq-core/src/tools/edit.rs
Line 448 in 901fb24
When a multi-file batch exception-admits the first file as unread or changed and a later file's temporary write or rename fails, the first mutation has already landed, but the freshness note is interpolated only into this all-success header; the partial_apply return below emits a fresh error without note=unread or note=changed_since_read. This defeats the new contract's visibility guarantee precisely on the partial-failure path, so the error should include the applicable notes for files that were actually applied.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A deletion records an empty written span, so a later old could match bytes joined across it that the model never saw. ENG-1030.
…shness-exact-match # Conflicts: # docs/plans/progress/tool-layer.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db44ecf2c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
T20: placeholder dispatch and leading-cd hint regressions fail on db44ecf; oversized bounds correction guard passes.
…eletion guard ENG-1030.
…shness-exact-match # Conflicts: # docs/plans/progress/tool-layer.md
T20 / ENG-1035. Separate hint eligibility from strict refusal; preserve lossless argument bounds and classify placeholder spill handles before store lookup. Independent review approves implementation; workspace/performance qualification pending.
…shness-exact-match
…ch' into fix/eng-1035-t20-builtin-hints
fix(tools): hint past leading cd and correct placeholder handles (T20)
Spec: D10 T19. Linear: ENG-1030. Merged with #283, #280, and #285 onto main at
e22537040bfb1605ee360881220cf5d8e8408ce3, including final inherited T18 resource and overflow-floor repairs.A unique byte-exact
oldcan apply without a current read, withnote=unreadorchanged_since_read. It must remain unique in both original and current batch text, including overlapping occurrences, and must not consume bytes written or joined by earlier edits. Adjacent disjoint edits still apply.Fuzzy, ambiguous, absent-old and anchor-only edits retain freshness refusals;
write_fileoverwrites retain their guard. Every suppliedif_hashis checked, and stale-hash/freshness refusals omit the current hash. A later hash proof does not erase the earlier freshness warning. Apply-time rehash still rejects concurrent changes before writing.Test-first e12ff7a pinned the acceptance failures. Later regression repairs cover overlapping Unicode matches, hash disclosure, per-edit hash checks, weakest freshness notes, deletion joins and adjacency. Final integrated #285 qualification passes 2243 workspace tests, 0 fail, 14 ignored; fmt, all-target/all-feature Clippy and workspace build pass. Independent second-agent review approves the integrated implementation.
Historical
edit_batchmedians ( µs/iteration): 32 exact dry-run 9384 → 8560; 32 fuzzy 34144 → 29056;32 exact apply 9433 → 8389; single exact 1494 → 1446. These read-first fixtures characterize the existing Proven path; they do not measure unread edits. No speedup claim. ENG-1033 tracks avoiding the redundant unread uniqueness scan and adding an unread benchmark.Docs: ADR-0058 (Accepted), ADR index/root reservation, tools design and ledger. Prompt 18 → 19; tool-schema digest 568cef80 → 9ecb4e7e; descriptor a1b49276 → 09227e1b. No schema shape or wire protocol change. Decision row 12 (
if_hashsemantics) and D10's post-landing observation remain open.Final source
c31d1a5cpassed hosted CI 38426652160. ADR-0058 acceptance and shipped-status reconciliation landed in #286 (ce768bbc2fb7a25b227fe3405734a316adf020a1); ENG-1030 is Done.