From 0a63a54352e75dc7d8dc971857d550a7534f0a7f Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Tue, 21 Oct 2025 17:28:19 -0600 Subject: [PATCH] fix(write-to-file): strip XML parameter spillover from content before writing files --- src/core/tools/writeToFileTool.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/tools/writeToFileTool.ts b/src/core/tools/writeToFileTool.ts index 5abd96a20a..74638971c7 100644 --- a/src/core/tools/writeToFileTool.ts +++ b/src/core/tools/writeToFileTool.ts @@ -86,6 +86,10 @@ export async function writeToFileTool( if (!cline.api.getModel().id.includes("claude")) { newContent = unescapeHtmlEntities(newContent) } + // Strip accidental XML-like parameter spillover that can appear at the end of content + // e.g., "\n1" + newContent = newContent.replace(/\n<\/parameter>\s*\n[\s\S]*$/i, "") + newContent = newContent.replace(/\n<\/parameter>\s*$/i, "") // Determine if the path is outside the workspace const fullPath = relPath ? path.resolve(cline.cwd, removeClosingTag("path", relPath)) : ""