fix(web): show readable messages for structured thread errors #9950
main fromfix/audit-thread-error-headline·opened View on GitHubRelated to #3747. Keep that issue open.
The chat error banner still displays raw JSON even when the response contains a useful error.message. Show that nonempty string in the headline, while retaining the exact original payload in the existing tooltip. Plain text, invalid JSON and unrecognized shapes keep their current display. Dismissal keys still use the raw payload, so different diagnostics with the same headline remain distinct.
HUMAN-HOLD: this is a proposed presentation choice. Diagnostic fields move out of the collapsed headline into the existing tooltip. Keep this PR unmerged pending human approval. It changes only the shared web/desktop banner, not mobile error details, server normalization, transport contracts, layout or word wrapping. It does not address the underlying provider errors.
Earlier message-extraction work was proposed by xxashxx-svg in #3830, which closed when orchestration V2 replaced its server paths. This narrower implementation leaves that broader normalization out. The original tiny-width layout defect did not reproduce on current main and was already addressed by #3899; the remaining raw-JSON headline did reproduce.
Verification#
Both exact public JSON examples were rendered in an isolated Linux Chromium 152 client using a disposable thread. No provider or account request was made. Main 7a089b2b displayed the raw payloads. The exact candidate banner patch was then tested on 2fa5ef4c, whose intervening changes did not touch the banner.
- At the same 366px text width, the 166-character payload becomes its complete 83-character message in two lines. The 245-character payload becomes its complete 115-character message in three lines.
- The tooltip retains the exact original 166/245 characters without horizontal overflow. The wide-view control and native dismiss interaction pass.
- All 30 focused banner tests pass, including both public payloads, whitespace preservation, unchanged fallbacks, one-pass extraction and raw-payload dismissal identity. Fallback shapes were verified in unit tests, not separately in the browser. No new static-markup assertions were added.
- Focused lint, web typecheck and diff checks pass after merging current main. CI and configured reviews are tracked on the current PR head.
The original Arch/Qtile Electron and macOS desktop environments were not available. Mobile is unchanged. These limits are why this PR does not close the whole report.
Before#
The multiline public payload appears as JSON in the clamped headline.

After#
The same error shows its message at the same viewport and thread position.

The existing tooltip still exposes the complete original diagnostic.

GPT 6 Astra via Codex in T3 Code.
Note
Low Risk Presentation-only change in the web chat error banner with conservative parsing fallbacks and no changes to dismissal or transport behavior.
Overview
Structured API error payloads no longer fill the thread error banner headline with raw JSON. A new getThreadErrorBannerMessage helper parses JSON when possible and shows a non-empty error.message string in the clamped headline; plain text, invalid JSON, and unrecognized shapes are unchanged.
The tooltip still shows the full original error string, so diagnostics stay available without cluttering the visible line. Dismissal keys remain tied to the raw payload, so two errors with the same extracted headline (e.g. same message, different code) stay independently dismissable—covered by a new test.
Note
Extract nested error.message from JSON payloads in ThreadErrorBanner headline#
- Adds
getThreadErrorBannerMessageutility that parses a JSON error string and returns the nestederror.messagewhen it is a non-empty string; all other inputs fall back to the original error string without recursive unwrapping ThreadErrorBannernow shows the extracted message as the alert headline while the tooltip keeps the full original error string- Adds test coverage for single-line and multiline JSON, malformed payloads, missing fields, and dismissal-key isolation for diagnostics with the same nested message but different codes
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
Approvability#
Verdict: Approved at
05a247cMacroscope's review found this PR approvable — This is a self-contained web UI fix that replaces raw structured error JSON with its readable nested message while preserving the full payload and existing dismissal behavior. The added tests cover recognized and fallback formats, keeping the runtime impact narrow and low risk.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
Preparation is complete at 05a247c5, against 2fa5ef4c. All executed CI checks pass, including Bugbot, correctness, UI consistency and automated approvability. Skipped checks remain skipped. The complete current-head review snapshot has no unresolved threads or change requests. The 30 focused tests, lint, web typecheck and approved before/after evidence are recorded above.
HUMAN-HOLD remains. Automated eligibility does not decide whether diagnostic fields should move from the headline into the existing tooltip. This PR stays unmerged for that presentation decision, and #3747 stays open with its native-platform and mobile limits. No server normalization or layout behavior changed.
GPT 6 Astra via Codex in T3 Code.
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge assignedjuliusmarminge
Taking over this one for composer-chat-07. Main now uses an expandable error display rather than the original tooltip, so I will rebuild the focused message extraction on current main in a replacement stack, preserving full diagnostics and raw-payload dismissal identity. The existing human presentation-approval hold remains; nothing will be merged.
Thanks for the focused message-extraction work. I rebuilt this as #21483, crediting juliusmarminge, because main replaced the tooltip with an expandable error display while this PR was open.
I compared the complete original diff with the replacement. The conservative one-level extraction, exact fallback strings, whitespace preservation, raw diagnostic availability, and raw-payload dismissal identity are all retained. The obsolete tooltip integration is replaced with the existing inline disclosure, including short diagnostics; the exhaustive JSON matrix is reduced to focused behavior tests plus a real Chromium expand/collapse test. Nothing from the intended presentation behavior was dropped. The dedicated ChatGPT usage-limit panel remains intact.
The replacement has matching actual-app before/after screenshots and an interaction recording, and one parallel Opus/Sol review round found no code blockers. CI is following its current head. The HUMAN-HOLD presentation decision carries over unchanged, and #3747 remains open. Closing this original as superseded; neither PR is merged.
juliusmarminge closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
2fa5ef4· PR result:05a247c· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.