fix(agent): clarify edit mismatch tool warning#67276
Conversation
Greptile SummaryThis PR fixes a UX bug where The fix is well-scoped and the regression test correctly asserts both the guidance content and path-leakage guard. One open question: Confidence Score: 5/5Safe to merge; the change is narrowly scoped to a single error-summarization path with no P0/P1 issues. All findings are P2 style/coverage suggestions. The core logic is correct, the fix is backward compatible, and the regression test covers the primary scenario. The only open item is whether verbose-on should also use the sanitized summary — a style question that does not block correctness. src/agents/pi-embedded-runner/run/payloads.ts — the verbose-on interaction with Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/pi-embedded-runner/run/payloads.ts
Line: 341-346
Comment:
**Sanitized summary overrides verbose-on detail too**
`summarizedDetail` takes priority unconditionally, so when `verboseLevel` is `"on"` or `"full"`, verbose users also receive the sanitized summary rather than the raw error (which would include the file path via `warningPolicy.includeDetails`). The PR description scopes the fix to verbose-off mode, but the implementation silently changes verbose-on behavior as well. A matching test for the verbose-on case would lock in whichever behavior is intended; if verbose mode should still expose the raw error, the guard should be conditioned on `!warningPolicy.includeDetails`.
```suggestion
const summarizedDetail =
!warningPolicy.includeDetails ? summarizeToolErrorForUi(params.lastToolError) : undefined;
const errorSuffix = summarizedDetail
? `: ${summarizedDetail}`
: warningPolicy.includeDetails && params.lastToolError.error
? `: ${params.lastToolError.error}`
: "";
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(agent): clarify edit mismatch tool w..." | Re-trigger Greptile |
efcf28f to
4f60186
Compare
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open. The PR is in the right payload-layer area, but it only recognizes the single-edit exact-match error while the current edit tool emits a different oldText mismatch string for multi-edit calls, so that path would still produce the vague verbose-off warning. It also still needs after-fix real behavior proof beyond local unit-test claims. Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main emits edit not-found errors with actionable text, then buildEmbeddedRunPayloads hides raw details in verbose-off warnings; I did not run a live repro because this review is read-only. Is this the best way to solve the issue? No. The payload boundary is appropriate, but the implementation only recognizes the single-edit mismatch format and needs to cover the multi-edit oldText mismatch path too. Security review: Security review cleared: The diff only changes local warning text summarization and tests; it does not touch permissions, dependencies, workflows, network calls, secrets, or code execution surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 4ee50ce18e35. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
8f7bd1d to
fde9954
Compare
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Describe the problem and fix in 2–5 bullets:
edittool fails becauseoldTextdoes not exactly match the file contents, verbose-off user-facing output collapses into a vague failure warning.editexact-match mismatch case and surfaces a concise sanitized summary that tells the useroldTextmust match exactly, including whitespace/newlines.edittool semantics, generic tool-error policy, replay/recovery policy, or expose raw file paths / file contents in verbose-off UI.AI-assisted: Yes (Sona). Testing level: targeted local regression tests.
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
editerror, but the final payload/UI warning path flattened it into a generic tool failure when verbose mode was off.editexact-match mismatches should surface actionable, sanitized guidance in verbose-off mode.Regression Test Plan (if applicable)
src/agents/pi-embedded-runner/run/payloads.test.tseditexact-match mismatch should still show actionable guidance in verbose-off mode, mention exact-text / whitespace-newline mismatch, and avoid leaking raw paths.src/agents/pi-embedded-runner/run/payloads.errors.test.tscovers adjacent tool-error surfacing behavior, but not this exact sanitized mismatch summary.User-visible / Behavior Changes
editexact-match mismatches even when verbose mode is off.Diagram (if applicable)
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
npx -y node@22Steps
edittool failure whereoldTextdoes not exactly match the current file contents because of whitespace/newline mismatch.Expected
oldTextmust match exactly, including whitespace/newlines.Actual
Edit ... failedwarning without actionable guidance.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
payloads.errors.test.tsandpayloads.test.ts/tmp/demo.txtedittool errors still follow existing behaviorReview Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes)No)No)Risks and Mitigations
toolName === "edit"plus the known exact-match mismatch prefix, and regression coverage locks that in.