improve: show edit mismatch candidate lines#97512
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 4:29 PM ET / 20:29 UTC. Summary PR surface: Source +200, Tests +182. Total +382 across 2 files. Reproducibility: yes. Source inspection of current main and v2026.6.10 shows only the generic exact-match failure plus bounded current-file contents, while the requested candidate-line comparison path is absent. Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one canonical bounded diagnostic implementation for #97032, then close or supersede the overlapping sibling PRs. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection of current main and v2026.6.10 shows only the generic exact-match failure plus bounded current-file contents, while the requested candidate-line comparison path is absent. Is this the best way to solve the issue? Yes for the owner boundary, with a maintainer decision still needed. The edit-tool mismatch error path is the narrow place to add this diagnostic, and PR head now bounds scan work; maintainers still need to choose this output contract over the sibling PRs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cc757839d5e2. Label changesLabel justifications:
Evidence reviewedPR surface: Source +200, Tests +182. Total +382 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Updated in @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77c059e70b
ℹ️ 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".
|
Follow-up for the CI lint failure on the ready-for-review run. Root cause: Fix pushed in Evidence:
|
|
Addressed the ClawSweeper P2 about bounding the candidate scan before splitting in commit 71d79df. What changed:
Verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Pushed |
|
@clawsweeper re-review No code changed after the bounded-scan fix in |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Current-head babysit note (2026-06-28T19:48Z): head The visible @clawsweeper re-review |
|
Addressed the refreshed ClawSweeper P2 in What changed:
Verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Follow-up for the refreshed ClawSweeper P2 in What changed after
Verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks @aditya-vithaldas. The canonical fix for #97032 landed through #97038 as 4204a948457cafc601c1f27a1965fcfb011c2131. We selected #97038 because it keeps the diagnostic in the shared edit-diff owner path, bounds both scan cost and output, and covers typo, indentation, escaping, cap, and surrogate-safe truncation behavior with focused tests. This PR targets the same behavior, so I’m closing it as superseded. Your parallel implementation helped validate the need and solution space. |
Closes #97032
AI-assisted by Codex.
What Problem This Solves
Resolves a problem where edit-tool exact-match failures only reported that
oldTextwas not found and then dumped a capped file snippet. Users had no nearby line comparison to tell whether the miss was caused by indentation, escaping, whitespace, or similar text drift.Why This Change Was Made
The edit mismatch hint now adds up to three bounded closest candidate lines before the existing capped
Current file contentssection. Each candidate includes a line number, expected text, found text, a simple difference marker, and a short hint such as indentation mismatch or backslash escaping mismatch.The same hint is now applied to indexed multi-edit
edits[n]not-found failures when the index is in the real-edit apply path. Mixed no-op validation errors are guarded so they do not attach candidates from the wrong edit list.The matching algorithm is unchanged. This is diagnostic-only output on the existing exact-match failure path.
User Impact
Users and agents can recover from failed edits faster because the error points at likely nearby text and explains common mismatch classes instead of forcing blind retries.
Evidence
77c059e7after review feedback.node scripts/run-vitest.mjs src/agents/sessions/tools/edit.test.ts src/agents/agent-tools.create-openclaw-coding-tools.test.tsnode node_modules/oxfmt/bin/oxfmt --check --threads=1 src/agents/sessions/tools/edit.ts src/agents/sessions/tools/edit.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode local --codex-bin /tmp/codex-fast-wrapperreported clean after the indexed multi-edit and mixed no-op guard changes.createEditToolagainst a temp file, with the temp path redacted: