Repository navigation
fix(ui): show readable errors instead of programming errors - #191192
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR replaces programming exceptions in Control UI error messages with a fallback while retaining diagnostics in the console. Example: Logs receives a response without its expected lines array.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this maintainer-authored PR open: the shared formatter change has useful visual proof, but cause filtering can corrupt retained messages and the new default gives no recovery guidance. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherControl UI pages pass caught failures through formatUiError, which combines error details, redacts sensitive text, and returns presentation text. flowchart LR
A[Page operation] --> B[Caught error]
B --> C[UI error formatter]
C --> D[Programming error classification]
D --> E[Console diagnostics]
D --> F[Fallback or retained message]
F --> G[UI error banner]
Technical reviewBest possible solution: Keep the existing formatter as policy owner, filter programming-error nodes before assembling messages, and provide a default with a clear next action. Do we have a high-confidence way to reproduce the issue? Current-main source explains the exposed exception text, and the supplied browser captures demonstrate it with a malformed Logs response; no target code was executed during this review. Is this the best way to solve the issue? Centralizing presentation policy is appropriate, but filtering flattened strings loses error identity and the generic fallback needs recovery guidance. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f33f9c1c53f9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +56, Tests +104. Total +160 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 2, 2026, 10:43 AM ET / 15:43 UTC. |
…#191192) Show readable failure messages while keeping programming errors in diagnostics. Read error fields through the existing typed helper and narrow diagnostic objects without casts. Validated 77 formatter/Gateway client tests, UI types, assertion safety, and formatting. Safe UserFacingError messages and network/SyntaxError behavior are retained. Prior Cron layout failure is unrelated.
What Problem This Solves
Fixes: pages show raw runtime text such as "Cannot read properties of undefined (reading 'map')" when the Control UI hits a code defect or an unexpected response shape.
User Impact
User impact: those failures now show the caller's fallback, or "Request failed" when there is none. Gateway errors and other messages users act on read exactly as before. Developers still get the original error and stack in the console.
Why This Change Was Made
The fix is in
formatUiError, so every caller gets it.TypeError,ReferenceError,RangeError,EvalError,URIError,InternalError, including ones from another realmGatewayRequestError,GatewayProtocolRequestError,GatewayProtocolRequestTimeoutErrorand the other Gateway client errors,UserFacingError, plainError,DOMException, strings and plain objectsTypeErrorfrom a failed fetch or module load (Failed to fetch,Load failed,NetworkError when...), since it describes the connectionSyntaxError, since Debug's RPC params showJSON.parseerrors that users fixThe check reads the error's class name, not its text, and Gateway errors have their own classes, so a Gateway message quoting a server exception still passes. A plain wrapper with a programming error as its
causekeeps its own message and drops only that cause."Request failed" is untranslated, like the callers that already pass it as a fallback: the translated equivalents live in lazy catalogs and render as raw keys on pages that have not loaded them.
Evidence
gateway.node.test.tsnow throwsSyntaxErrorfor a bad socket URL, which is what browsers throw; its fixture threw aTypeErrorbrowsers don't raise there.Logs on
pnpm dev:ui:mock.mainnow mockslogs.tail(#190380), so to reach this failure both captures ran locally with that one fixture line removed, restoring the mock's default empty response. The line removal is not in this PR. On the unmodified mock, Logs renders its entries with no banner.Before
After
After, 390px
Console on After:
[control-ui] programming error hidden from the UI: TypeError: Cannot read properties of undefined (reading 'map') at loadLogs.Checks on the touched files: oxfmt, oxlint,
tsgo:ui,ui:check-performance:base, mapper unit tests,gateway.node.test.ts, and 25 unit files covering Logs and error consumers, plusextensions/workboard/browser.