Skip to content

Commit 8e7d9e0

Browse files
lhishExample Userdaniel-lxs
authored
fix(tools): Resolve intermittent hangs and lack of clear error feedback in apply_diff tool (#5391)
* fix(tools): Resolve intermittent hangs and lack of clear error feedback in apply_diff tool (#5390) * fix: show user-friendly error message for XML parsing failures - Keep detailed XML structure instructions only for LLM via pushToolResult - Show simple error message to user via cline.say - Aligns with established error handling pattern in codebase * feat: add telemetry for XML parsing errors - Track XML parsing errors using captureDiffApplicationError - Include consecutive mistake count for better error analysis - Helps monitor and debug XML parsing issues in production --------- Co-authored-by: Example User <[email protected]> Co-authored-by: Daniel Riccio <[email protected]>
1 parent 7ae7440 commit 8e7d9e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/core/tools/multiApplyDiffTool.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ Expected structure:
159159
</args>
160160
161161
Original error: ${errorMessage}`
162-
throw new Error(detailedError)
162+
cline.consecutiveMistakeCount++
163+
cline.recordToolError("apply_diff")
164+
TelemetryService.instance.captureDiffApplicationError(cline.taskId, cline.consecutiveMistakeCount)
165+
await cline.say("diff_error", `Failed to parse apply_diff XML: ${errorMessage}`)
166+
pushToolResult(detailedError)
167+
return
163168
}
164169
} else if (legacyPath && typeof legacyDiffContent === "string") {
165170
// Handle legacy parameters (old way)

0 commit comments

Comments
 (0)