fix(web): show readable messages for structured thread errors #21483
main fromrefs/pull/21483/head·merged by juliusmarminge View on GitHubStructured thread errors can fill the collapsed chat banner with JSON even when error.message contains a readable explanation. Show that exact nonblank nested message in the collapsed banner, and retain the exact original payload behind “Show full error”. Plain text, invalid JSON, unfamiliar shapes, and the dedicated ChatGPT usage-limit panel retain their behavior. Dismissal keys still use the raw payload.
Replaces #9950, originally by juliusmarminge. The original tooltip implementation predates main’s expandable error display. This rebuild uses an optional collapsed value on the existing ExpandableText component, including expansion for short structured diagnostics. Existing callers keep their defaults. No server normalization, mobile, transport, or layout change. Related #3747 remains open.
HUMAN-HOLD: moving diagnostic fields out of the collapsed headline remains a presentation decision requiring human approval. This PR stays unmerged.
Verification:
- Original PR: 30 tests in one file → replacement: 12 tests in two files (11 unit, one real Chromium expand/collapse test). Current main had five unit tests. Removed the exhaustive JSON matrix and duplicate provider examples; retained focused extraction/fallback and raw-payload dismissal behavior.
- On base, the six new unit cases fail on the absent helper and the Chromium interaction test fails because the short raw payload has no readable headline or expansion. On head, all 12 pass. Web typecheck, targeted lint, formatting, and diff checks pass.
- Integrated Linux web client: actual base production files from ab6be13 compared with the restored candidate at the same 1280×800 viewport, synthetic thread, and scroll position. The 245-character diagnostic becomes its readable message; expansion retains all 245 characters exactly without horizontal overflow, collapse restores the message, and native button dismissal hides the banner. The same repository font was loaded in both captures because the headless host has no fallback fonts.
- The fixture uses isolated SQLite projection rows solely for visual state; it does not prove backend event processing. No provider turn, account request, or production state was used. Fallback shapes and short-payload expansion were tested in the focused suites rather than each replayed in the running app.
- One fresh parallel full-diff review round by Claude Opus and Codex Sol found no code blockers. The pre-existing expansion state persists if one error directly replaces another while expanded; this remains unchanged. Hosted CI passes on 3fd37cd: build/typecheck, lint, web, shared, and all eight server test shards succeeded. Skipped surface jobs remain skipped; the canceled duplicate native-fingerprint run is superseded by a successful run. CodeRabbit found no code issues; its description warning asks for the explicit human approval still recorded by HUMAN-HOLD above.
Before — raw JSON in the collapsed banner:

After — readable message at the same viewport:

After — expanded exact original diagnostics:

Expand, collapse, and dismiss:
Limits: macOS, Windows, iOS, Android, and Electron desktop were not verified. Web and desktop share the banner, while native mobile is unchanged. Local web was exercised; relay/tunnel and real provider failure production paths were not separately run. This fixes presentation, not the provider errors themselves.
Implemented through T3 Code with Codex gpt-6-astra (tests) and gpt-6.1-sol (implementation); independent reviews by Claude claude-opus-5-5 and Codex gpt-6-sol.
- 1
juliusmarminge changed the title
juliusmarminge assignedjuliusmarminge
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
3fd37cdMacroscope's review found this PR approvable — This is a focused UI bug fix that replaces opaque structured thread errors with their readable nested message while preserving access to the complete diagnostics. Existing consumers retain their behavior, and the new parsing and expand/collapse behavior are covered by focused tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
82ad9c06-5be7-4728-92ba-8e2e93dead79
📥 Commits
-
Reviewing files that changed from the base of the PR and between ab6be13d438abeace7617e8d789d59cf2e880f42 and 3fd37cd52281fe701e21c2e0e10c8ad038b6702c.
📒 Files selected for processing: 4
-
apps/web/src/components/chat/ThreadErrorBanner.browser.test.tsxapps/web/src/components/chat/ThreadErrorBanner.test.tsxapps/web/src/components/chat/ThreadErrorBanner.tsxapps/web/src/components/settings/ExpandableText.tsx
Limit details: You’ve used all 10 included reviews currently available.
-
📝 Walkthrough
-
Thread error banners now show a parsed nested error message when available. Users can expand the banner to view the original error text. Tests cover parsing fallbacks, dismissal keys, and browser expansion and collapse.
Changes: Thread error display
Layer / File(s) Summary Extract and display thread error messages
apps/web/src/components/chat/ThreadErrorBanner.tsx,apps/web/src/components/settings/ExpandableText.tsxgetThreadErrorBannerMessagereturns a nonblank nestederror.messagewhen present and otherwise returns the original error.ExpandableTextdisplays the extracted message while collapsed and the original text when expanded.Validate message display and dismissal keys
apps/web/src/components/chat/ThreadErrorBanner.test.tsx,apps/web/src/components/chat/ThreadErrorBanner.browser.test.tsxTests cover parsing and fallback cases, distinct dismissal keys for errors with the same message and different diagnostic codes, and browser expansion and collapse behavior. Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
saphid,flamboh
Merge Risk: ⚪ Minimal · up to
3fd37-
Thread error banners now show a readable message and let users expand to see the original error text. No actionable merge risk was identified.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description explains the problem, implementation, verification, limitations, and visual results in detail. However, the required Scope and approval information is incomplete because it does not li… Add a link to the triaged bug discussion or approval comment that explicitly confirms maintainer approval of the direction and scope. If approval is not required, explain why this focused fix qualifies for the exemption. Passed checks: 3 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the primary change: showing readable messages for structured thread errors.
Full details: Description check
-
Explanation
The description explains the problem, implementation, verification, limitations, and visual results in detail. However, the required Scope and approval information is incomplete because it does not link to explicit maintainer approval and states that approval is still pending.
Resolution
Add a link to the triaged bug discussion or approval comment that explicitly confirms maintainer approval of the direction and scope. If approval is not required, explain why this focused fix qualifies for the exemption.
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge merged this02c81ec
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes