Repository navigation
fix(design-critique): render a failed ask turn through ErrorNotice - #13461
Conversation
A follow-up question whose send, slot read or poll failed put the error text straight into the answer slot, coloured `var(--error)`. That is the hand-written red-text surface `website/AUTOSDE.yaml` `errors-use-error-notice` bans: it carries no icon, no `role="alert"`, and it throws away the structured context `ErrorNotice` recovers from the error journal. The failed branch now renders `<ErrorNotice variant="inline" />` with the same message. The question row above it is untouched, and a successful answer keeps `var(--text)`. No hand-off: the Ask composer under the thread holds an unsaved draft question and is the retry surface for this thread, so `askAgent` stays off per the rule's no-hand-off form.
|
Intent: Make a failed Design Critique ask turn report through Not a goal: migrating any other hand-written error surface, changing how the ask transport succeeds, retries or polls, restyling the question or "Thinking…" rows, turning on the agent hand-off, or any refactor of |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] bd6ffee |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the caught What this change shipsInventory (4 items) — 4 justifiedIntent: FIX — a failed ask follow-up should report as an error, not as red text, per the blocking
The change is mandated by [FIRST-PRINCIPLES-REVIEWED] bd6ffee |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify a long raw Suggestions
[UX-REVIEWED] bd6ffee |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
buluoray
left a comment
There was a problem hiding this comment.
Reviewed at bd6ffeea. The failed Ask turn now renders through <ErrorNotice variant="inline"> instead of a hand-coloured <div>, satisfying errors-use-error-notice; the no-hand-off comment is accurate (the composer below holds the unsaved askDraft). t.a stays a React text child. Page-level test now asserts getByRole('alert').
Non-blocking: DesignCritiqueAskLayerCov80.test.tsx:121-129 still asserts only the text, which passes against the old <div> too; adding getByRole('alert') would make it a real component-level guard.
…irodotdev#13461) A follow-up question whose send, slot read or poll failed put the error text straight into the answer slot, coloured `var(--error)`. That is the hand-written red-text surface `website/AUTOSDE.yaml` `errors-use-error-notice` bans: it carries no icon, no `role="alert"`, and it throws away the structured context `ErrorNotice` recovers from the error journal. The failed branch now renders `<ErrorNotice variant="inline" />` with the same message. The question row above it is untouched, and a successful answer keeps `var(--text)`. No hand-off: the Ask composer under the thread holds an unsaved draft question and is the retry surface for this thread, so `askAgent` stays off per the rule's no-hand-off form. Co-authored-by: Joe Guo <zejiangg@amazon.com>
Problem / Motivation
In Design Critique you can select a line of the report and ask the critic about it. When a follow-up question fails — the send is refused, the slot read is lost, the poll times out — the answer slot showed the failure as plain red words.
Red words are not an error surface. There is no warning icon, nothing tells a screen reader an error happened, and the one component that can hand an error to the agent was never involved.
Why it matters
website/AUTOSDE.yamlerrors-use-error-noticeis a blocking rule: a failed operation reports throughErrorNotice. It exists because this is an agent app — an error the user cannot fix is often one the agent can, andErrorNoticeis the only place that recovers the route, endpoint, HTTP status and backendcodefrom the error journal.A hand-written red
<div>throws all of that away. A user whose question failed sees colour and no help, and a screen-reader user is told nothing at all.What changed (motivation → approach → change)
A failed ask turn now says it failed the same way the rest of the dashboard does.
website/src/apps/design-critique/AskLayer.tsx, the failed branch of the turn renderer:<div>colouredvar(--error)ErrorNotice variant="inline"role="alert"The ask thread was written before the rule and was never migrated. Every rejection the thread's
runTurncatches landed on one line, which painted the message red and stopped there.That one branch is the whole change. The failed case renders
ErrorNoticewith the same message string;ErrorNoticelooks the structured context up by that string, so nothing had to start threading an error object. The question row above stays. A successful answer still usesvar(--text), and the "Thinking…" row is untouched.The agent hand-off is deliberately off. The Ask box under the thread holds a question the user may be part-way through typing, and the hand-off navigates to the chat, which would take that draft with it. The rule's
No hand-off:comment records that choice next to the code.Backwards compatibility
Compatible: no stored shape, prop or API changed. A saved critique with a failed turn reads back the same and now renders through the notice.
Tests
website/src/test/DesignCritiquePage.coverage.test.tsx, "reports a failed follow-up on the turn itself", now asserts the failure arrives as analertcarrying the message, rather than only that the text is on screen. Checked against the pre-fix component: it fails there withUnable to find an accessible element with the role "alert". All 44 tests in the file pass with the change.Manual verification
Both screenshots below were taken from the real
AskLayerwith a thread whose last turn carriesfailed: true. The "after" shot is only written once a visiblealertcarrying the failure message is on screen, so a regressed component cannot pose for it.Screenshots / video
Dark theme, the ask popover over a critique report. The failed turn is the last one.
Before — the failure is red answer text:
After — the failure is an inline ErrorNotice with a warning icon:
Related Issues
Closes #10356
Pattern harvest
Rule candidate: review-prompt
Pattern: a failure rendered by colouring an existing text node instead of through the shared error component
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)