Looking at the code, I can see the issue. Let me trace through what happens with the "write" tool:
- In
formatToolExecution(), there's a case for this.toolName === "write" (around line 430)
- Looking at that code block:
- It renders the tool title and path
- If fileContent exists, it shows the content
- BUT there's no handling for
this.result?.isError - unlike the "edit" tool which has:
For comparison, look at the "edit" case:
The "write" tool case just doesn't check for errors at all. It only renders the content being written, not any error that occurred.
Let me also check if there are other tools that might have similar issues (ls, find, grep, read, bash).
read: Just shows truncation warnings, no error handling
bash: Shows output via renderBashContent() - let me check that
Looking at renderBashContent():
So bash shows the output which could include error text. The background color is set based on this.result?.isError so it would show a red background. And getTextOutput() would return any error text. But "write" doesn't show any output—it only displays the content being written from args. Let me verify this is the actual issue by checking the write tool rendering more carefully.
The write tool case doesn't render this.result or check for errors at all. It just shows the file path and content from args, with no error handling like the edit case has. I need to add error handling to the write tool similar to how edit handles it—checking if this.result?.isError exists and then rendering the error text using getTextOutput(). Let me also check if there are other tools with the same problem.
Looking through the code, ls, find, grep, and read all call this.getTextOutput() which would capture any error text. The write tool is the only one that skips this entirely, only displaying the arguments without ever checking the result output.