Skip to content

fix(tools): apply a unique exact edit without a fresh read (T19) - #281

Merged
lg2m merged 37 commits into
fix/t18-classifier-false-promptsfrom
fix/t19-edit-freshness-exact-match
Oct 13, 2026
Merged

lg2m merged 37 commits into
fix/t18-classifier-false-promptsfrom
fix/t19-edit-freshness-exact-match

Conversation

@lg2m

@lg2m lg2m commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

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 old can apply without a current read, with note=unread or changed_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_file overwrites retain their guard. Every supplied if_hash is 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_batch medians ( µ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_hash semantics) and D10's post-landing observation remain open.

Final source c31d1a5c passed hosted CI 38426652160. ADR-0058 acceptance and shipped-status reconciliation landed in #286 (ce768bbc2fb7a25b227fe3405734a316adf020a1); ENG-1030 is Done.

@lg2m

lg2m commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

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 edit.rs phase 1 (plan-time bytes and post-earlier-edit text), the per-edit if_hash check, the unchanged apply-time re-hash, and the refusal texts that must never contain the current hash. Use docs/plans/templates/review-checklist.md.

lg2m added 5 commits October 12, 2026 21:33
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). 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.
@lg2m
lg2m force-pushed the fix/t19-edit-freshness-exact-match branch from c83a25a to 3b068a5 Compare October 13, 2026 04:36
@lg2m
lg2m changed the base branch from docs/tool-layer-d10-audit to fix/t18-classifier-false-prompts October 13, 2026 04:36
@lg2m
lg2m marked this pull request as ready for review October 13, 2026 04:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T16:12:59.910398Z 669da1f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lg2m
lg2m added this pull request to stack #284 October 13, 2026 04:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/qq-core/src/tools/edit.rs Resolved
Comment thread crates/qq-core/src/tools/edit.rs Resolved
Comment thread crates/qq-core/src/tools/edit.rs Resolved
lg2m added 8 commits October 12, 2026 22:17
…' 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

# Conflicts:
#	docs/plans/progress/tool-layer.md
lg2m added a commit that referenced this pull request Oct 13, 2026
…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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/qq-core/src/tools/specs.rs Resolved
lg2m added a commit that referenced this pull request Oct 13, 2026
…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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

"edit ok files={} edits={edits_total}{note}\n",

P2 Badge Preserve freshness notes on partial applies

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".

Comment thread crates/qq-core/src/tools/edit.rs Resolved
Comment thread crates/qq-core/src/tools/edit.rs Resolved
lg2m added 2 commits October 13, 2026 07:38
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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/qq-core/src/tools/edit.rs Resolved
lg2m added 11 commits October 13, 2026 07:53
T20: placeholder dispatch and leading-cd hint regressions fail on db44ecf; oversized bounds correction guard passes.
…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.
@lg2m
lg2m merged commit e225370 into main Oct 13, 2026
4 checks passed
@lg2m
lg2m deleted the fix/t19-edit-freshness-exact-match branch October 13, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant