Skip to content

feat(web): route an agent-switch refusal through the shared error notice - #11030

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
rnoack1:split/agent-switch-503-notice
Nov 4, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
rnoack1:split/agent-switch-503-notice

Conversation

@rnoack1

@rnoack1 rnoack1 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Carved out of #7161, which is 8.4x over the 1500 added-line cap and is being split so it can
actually be reviewed. Frontend only. Rebuilt on top of #24975, which shipped the shared
AgentSwitchNoticeBanner this PR now uses unchanged.

Problem / Motivation

Goal: A refused agent switch is announced to a screen reader once, and shows up in every window
that can raise it.

A refused switch or setting write is written to two surfaces at once: the shell's banner and the
in-place copy beside the control (the split pane's switch error, the auto-compact popover's error).
Both render ErrorNotice, and both carry role="alert", so a screen reader reads the same failure
out twice.

The banner is also mounted only in the dashboard layout, while its dispatchers (the keyboard agent
and model cycle, the session pickers, the auto-compact unmount flush) run in popout and embed windows
too. There the failure renders nowhere.

Why it matters

A switch refused because a turn is already running is routine and happens mid-task. The double
read-out is worst for the people who depend on the live region, because the second reading arrives
with nothing to mark it as the same event. In a popout window the keyboard cycle has no other
surface, so a refused switch there is silent today.

Not a goal

What changed

ErrorNotice gains an announce prop. The in-place copies pass announce={false} (ChatPane.tsx,
chat-input/ContextShelf.tsx), so they keep their text and drop their live region, which leaves the
banner as the single announcing surface. reportSlotWriteFailure and clearSlotWriteFailure in
components/slotWriteFailure.ts write the banner and the in-place copy in one call, so the pairing
holds by construction: useChatPanePickers (switchAgent, switchModel) and autoCompact go
through them instead of setting each surface by hand.

App.tsx mounts the banner in popout and embed windows too,
{(isPopout || isEmbed) && agentSwitchNotice && <AgentSwitchNoticeBanner ... />}, beside the
other frame-gated notices above the layout branch. The dashboard keeps its existing mount.

switchModel now clears a stale banner before it retries, as switchAgent already did, so a repeat
of the same refusal announces again. An auto-compact slider drag clears the banner only while it
still holds the notice object that slider stored, compared by identity rather than text, so an unrelated notice on the banner (the session-folder line)
is left alone.

Tests

  • tsc -p tsconfig.app.json clean, eslint src/ --max-warnings 0 clean, jscpd zero clones.
  • The 339 affected test files, run locally at this head: 4517 passed, zero failures.
  • ErrorNotice.announce.test.tsx pins announce={false} dropping the live region while keeping the
    text readable, in both variants.
  • agentSwitchNotice.pairedSurfaces.test.tsx renders each silenced call site beside the real banner on
    one real store, drives the real failure through the real API layer, and asserts exactly one live
    region carries the failure text and that it is the banner's. It also drives the slider twice: a drag
    leaves an unrelated notice in place, leaves another control's failure with the same text in place, and still clears the slider's own stale failure after its
    in-popover copy was dismissed.
  • App.topbarAndShortcuts.test.tsx renders the app at a popout path, drives the real keyboard agent
    cycle against a rejecting API, and asserts the banner renders and announces there. A second arm pins
    the two mounts.
  • agentSwitchNotice.surfacePairing.test.ts scans source for an announce={false} copy set outside the
    helper, and for a switch or slider retry that does not clear the banner first.
  • Negative control: with upstream's App.tsx and ChatPane.tsx swapped back in, 5 arms fail (the
    single-announcement check, the popout render and the three mount/silencing pins).

Manual verification

Driven against the real built SPA with stubbed APIs by
website/scripts/capture-agent-switch-turn-in-flight.mjs, which asserts the banner and its
turn_in_flight copy before each frame. In a 520px popout the banner sits below the window's own
header and Return control.

Screenshots

Dashboard, dark and light (temp-screenshots/agent-switch-notice/01-turn-in-flight-dark.png,
01-turn-in-flight-light.png):

Refused agent switch banner in the dashboard, dark theme

Refused agent switch banner in the dashboard, light theme

Popout window, where the banner did not render before
(temp-screenshots/agent-switch-notice/02-turn-in-flight-popout.png):

Refused agent switch banner in a narrow popout window

Split pane, with the banner and the silenced in-pane copy together
(temp-screenshots/agent-switch-notice/03-turn-in-flight-split-pane-both-surfaces.png):

Banner and the in-pane switch error in a split pane

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 15, 2026
@dwu96

dwu96 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review.

When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically.

@rnoack1
rnoack1 marked this pull request as ready for review September 15, 2026 12:00
@rnoack1
rnoack1 requested review from a team and cixuuz September 15, 2026 12:00
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 09fd9a7d369b2fe8ce37f53fb04d7ec5b52c9720 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The screenshots show the banner on the dashboard in both themes, in the popout and next to the silenced in-pane copy. This fork lane has no blind read, so nobody has judged the wording cold; pushing the branch to this repository gets one.

Notes

  • Only the popout screenshot (02-turn-in-flight-popout.png) shows the frame-gated mount. The embed window renders from the same line, {(isPopout || isEmbed) && agentSwitchNotice && …}, but no screenshot shows it. An embed still would confirm the banner fits under that frame's own header.
  • In the 520px popout the banner covers the top of the content, and its border ends just above the ghost. In a session with a transcript it would hide the first messages until dismissed, so a frame with messages behind it is worth checking.

[UX-REVIEWED] 09fd9a7

Description read

[DESCRIPTION-READ] 2be29d859a8b7cc6d85c85db16d51252b23321cd6df8215590f3c813afff4711

That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 09fd9a7d369b2fe8ce37f53fb04d7ec5b52c9720 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level blocker: the in-place copies go quiet only while the banner is mounted in every window that can show them, and the screenshots cover every layout.

Notes

  • switchModel now runs clearSlotWriteFailure without checking first, so it also clears unrelated banner notices such as the session-folder line. The slider guards against exactly this by checking the notice's identity before clearing. Using the same owned-notice check in both pickers would make the rule consistent.

[DESIGN-REVIEWED] 09fd9a7

Description read

[DESCRIPTION-READ] 01f4c16e03f64eba75dd5c55779270223082cdd94ad2b00c5f0918e789f8fdd7

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 09fd9a7d369b2fe8ce37f53fb04d7ec5b52c9720 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 09fd9a7

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 09fd9a7d369b2fe8ce37f53fb04d7ec5b52c9720 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 09fd9a7

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 09fd9a7d369b2fe8ce37f53fb04d7ec5b52c9720 via the fork AI-review pipeline — 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 does not.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (8 items) — 8 justified

Intent: a screen-reader user hears a refused agent, model or threshold write announced once, and the refusal is visible in popout and embed windows. FIX.

  1. The split pane's in-place switch error is still shown but no longer read out as an alert — justified
  2. The auto-compact popover's in-place error is still shown but no longer read out as an alert — justified
  3. The agent-switch banner now renders in popout and embed windows — justified
  4. A model switch in the split pane clears the old banner before retrying, so the same refusal is read out again — justified
  5. A slider drag clears the slider's own earlier failure from the banner and the popover, and leaves other notices in place — justified
  6. ErrorNotice gains an announce prop, on by default — justified
  7. A slotWriteFailure helper writes the banner and the in-place copy together — justified
  8. A capture script plus four review screenshots under temp-screenshots/ — justified

[FIRST-PRINCIPLES-REVIEWED] 09fd9a7

Description read

[DESCRIPTION-READ] 7fcb9c483839df2a5e528aad891212e557ca47f53f6885b6008b80558379ced3

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@rnoack1
rnoack1 force-pushed the split/agent-switch-503-notice branch 3 times, most recently from 624dcca to f7cd5f5 Compare September 22, 2026 04:06
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@rnoack1
rnoack1 force-pushed the split/agent-switch-503-notice branch from f7cd5f5 to 5e0d4ff Compare September 22, 2026 07:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@rnoack1
rnoack1 force-pushed the split/agent-switch-503-notice branch from 5e0d4ff to ab36a6e Compare September 22, 2026 09:20
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Sep 23, 2026
@rnoack1
rnoack1 force-pushed the split/agent-switch-503-notice branch from 82d62e9 to 7f28767 Compare September 26, 2026 23:46
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 26, 2026
@rnoack1
rnoack1 force-pushed the split/agent-switch-503-notice branch from 7f28767 to 6f7073c Compare September 29, 2026 01:51
@rnoack1
rnoack1 requested a review from a team as a code owner September 29, 2026 01:51
@rnoack1
rnoack1 requested review from kyleseaman and removed request for cixuuz September 29, 2026 01:51
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 29, 2026
@rnoack1
rnoack1 force-pushed the split/agent-switch-503-notice branch from 6f7073c to b760a4a Compare September 29, 2026 08:35
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 29, 2026
@dwu96

dwu96 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: dwu96#8c08bee0]: This PR has been stalled since the last review. I reviewed the blockers but they require your input rather than a mechanical fix:

  • The feature is currently unreachable, and both remedies are your call. Opus 5 found that parseErrorCode(body) === 'workspace_unavailable' (website/src/utils/agentSwitchFeedback.ts:36) matches no code any gateway route emits — the switch/model/effort routes answer only member_pin_mismatch, member_thread_agent_pinned, member_session_pinned, invalid_agent_kind, member_binding_unavailable, store_unavailable, turn_in_flight, and the only workspace_unavailable spellings in the tree are steering_workspace_unavailable and an onboarding-scan reason. So on a real build the 13 new locale strings and the gated hand-off never render. The two fixes are (a) emit 503 {"code": "workspace_unavailable"} from api_chat_slot_agent — a backend file this PR does not touch — or (b) drop the branch and its catalog keys until the code exists. First Principles suggests deferring to land with or after the parent PR's backend 503, and notes you offered to wait for it. That's a sequencing decision, not something I should pick.
  • The description describes a design the diff does not ship. The body promises a warn-tinted ErrorNotice, a CircleAlert icon and a warn prop on AskAgentButton; the code pins the opposite — ErrorNotice.tsx states "There is deliberately NO severity axis here", tests assert border-danger and forbid border-warn, and no warn prop exists in this patch. Design and UX both note that a reviewer approving the described design would be approving something else. Rewriting "What changed" to match the shipped danger / role="alert" rendering is author intent, not a mechanical edit.
  • Design 🔴 BLOCK and UX 🔴 BLOCK are both "cannot evaluate: missing every screenshot". The <!-- DROP ... --> placeholders were never replaced and no media is committed, so 0 attachments reached either review. Note that re-capturing is only useful after the point above: frames of the warn design would evidence a different revision.
  • One policy question for a human. turn_in_flight ("A turn is running — try again when it finishes.") is a self-resolving wait that now renders in danger red with an assertive role="alert" on every mid-turn Alt+Shift cycle. The repo's errors-use-error-notice rule mandates the move, but UX asks a human to confirm that rule was meant to cover a benign-wait state.
  • Build Windows Installer (x64) is red and I can't verify a Windows build from this Linux host.

When you've addressed these, the pipeline will re-assess on its next cycle. Add pr-no-autofix to opt out of future automation.

Copy link
Copy Markdown
Contributor

PR triage (automated, 2026-10-05): OVERLAPPING. Recommend REBASE and a merge-order discussion. No breaking change or P0 found.

1. Rebase needed. The merge base is 320d290, 887 commits behind origin/main (a92dde1). git merge-tree reports a content conflict in website/src/App.tsx. On main, the agent-switch toast moved during the shell refactor: the useShellKeyboard destructure is at about L1269 and the bespoke role="status" div is at about L2228. ErrorNotice.tsx merges cleanly with #14008's scrollMessage, but re-check the gate forwarding in both variants after the rebase.

2. The 503 branch still has no emitter on main. The parent, #7161 (a PR), was closed without merging. git grep workspace_unavailable origin/main -- src finds only steering_workspace_unavailable and the onboarding diagnostics. The only open emitter of 503 {"code":"workspace_unavailable"} from api_chat_slot_agent is draft #12702, which is also conflicting (#12055 emits the same code from the workspace/project routes). Please sequence this PR with #12702, or drop the workspace_unavailable branch and catalog keys until it lands. Otherwise isWorkspaceUnavailableError, agentSwitchOffersHandoff and agentSwitchFailureReport's 503 arm are dead code on main.

3. Conflicts with other open PRs over what the toast means. This PR makes AgentSwitchNotice render every chat.agentSwitchNotice as a danger ErrorNotice with role="alert". On main today every setAgentSwitchNotice(...) caller passes a failure, so main is fine. But three open PRs push non-failure copy through the same slot:

Whichever of these merges second would show a success or info message as a red assertive alert. The owners of #9115, #10652 and #15978 should agree on one approach: a separate info notice slot, or a severity carried in agentSwitchNotice.

4. The description doesn't match the diff. Earlier reviews already flagged this: the body describes a warn tint and an AskAgentButton warn prop, but the diff pins danger and role="alert" and the screenshots are still placeholders. That's not repeated as a new blocker here.

Classification: OVERLAPPING with #12702, #12055, #9115, #10652 and #15978. Not DUPLICATE or SUPERSEDED: nothing on main or in any merged PR adds AgentSwitchNotice or the gate forwarding in ErrorNotice.

@rnoack1

rnoack1 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Re-verified each item at the current head 82dfca7aa4149ca281de3d43dcedbabe683d7082.

1. Rebase — done. The merge base is now 310ad48b5f, not 320d290: 112 behind, not 887. git merge-tree --write-tree against the current upstream tip exits 0, so the website/src/App.tsx content conflict is gone. The shell refactor you described is why: the bespoke role="status" div was replaced in place, and the mount now sits at App.tsx:532, above the isPopout ? … : isEmbed ? … branch at :537, beside ImportSessionOutcomeNotice at :523.

On the gate forwarding you asked me to re-check: the gateway gate is scoped to the hand-off menu item, not to the notice. gatewayConnected appears only at ErrorNotice.tsx:50-51, inside ErrorNoticeMenuItem (declared at :33, with the next function at :117), so it suppresses the "Ask the agent" item while the gateway is unreachable. The top-level ErrorNotice gates only on the message, at :294. AgentSwitchNotice passes no hand-off at all, so a switch failure still renders during a disconnect.

2. The 503 branch — dropped, as you asked. workspace_unavailable, isWorkspaceUnavailableError, agentSwitchOffersHandoff and agentSwitchFailureReport have zero occurrences under website/src at this head, and the diff adds no line mentioning any of them. Control for that count: agentSwitchFailureMessage is present in 10 files on the same ref. So there is no dead code waiting on an emitter, and no sequencing dependency on the draft you named. AgentSwitchNotice.tsx states the no-hand-off decision and why.

3. Toast meaning across open PRs — narrowed, and still your call. Two of the three you listed are now closed; only the informational effort toast remains open. Your reading of main still holds at the current tip: effort_clamped has zero occurrences under website/src there (control: reasoningEffortDropdown, 17 files), so every setAgentSwitchNotice caller on main passes a failure. The merge-order question between this change and that one is unresolved, and a severity carried in agentSwitchNotice is the option this PR does not build.

4. Description vs diff — still true, and not fixed here. The body describes a warn tint, a hand-off, a catalog string and an AskAgentButton prop that the diff does not contain. The code is the honest side; the body is stale and is being corrected separately.

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at 4fb5ba503eb057432352a69853ea979edde0e7bf.

  • UX CONCERNS on this head are unanswered. The two frames show a staged stub page, not the dashboard. No frame shows the toast in a popout or embed window, which is where this PR first mounts it. Attach a real dashboard frame and a popout-width frame, or post a disposition.
  • First Principles item 5 is undeclared. The dashboard toast now hides while a remote instance pane is in front. Say whether that is intended, in the description or a disposition.
  • Design note. Confirm the 6s auto-dismiss fires in popout and embed windows.
  • Open decision. Your last comment leaves the merge order with the informational effort toast unresolved. A maintainer needs to settle that before this can land.

Routing the refusal through ErrorNotice and the single-announcer pairing look sound. CI is green apart from the advisory UX lane.

— crew-pr-reviewer (r113)

Rebuilt on kirodotdev#24975 banner: one announcing surface, popout/embed mount.

@bolichen97 bolichen97 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.

[operator: bolichen97] Approving at 09fd9a7.

Routing the refusal through the shared ErrorNotice with one announcer per frame looks sound, and no breaking change was found. On the earlier hold items:

  • The workspace_unavailable branch is dropped from this head, so there is no dead code waiting on an emitter.
  • The merge-order question with the informational effort toast is moot: that PR is closed, and the banner already splits error and status notices on main.
  • The banner hiding while a remote instance pane is in front is existing behavior; this head does not move that mount. Accepted as is.
  • The 6s auto-dismiss now also applies in popout and embed windows, which matches the dashboard. Accepted as is.

Non-blocking suggestions:

  • useChatPanePickers.ts switchModel clears the banner before retrying, which can also wipe an unrelated status notice. The identity guard used on the auto-compact path would avoid that.
  • temp-screenshots/*.png and website/scripts/capture-agent-switch-turn-in-flight.mjs are committed. Please consider dropping them from the branch if they are only PR evidence.

AI-assisted, approved by bolichen97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) needs-author-decision PR blocked on author input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants