Suggest closest edit match when oldText is missing#88531
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 10:21 PM ET / 02:21 UTC. Summary PR surface: Source +145, Tests +105. Total +250 across 2 files. Reproducibility: not applicable. as a feature/ergonomics PR rather than a broken existing behavior report. Source inspection shows current main and v2026.6.10 lack closest-match hints on oldText mismatch errors, while the PR body demonstrates the intended production createEditTool path on an older head. Review metrics: none identified. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the shared edit-diff hint implementation after current-head terminal proof is refreshed and maintainers choose the merge order or combined resolution with the open fuzzy-edit preservation fix. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature/ergonomics PR rather than a broken existing behavior report. Source inspection shows current main and v2026.6.10 lack closest-match hints on oldText mismatch errors, while the PR body demonstrates the intended production createEditTool path on an older head. Is this the best way to solve the issue? Yes, with proof refresh and same-helper coordination. Centralizing the hint in applyEditsToNormalizedContent is the maintainable path because execution and preview already share that helper; a caller-only wrapper would duplicate behavior and risk drift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1a04b8eb9853. Label changesLabel justifications:
Evidence reviewedPR surface: Source +145, Tests +105. Total +250 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
|
4c48120 to
ca0f52d
Compare
ca0f52d to
40e86f8
Compare
40e86f8 to
f22e921
Compare
f22e921 to
ee672ab
Compare
|
@imwyvern thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
Thanks @imwyvern. 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. |
Summary
oldTextblock.Verification
pnpm buildpassed.node scripts/run-vitest.mjs src/agents/sessions/tools/edit.test.tspassed: 1 file, 9 tests.git diff --checkpassed..agents/skills/autoreview/scripts/autoreview --mode branch --base upstream/mainpassed with no accepted/actionable findings.node scripts/check-changed.mjs --base upstream/maindid not complete locally because this checkout has no usablecrabboxbinary; the local remote-child fallback reached core test typecheck and failed in unchanged upstream fileui/src/ui/control-ui-vite-config.node.test.ts.Real behavior proof
Behavior addressed: The edit tool now includes a closest matching line hint when
oldTextis near existing content but not exact.Real environment tested: Local OpenClaw checkout on
feat/edit-fuzzy-match-hintatca0f52d0818c6913a66a4b4cfd16d6c816c254c9, Node 22.22.2, invoking the productioncreateEditToolagainst a real temporary file.Exact steps or command run after this patch: Ran
pnpm exec tsx -e ...to create a temp file containingconst value = "actual";, callcreateEditTool(dir).execute(...)with missingoldTextconst value = "actuel";, and print the thrown edit-tool error.Evidence after fix: Console output from that real edit-tool invocation:
Observed result after fix: The failed edit reported the closest match at line 2 with similarity and included the real current file contents; no replacement was applied.
What was not tested: Full Vitest suite and remote Testbox proof were not run from this local checkout; broad GitHub CI is running on the pushed PR head.