Show error state for failed write/edit tool calls instead of DiffWidget
- SHA
520c30f12812e403c0571449c09cb4bc2331e64a- Parents
-
3585027 - Tree
1b1dd2d
520c30f
520c30f12812e403c0571449c09cb4bc2331e64a3585027
1b1dd2d| Status | File | + | - |
|---|---|---|---|
| M |
src/loader/ui/app.py
|
3 | 3 |
src/loader/ui/app.pymodified@@ -634,7 +634,7 @@ class LoaderApp(App): | ||
| 634 | 634 | |
| 635 | 635 | # Check if this is an edit tool with diff info |
| 636 | 636 | # Note: old_string can be empty string (inserting), so check `is not None` |
| 637 | - if message.tool_name == "edit" and message.new_string and message.old_string is not None: | |
| 637 | + if message.tool_name == "edit" and message.new_string and message.old_string is not None and not message.is_error: | |
| 638 | 638 | # Replace tool widget with diff widget |
| 639 | 639 | self._debug_log( |
| 640 | 640 | " -> showing EDIT diff widget " |
@@ -650,8 +650,8 @@ class LoaderApp(App): | ||
| 650 | 650 | new_string=message.new_string, |
| 651 | 651 | ) |
| 652 | 652 | msg_area.mount(diff_widget) |
| 653 | - # Check if this is a write tool - show as diff (new file) | |
| 654 | - elif message.tool_name == "write" and message.new_string: | |
| 653 | + # Check if this is a write tool - show as diff (new file), but only on success | |
| 654 | + elif message.tool_name == "write" and message.new_string and not message.is_error: | |
| 655 | 655 | self._debug_log(f" -> showing WRITE diff widget ({len(message.new_string)} chars)") |
| 656 | 656 | if tool_widget: |
| 657 | 657 | tool_widget.remove() |