-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.Someone is actively working on this. Should link to a PR soon.bugSomething isn't workingSomething isn't working
Description
App Version
v3.19.0
API Provider
Not Applicable / Other
Model Used
N/A
π Steps to Reproduce
-
- write_to_file tool with missing or empty path parameter is invoked
- write_to_file tool with missing content parameter is invoked
-
In both cases, the function in
writeToFileTool.tssilently returns on line 29 without any error handling leading to no action or error happening.
π₯ Outcome Summary
The issue occurs because the early validation check silently returns, for both partial and non-partial blocks, instead of properly handling the error case.
if (!relPath || newContent === undefined) {
// checking for newContent ensure relPath is complete
// wait so we can determine if it's a new file or editing an existing file
return
}This was discovered during PR #3871 via Unit-Tests for writeToFileTool.test.ts:
// ..
describe("parameter validation", () => {
it("errors and resets on missing path parameter", async () => {
await executeWriteFileTool({ path: undefined })
expect(mockCline.consecutiveMistakeCount).toBe(1)
expect(mockCline.recordToolError).toHaveBeenCalledWith("write_to_file")
expect(mockCline.sayAndCreateMissingParamError).toHaveBeenCalledWith("write_to_file", "path")
expect(mockCline.diffViewProvider.reset).toHaveBeenCalled()
})
it("errors and resets on empty path parameter", async () => {
await executeWriteFileTool({ path: "" })
expect(mockCline.consecutiveMistakeCount).toBe(1)
expect(mockCline.recordToolError).toHaveBeenCalledWith("write_to_file")
expect(mockCline.sayAndCreateMissingParamError).toHaveBeenCalledWith("write_to_file", "path")
expect(mockCline.diffViewProvider.reset).toHaveBeenCalled()
})
it("errors and resets on missing content parameter", async () => {
await executeWriteFileTool({ content: undefined })
expect(mockCline.consecutiveMistakeCount).toBe(1)
expect(mockCline.recordToolError).toHaveBeenCalledWith("write_to_file")
expect(mockCline.sayAndCreateMissingParamError).toHaveBeenCalledWith("write_to_file", "content")
expect(mockCline.diffViewProvider.reset).toHaveBeenCalled()
})
})
// ..π Relevant Logs or Errors (Optional)
dosubot
Metadata
Metadata
Assignees
Labels
Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.Someone is actively working on this. Should link to a PR soon.bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done

