Show why a tool call failed in `clai2` web UI rows, instead of only a 'failed' badge
Merged
MP
1mo ago+256+256+012345678901234567890123456789-57-57-01234567890123456789
Fixes #11288
Why we make these changes
A failed tool row in the clai2 web UI showed only a red "failed" badge. Expanding it showed the whole traceback, with the echoed call and a long ~~~ underline, and the cause on the last line. Now the row says why it failed, and the body leads with the exception.
New public surface
None. The change is in the browser UI only (ToolCard.tsx, styles.css, and the rebuilt bundle). The protocol is unchanged.
User-visible behavior
- Collapsed row: before,
Ran delegate_task · failed. After,Ran delegate_task · failed · Exception: Task '899ff4ce' is still running. The summary is the traceback's exception line. For an error with no traceback, it is the first line after a heading such asType error in code:. - Expanded body: the exception paragraph comes first. The traceback frames are folded under a closed Traceback toggle, without their
~/^underline lines. Text the cell printed before the error ([stdout before error]) and any advice after the exception stay visible. An error with no traceback looks the same as before.
Verification
test_a_failed_tool_leads_with_its_errorintests/clai2/browser/test_web_browser.pydrives a real code-moderun_codefailure through the served bundle in Chromium. It covers three cases: a traceback, printed output followed by a traceback, and a type-check error with no traceback. All three cases fail againstmain's bundle at the summary assertion and pass with this change.CLAI2_BROWSER_TESTS=1 pytest tests/clai2/browser: 6 passed.npm run build(tsc + vite) passes, and rebuildingmain's sources reproducesmain's committed bundle exactly. ruff and pyright are clean.
What changes for existing users
Failed tool rows in the web UI show their error. Nothing else changes.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.