Skip to content

fix(design-critique): render a failed ask turn through ErrorNotice - #13461

Merged
iamwhatever merged 1 commit into
mainfrom
fix/10356-ask-error-notice
Sep 24, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/10356-ask-error-notice

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

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.yaml errors-use-error-notice is a blocking rule: a failed operation reports through ErrorNotice. It exists because this is an agent app — an error the user cannot fix is often one the agent can, and ErrorNotice is the only place that recovers the route, endpoint, HTTP status and backend code from 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:

before after
answer slot <div> coloured var(--error) ErrorNotice variant="inline"
warning icon none yes
screen reader silent role="alert"
agent hand-off impossible decided: off

The ask thread was written before the rule and was never migrated. Every rejection the thread's runTurn catches landed on one line, which painted the message red and stopped there.

That one branch is the whole change. The failed case renders ErrorNotice with the same message string; ErrorNotice looks 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 uses var(--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 an alert carrying the message, rather than only that the text is on screen. Checked against the pre-fix component: it fails there with Unable 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 AskLayer with a thread whose last turn carries failed: true. The "after" shot is only written once a visible alert carrying 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:

Ask thread, failed follow-up as red text

After — the failure is an inline ErrorNotice with a warning icon:

Ask thread, failed follow-up as an inline ErrorNotice

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

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.
@iamwhatever
iamwhatever requested review from a team and Zedmor September 24, 2026 18:40
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Intent: Make a failed Design Critique ask turn report through ErrorNotice, so the failure carries a warning icon, an alert role and the error journal's structured context instead of being red text a screen reader never announces — closing the errors-use-error-notice violation that blocked #8599 on this row.

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 AskLayer.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] bd6ffee

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the caught runTurn rejection message actually reaches the error journal, or the notice renders without the structured context the migration promises.

What this change ships

Inventory (4 items) — 4 justified

Intent: FIX — a failed ask follow-up should report as an error, not as red text, per the blocking errors-use-error-notice rule.

  1. A failed follow-up answer now shows an inline ErrorNotice with a warning icon instead of red text — justified
  2. Screen readers are now told the follow-up failed (role="alert") — justified
  3. The agent hand-off stays off, recorded by a No hand-off: comment naming the Ask composer's draft — justified
  4. The coverage test now requires the failure to arrive as an alert, not merely as on-screen text — justified

The change is mandated by website/AUTOSDE.yaml errors-use-error-notice (blocking, touch-it-migrate-it), carries a linked issue (#10356), and ships one of the rule's three sanctioned hand-off states — the No hand-off: comment names a real draft: the askDraft input rendered directly below the thread. No new surface, no moved control, no changed default; the ~100 grandfathered sibling sites are left per the rule's own recorded migration policy.

[FIRST-PRINCIPLES-REVIEWED] bd6ffee

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] bd6ffee

False positive or not applicable? A repository writer can comment:
/ai-review override gpt bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

UX-level review of bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Verify a long raw e.message wraps cleanly in the inline notice inside the narrow ask popover; both shots show only a short one.

Suggestions

  • The blind reader, seeing the failed turn, said of the composer below it: "if the thing that answers is gone, I don't know if typing here would work" — the code comment calls the composer "the retry surface for this thread", but nothing on screen says so. Pass ErrorNotice's title prop (e.g. "Answer failed — ask again below") on this AskLayer.tsx call site; title exists precisely so guidance can be added without breaking the message-key journal lookup.

[UX-REVIEWED] bd6ffee

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] bd6ffee

Verdict parsed from the review's SHA-scoped output markers for commit bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27.

False positive or not applicable? A repository writer can comment:
/ai-review override fable bd6ffeeab7c2b9f8f5ca6633edc3c705836fbb27: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 24, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

The finding is right and I am not arguing it. The code comment calls the
composer "the retry surface for this thread" and the screen says that to
nobody; the blind reader's quote is the proof.

Deferred rather than fixed here, on two grounds. First, scope: this PR migrates
one render surface and changes no copy. title would add a new user-visible
string, which needs a key in all 14 catalogues under
website/src/i18n/locales/, a fresh capture, and wording that deserves review
AS wording rather than riding a migration. Second, cost against benefit: this
arrived on a fully green head — 93 checks, 0 failing — and a new head resets
every one of them for an advisory Suggestion on a PASS verdict.

Tracked as #13487: deferred-finding label, assigned, Due: 2026-11-07, and
the acceptance names the title prop, the i18n key and the test. The mechanism
the lane proposed is recorded there verbatim, so the follow-up starts from its
suggestion and not from a paraphrase.

No push was made for this item.

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@iamwhatever
iamwhatever enabled auto-merge (squash) September 24, 2026 23:34
@iamwhatever
iamwhatever merged commit 5acddeb into main Sep 24, 2026
93 checks passed
@iamwhatever
iamwhatever deleted the fix/10356-ask-error-notice branch September 24, 2026 23:35
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 24, 2026
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

design-critique: failed follow-up turns render as red text, not ErrorNotice (errors-use-error-notice)

2 participants