You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(error-interception): user-friendly error UI with structured detail view
- Change MessageTransformer output from raw JSON to <error_details> block
- Add CATEGORY_TITLES mapping for all 11 error categories
- Add helper functions: getCategoryTitle, getErrorTitleFromGuided, formatErrorDetails
- Update all 6 cline.say('error') paths in presentAssistantMessage to use user-friendly titles
- Update ToolErrorInterceptor circuit breaker to use <error_details> format
- Update all test assertions from JSON.parse to string-content checks
- All 174 tests pass across 8 test files
Show AI guidance (WHAT/WHY/NEXT JSON) in Zoo Code UI alongside error messages for all 3 error interception paths in `presentAssistantMessage.ts`.
6
+
7
+
## Actions Taken
8
+
9
+
1. Read [`presentAssistantMessage.ts`](src/core/assistant-message/presentAssistantMessage.ts:559) to locate the 3 `cline.say("error", ...)` call sites.
10
+
2. Applied surgical edits to all 3 error paths:
11
+
-**Line ~559 (Missing nativeArgs)**: Now appends `\n\n--- AI Guidance ---\n${guided}` when `guided` is truthy.
12
+
-**Line ~780 (Structural preflight)**: Same pattern, using `[${variant}]` prefix.
13
+
-**Line ~859 (Validation catch)**: Same pattern, using `Validation error:` prefix.
14
+
3. Ran the test suite: `cd src; npx vitest run core/assistant-message/__tests__/presentAssistantMessage-error-interception.spec.ts` — all 19 tests passed.
15
+
4. Verified no test assertions reference the exact error message format (no updates needed).
16
+
5. Committed: `fix(error-interception): show AI guidance (WHAT/WHY/NEXT) to user in UI`.
17
+
6. Pushed to `myk1yt/feature/combined-all-features`.
18
+
19
+
## Result
20
+
21
+
✅ Success. All 3 error paths now show both the error category message AND the structured AI guidance (WHAT/WHY/NEXT) to the user in the UI chat. When `guided` is undefined (no interceptor output), the original error message is shown unchanged.
22
+
23
+
## Issues Discovered
24
+
25
+
None.
26
+
27
+
## Next Step Recommendations
28
+
29
+
- Consider adding UI tests that assert the `--- AI Guidance ---` separator appears in the rendered error message when guidance is present.
Make all error interception patterns user-friendly with clickable detail view. Changed the error output format from raw JSON to a structured `<error_details>` block, and added user-friendly titles for each error category displayed in the chat UI via `cline.say("error", ...)`.
6
+
7
+
## Actions Taken
8
+
9
+
### 1. MessageTransformer.ts — Core format change
10
+
11
+
- Added `CATEGORY_TITLES` mapping: each `ErrorCategory` now has a concise, user-friendly title (e.g., `PARAM_TYPE_MISMATCH` → "Tool Call Format Error", `FILE_NOT_FOUND` → "File Not Found").
- **MessageTransformer.spec.ts**: Rewrote all assertions from `JSON.parse()` + field checks to string-content checks (`toContain`). Added new test suite for category title helpers.
53
+
- **ToolErrorInterceptor.spec.ts**: Replaced all 13 `JSON.parse()` assertions with string-content checks.
54
+
- **presentAssistantMessage-error-interception.spec.ts**: Updated CONTEXT_OVERFLOW test from JSON.parse to string checks. Updated CWD_OBJECT_MISUSE and NESTED_PARAM_OVERFLOW assertions to check for `PARAM_TYPE_MISMATCH` category + pattern ID instead of variant names.
55
+
- **presentAssistantMessage-unknown-tool.spec.ts**: Updated `say("error")` assertion to check for guided title instead of raw i18n string.
56
+
57
+
## Result
58
+
59
+
✅ Success — All 174 tests pass across 8 test files (0 failures).
60
+
61
+
## Issues Discovered
62
+
63
+
None. The format change was clean and all existing test assertions were updated to match the new `<error_details>` format.
64
+
65
+
## Next Step Recommendations
66
+
67
+
- Consider adding integration tests that verify the `<error_details>` format is parseable by the AI model in actual conversation flows.
68
+
- The `isErrorResult()` method in ToolErrorInterceptor already checks for `<error_details>` prefix (line 297), so the new format is compatible with the existing error detection logic.
69
+
70
+
## Affected File List
71
+
72
+
- `src/core/tools/error-interception/MessageTransformer.ts` (modified — core format change)
0 commit comments