mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: move deduplicateReadFileHistory call from error handler to success path
- Deduplication now only triggers after successful read_file operations - Fixed test mocks to include deduplicateReadFileHistory method - All tests passing
This commit is contained in:
parent
e2db79160e
commit
0fe3571cde
2 changed files with 5 additions and 3 deletions
|
|
@ -126,6 +126,7 @@ describe("read_file tool with maxReadFileLine setting", () => {
|
|||
|
||||
mockCline.recordToolUsage = vi.fn().mockReturnValue(undefined)
|
||||
mockCline.recordToolError = vi.fn().mockReturnValue(undefined)
|
||||
mockCline.deduplicateReadFileHistory = vi.fn().mockResolvedValue(undefined)
|
||||
|
||||
toolResult = undefined
|
||||
})
|
||||
|
|
@ -382,6 +383,7 @@ describe("read_file tool XML output structure", () => {
|
|||
mockCline.recordToolUsage = vi.fn().mockReturnValue(undefined)
|
||||
mockCline.recordToolError = vi.fn().mockReturnValue(undefined)
|
||||
mockCline.didRejectTool = false
|
||||
mockCline.deduplicateReadFileHistory = vi.fn().mockResolvedValue(undefined)
|
||||
|
||||
toolResult = undefined
|
||||
})
|
||||
|
|
|
|||
|
|
@ -589,6 +589,9 @@ export async function readFileTool(
|
|||
// No status message, just push the files XML
|
||||
pushToolResult(filesXml)
|
||||
}
|
||||
|
||||
// Deduplicate read_file history after successful reads
|
||||
await cline.deduplicateReadFileHistory()
|
||||
} catch (error) {
|
||||
// Handle all errors using per-file format for consistency
|
||||
const relPath = fileEntries[0]?.path || "unknown"
|
||||
|
|
@ -609,8 +612,5 @@ export async function readFileTool(
|
|||
const xmlResults = fileResults.filter((result) => result.xmlContent).map((result) => result.xmlContent)
|
||||
|
||||
pushToolResult(`<files>\n${xmlResults.join("\n")}\n</files>`)
|
||||
|
||||
// Deduplicate read_file history after successful reads
|
||||
await cline.deduplicateReadFileHistory()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue