Skip to content

Commit 67aaa72

Browse files
committed
read_file: restore per-file XML for FILE_NOT_FOUND to feed model context; keep unified UI error emission; update tests
1 parent 93be9ac commit 67aaa72

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/core/tools/__tests__/readFileTool.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,11 +1745,11 @@ describe("read_file tool - FILE_NOT_FOUND unified error", () => {
17451745
expect(Array.isArray(payload.filePaths)).toBe(true)
17461746
expect(payload.filePaths).toContain(relPath)
17471747

1748-
// Assert per-file XML error was suppressed for ENOENT (no <error> block for this file)
1748+
// Assert per-file XML error is now included for AI model feedback
17491749
expect(typeof pushed).toBe("string")
17501750
const xml = String(pushed)
17511751
expect(xml).toContain("<files>")
1752-
// no per-file error tags for the not-found case
1753-
expect(xml).not.toMatch(/<error>.*File not found.*<\/error>/i)
1752+
// Should now include per-file error tags for the not-found case (for AI model feedback)
1753+
expect(xml).toContain(`<file><path>${relPath}</path><error>File not found</error></file>`)
17541754
})
17551755
})

src/core/tools/readFileTool.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ export async function readFileTool(
630630
updateFileResult(relPath, {
631631
status: "error",
632632
error: "File not found",
633-
// Suppress per-file XML for not-found to avoid duplicate UI signals
634-
xmlContent: undefined,
633+
// Include XML content for AI model feedback
634+
xmlContent: `<file><path>${relPath}</path><error>File not found</error></file>`,
635635
})
636636
// Don't call handleError for file not found - we'll emit a unified message later
637637
} else {
@@ -747,8 +747,8 @@ export async function readFileTool(
747747
updateFileResult(relPath, {
748748
status: "error",
749749
error: "File not found",
750-
// Suppress per-file XML for not-found to avoid duplicate UI signals
751-
xmlContent: undefined,
750+
// Include XML content for AI model feedback
751+
xmlContent: `<file><path>${relPath}</path><error>File not found</error></file>`,
752752
})
753753
}
754754
// Don't call handleError for file not found - we'll emit a unified message later

0 commit comments

Comments
 (0)