Skip to content

Commit 3f5497e

Browse files
author
Zoo (VP)
committed
fix(error-interception): update stale test assertion for unknown tool error format
1 parent d525554 commit 3f5497e

3 files changed

Lines changed: 161 additions & 2 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Code Mode Task Report
2+
3+
## Task Summary
4+
Committed and pushed the CI fix (non-null assertion in test) on branch `feat/error-interception-middleware` to the `myk1yt` remote.
5+
6+
## Actions Taken
7+
1. `git add -A -- ':!Zoo-Code/'` — staged all changes excluding the `Zoo-Code/` subdirectory.
8+
2. `git commit --no-verify -m "fix(error-interception): add non-null assertion in test to satisfy TS strict mode"` — committed with the specified message, bypassing pre-commit hooks.
9+
3. `git push myk1yt feat/error-interception-middleware --no-verify` — pushed to the `myk1yt` remote.
10+
11+
## Result
12+
✅ Success
13+
14+
- **Commit hash**: `59f97c71e`
15+
- **Commit message**: `fix(error-interception): add non-null assertion in test to satisfy TS strict mode`
16+
- **Files changed**: 4 files, 161 insertions(+), 2 deletions(-)
17+
- `src/core/assistant-message/__tests__/presentAssistantMessage-error-interception.spec.ts` (the actual fix)
18+
- `docs/260726_0003_session_error-hiding-fix/083500_debug-report.md` (new)
19+
- `docs/260726_0003_session_error-hiding-fix/172000_code-report.md` (new)
20+
- `resolve_conflicts.py` (new)
21+
- **Push status**: Success — `94f1b4a84..59f97c71e feat/error-interception-middleware -> feat/error-interception-middleware`
22+
23+
## Issues Discovered
24+
None. All three commands executed cleanly with exit code 0.
25+
26+
## Next Step Recommendations
27+
- Verify CI pipeline passes on the pushed branch.
28+
- If CI passes, proceed with PR merge or further review as needed.
29+
30+
## Affected File List
31+
- `src/core/assistant-message/__tests__/presentAssistantMessage-error-interception.spec.ts`
32+
- `docs/260726_0003_session_error-hiding-fix/083500_debug-report.md`
33+
- `docs/260726_0003_session_error-hiding-fix/172000_code-report.md`
34+
- `resolve_conflicts.py`
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Debug Task Report — Verify CI fix on feat/error-interception-middleware
2+
3+
## Task Summary
4+
Verify that commit `59f97c71e` (TS strict-mode fix) resolves the CI failures from run 30194429241,
5+
run the CI commands locally, check for a new CI run, and fix any additional issues found.
6+
7+
## Environment Correction (Important)
8+
- The VP's commands referenced `cd Zoo-Code` and repo `myk1yt/Zoo-Code`. In this workspace the git
9+
repo root is `c:/Users/k1yt/OneDrive/Projects/ZooCode` (no nested `ZooCode/` repo).
10+
- **CI runs are NOT on the fork** `myk1yt/Zoo-Code` (GitHub disables Actions on forks by default;
11+
`gh run list --repo myk1yt/Zoo-Code` returns `[]` and run 30194429241 is HTTP 404 there).
12+
- **All CI runs are on the upstream repo** `Zoo-Code-Org/Zoo-Code` (the PR target).
13+
- Remotes: `myk1yt` = fork, `upstream` = `Zoo-Code-Org/Zoo-Code`.
14+
15+
## Verification Results
16+
17+
### 1. Commit on branch — PASS
18+
`git log --oneline -3` on `feat/error-interception-middleware`:
19+
```
20+
59f97c71e fix(error-interception): add non-null assertion in test to satisfy TS strict mode
21+
94f1b4a84 feat(error-interception): user-friendly error UI with structured detail view
22+
83ed11f29 fix(error-interception): show errors to user in UI alongside AI guidance
23+
```
24+
Remote branch HEAD (`Zoo-Code-Org/Zoo-Code`) is also `59f97c71e`.
25+
26+
### 2. `tsc --noEmit` — PASS (0 errors)
27+
The TS18048 `'message' is possibly 'undefined'` error is resolved by the `!` assertion.
28+
29+
### 3. Error-interception spec — PASS
30+
`npx vitest run core/assistant-message/__tests__/presentAssistantMessage-error-interception.spec.ts`
31+
→ 19/19 tests passed.
32+
33+
### 4. New CI run on 59f97c71e — EXISTS, 2 of 4 runs FAILED
34+
On `Zoo-Code-Org/Zoo-Code`, branch `feat/error-interception-middleware`, headSha `59f97c71e`
35+
(runs created 2026-07-26T08:39:11Z):
36+
- `Code QA Roo Code` (run 30195006323) — **failure**
37+
- `platform-unit-test (ubuntu-latest)`**failure**
38+
- `compile`**failure**
39+
- `platform-unit-test (windows-latest)` — cancelled
40+
- invisible-chars / knip / dependency-review / check-translations — success
41+
- `E2E Tests (Mocked)` (run 30195006372) — **failure** (`e2e-mock` job)
42+
43+
So the TS strict-mode fix did NOT make CI green. Two distinct remaining failures were diagnosed below.
44+
45+
## Issue A — `platform-unit-test` failure (FIXED by me)
46+
47+
**Failing test (only 1 of 7207):**
48+
`core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts`
49+
"Custom tool experiment gate" → "should treat custom tool as unknown when experiment is disabled"
50+
`AssertionError: expected "vi.fn()" to be called with arguments: [ 'error', 'unknownToolError' ]`
51+
52+
**Root cause (stale test assertion, not a code bug):**
53+
The feature changed the unknown-tool UX. The branch's unknown-tool code path
54+
([`presentAssistantMessage.ts:1188-1207`](../src/core/assistant-message/presentAssistantMessage.ts))
55+
now routes through the error interceptor and emits a guided `<error_details>` payload whose title is
56+
`"Tool Call Format Error"` (category `PARAM_TYPE_MISMATCH`), instead of the raw i18n key
57+
`"unknownToolError"`. The sibling spec `presentAssistantMessage-unknown-tool.spec.ts:110` was already
58+
updated to `expect.stringContaining("Tool Call Format Error")`, but the custom-tool spec (which hits
59+
the SAME unknown-tool branch when the experiment gate is disabled) was missed.
60+
61+
**Fix applied (local, uncommitted):**
62+
[`presentAssistantMessage-custom-tool.spec.ts:256-259`](../src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts)
63+
changed the stale assertion:
64+
```ts
65+
// before
66+
expect(mockTask.say).toHaveBeenCalledWith("error", "unknownToolError")
67+
// after
68+
expect(mockTask.say).toHaveBeenCalledWith("error", expect.stringContaining("Tool Call Format Error"))
69+
```
70+
**Verification:** `npx vitest run core/assistant-message` → 52/52 passed (5 files). Also swept the
71+
whole `src/` tree — no other stale `toHaveBeenCalledWith("error", "unknownToolError")` assertions
72+
remain. `core/tools/error-interception` suite → 142/142 passed.
73+
74+
## Issue B — `compile` job lint failure (STRUCTURAL — escalated, NOT fixed by me)
75+
76+
**CI log:** `zoo-code#lint` reports **39** `@typescript-eslint/no-explicit-any` errors, all in
77+
`core/assistant-message/__tests__/presentAssistantMessage-error-interception.spec.ts`
78+
(lines 53, 91, 93, 112, 137, 147, 164, 189, 215, 244, 256, 284, 295, 373, 401, 416, 491, …).
79+
80+
**Why it fails in CI but passes locally (root cause):**
81+
- The branch is **11 ahead / 9 behind** `upstream/main`.
82+
- Upstream PR **#1014** (commit `ff17dcb67`, "introduce TaskRegistry") changed
83+
[`src/eslint.config.mjs`](../src/eslint.config.mjs) `no-explicit-any` from `"off"` to `"error"`,
84+
AND introduced `src/eslint-suppressions.json` (the `eslint-bulk-suppressions` mechanism) to
85+
grandfather existing violations.
86+
- The branch HEAD `59f97c71e` still has `no-explicit-any: "off"`, so local lint passes
87+
(`--print-config` shows the rule computed as `0`).
88+
- The CI `compile` job lints the PR **merged against the latest `upstream/main`**, where the rule is
89+
now `"error"`. The 39 `any` casts in the NEW spec file are not present in upstream's
90+
`eslint-suppressions.json` (the file didn't exist on upstream when suppressions were generated),
91+
so they surface as hard errors.
92+
93+
**Why I did NOT fix it (scope + git-safety):**
94+
The correct fix requires updating the branch onto the latest `upstream/main` (merge or rebase) to
95+
obtain the suppressions mechanism, then either:
96+
(a) regenerate `eslint-suppressions.json` to include the new file's 39 violations
97+
(`pnpm dlx @eslint/bulk-suppressions` / the repo's suppressions workflow), or
98+
(b) remove all 39 `any` types from the spec (large, mechanical, risk of new type errors).
99+
Both the branch merge/rebase and any commit/push are **VP-only** per Debug rules, so I stopped here.
100+
101+
## Test Environment Issues Found & Fixed
102+
- **`pnpm` not on PATH** in this shell: used `corepack pnpm` (v10.8.1) instead. Worked.
103+
- **Node engine mismatch (non-blocking):** project wants Node `20.20.2`; local runs Node `v24.16.0`
104+
(engine warning only; lint/tests still pass locally). CI uses Node 20. This is consistent with —
105+
but not the cause of — the lint discrepancy (the cause is the rule flip on upstream/main, above).
106+
- Repetitive `pnpm --filter` / corepack invocation pattern suggests a small helper script could help;
107+
noted for VP consideration (not created, to avoid scope creep).
108+
109+
## Next Step Recommendations (for VP)
110+
1. **Commit & push my Issue A test fix** (`presentAssistantMessage-custom-tool.spec.ts`) — this resolves
111+
the `platform-unit-test` failure. (VP must run the commit; Debug mode is forbidden from git commit.)
112+
2. **Update the branch** (`git merge upstream/main` or rebase) to pull in the
113+
`eslint-suppressions.json` mechanism from PR #1014.
114+
3. After the branch is updated, **regenerate suppressions** for the new spec file (or clean up the 39
115+
`any` casts), then re-run `zoo-code#lint`. This resolves the `compile` failure.
116+
4. Re-run CI and confirm both `compile` and `platform-unit-test` go green; investigate the separate
117+
`e2e-mock` failure (run 30195006372) if it persists after the branch update.
118+
119+
## Affected File List
120+
- `src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts` (modified — Issue A fix, uncommitted)
121+
- `src/core/assistant-message/__tests__/presentAssistantMessage-error-interception.spec.ts` (39 lint violations — Issue B, not modified)
122+
- `src/eslint.config.mjs` (upstream/main divergence — context only, not modified)
123+
- `src/eslint-suppressions.json` (exists on upstream/main, absent on branch — needs regeneration after merge)

src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ describe("presentAssistantMessage - Custom Tool Recording", () => {
253253

254254
await presentAssistantMessage(mockTask)
255255

256-
// Should be treated as unknown tool (not executed)
257-
expect(mockTask.say).toHaveBeenCalledWith("error", "unknownToolError")
256+
// Should be treated as unknown tool (not executed).
257+
// The error interceptor transforms it into a guided payload (PARAM_TYPE_MISMATCH),
258+
// so the user sees the "Tool Call Format Error" title, not the raw i18n key.
259+
expect(mockTask.say).toHaveBeenCalledWith("error", expect.stringContaining("Tool Call Format Error"))
258260
expect(mockTask.consecutiveMistakeCount).toBe(1)
259261

260262
// Custom tool should NOT have been executed

0 commit comments

Comments
 (0)