Skip to content

feat: name failed bulk switch sessions and label their retry - #31333

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/11231-name-failed-switch-sessions
Nov 7, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/11231-name-failed-switch-sessions

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: After Switch All Sessions fails on some sessions, the panel names those sessions and says when its button would retry exactly them.

When a bulk model switch fails on some sessions, the panel says only "2 sessions failed to switch". Nothing tells the user which sessions kept their old model. The button then reads "Switch 2 sessions", so nothing says that pressing it retries those same sessions rather than switching some other one (#11231, tasks 3 and 4).

Why it matters

A failure the user cannot locate is one they cannot act on: today they have to open each session to find the ones still on the old model. A button that looks like a fresh switch also hides that it is a retry of the request that just failed.

Not a goal

What changed (motivation → approach → change)

Symptom: the failure notice was only a count, and the button after a failure looked like any other switch.

Root cause: the endpoint returns failed as a list of slot keys, but website/src/pages/chat-sidebar/bulkModelSwitch.tsx kept only its length, and the button label never knew that a failure had happened.

Change:

Before After
Failure notice 2 sessions failed to switch 2 sessions failed to switch: Refactor the auth middleware and Weekly report draft
Button, when it would resend the failed switch (same model, exactly the failed sessions) Switch 2 sessions Retry 2 failed sessions
Button, any other time Switch N sessions unchanged

The hook keeps the failed keys and the model they failed on, and builds the notice at render time, so a rename or a language switch while the panel is open shows up. Names and the retry check read every local live slot (ChatSidebar.tsx passes dashboard.slots minus peer slots), because the backend also switches sessions the list hides, such as Crew Mode workers and member DMs. So the button reads as a retry only when the full request would touch exactly the failed sessions, its count is the failed set, and it stays enabled when every failure is a hidden worker. The notice is capped in height and scrolls (ErrorNotice's scrollMessage), so a long list of names never pushes Cancel or Retry out of reach. Each name is what sessionDisplayTitle returns, so an untitled session reads "Untitled session", as it does on its row.

i18n: pages.chatSidebar.session_failed_to_switch gains a {{names}} list in en.manual.json and all 12 translated catalogs. pages.chatSidebar.retry_failed_session is a new plural key in the same catalogs and in pluralKeys.json. Both keys have translator context in en.context.json, and en-XA is regenerated. The useBulkModelSwitch row of the owner table in docs/system-specs/modules/history.md names the new responsibility.

Backwards compatibility

Compatible: copy and client state only. No API, setting or stored data changes.

Removes nothing: the notice key keeps its name and plural forms and only gains a placeholder. Every other label is unchanged.

Tests

website/src/test/ChatSidebarCoverage.test.tsx:

  • names the sessions a partial failure missed and offers to retry them on the model that failed: the notice reads 1 session failed to switch: Idle A and the button reads Retry 1 failed session. Picking another model turns the button back into Switch 1 session, and picking the failed model again turns it back into the retry. Unticking Skip adds a session that did not fail, and the button reads Switch 2 sessions. The test fails on main, and it fails with the model check removed.
  • names a failed session the list hides, a Crew Mode worker, by its title: it fails when names are read from the visible list only, because the notice then says "Untitled session".
  • A hidden Crew Mode worker or a member DM that was skipped as running and is idle again turns the retry back into a plain switch, since the request would switch it too.
  • A visible session and a hidden worker that both fail read Retry 2 failed sessions; a failure on a hidden worker alone keeps Retry 1 failed session enabled and resends the same model. Each of these fails with its production line reverted.
  • Twenty failed sessions with long titles: every title is in the notice, the notice is height-capped and scrolls, and Retry and Cancel stay enabled outside it.

On the final head the file ran green in 6 shuffled orders (--sequence.shuffle, seeds 7 to 57).

Determinism: the whole file ran ten times in shuffled order (--sequence.shuffle, ten seeds) and was green every time.

Also green: the i18n catalog suites (parity, QA, changed-value QA and the per-locale style tests with I18N_BASE_REF, context sidecar, pseudolocale, plurals), npm run i18n:check, tsc -p tsconfig.app.json, eslint, the related sidebar and i18n test sets, and semgrep on the diff.

Manual verification

I built the SPA and drove the panel in Chromium against stubbed APIs: three sessions, one of them running, with a model picked and the switch failing on the two idle ones. In English, German, Portuguese, Russian, Hindi and French the notice names both sessions, the button reads as the retry, and unticking Skip turns it into Switch 3 sessions. At sidebar width the labels wrap without overflowing. The German and Russian retry labels take two lines.

Screenshots / video

A partial failure (English): the notice names both sessions, and the button is the retry.

Partial failure, English

With Skip unticked, a session that did not fail is added, so the button is a plain switch again:

Skip unticked, English

German, the longest retry label, at sidebar width:

Partial failure, German

Before the switch (English)

Before the switch, English

Related Issues

Closes #11231

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 6, 2026 10:17
@bolichen97
bolichen97 requested a review from Zedmor November 6, 2026 10:17
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 81a8b5f65634c9d4ee3e3437d2bac8c612b901ac — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. This is client-side copy and state that the backend's existing failed list already supports, and it is easy to revert.

Notes

  • bulkAffectedCount still counts only the visible localSlots. The new retry check counts every local live slot, because the backend also switches hidden workers. So outside the retry case, the label Switch N sessions still undercounts what the request touches. Fixing that would be a follow-up, not part of this PR.

[DESIGN-REVIEWED] 81a8b5f

Description read

[DESCRIPTION-READ] cd50ec5e39d5ec1b88fa7520ae24c65f2f7ca2e26c0395b90a0e92245717c127

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 81a8b5f65634c9d4ee3e3437d2bac8c612b901ac — 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

Every item comes from #11231 tasks 3–4. The code reuses fmtList, sessionDisplayTitle and ErrorNotice's existing scrollMessage instead of adding its own.

Notes

  • Item 4 — undeclared: the button is now enabled when the visible affected count is 0 but only hidden workers failed ((bulkAffectedCount === 0 && !bulkRetriesFailed)). The description mentions this only in passing as "stays enabled". It changes when Switch is clickable, not just its label. No subtraction: without it, a failure on a hidden worker alone could never be retried from the panel.

What this change ships

Inventory (6 items) — 5 justified

Intent: let a user see which sessions a bulk model switch missed, and know that the button retries exactly those. ADDITION (copy and client state).

  1. The failure notice lists the failed sessions' titles after the count — justified
  2. The button reads "Retry N failed sessions" when it would resend the same model to exactly the failed set — justified
  3. Names and the retry check cover hidden Crew Mode workers and member DMs (dashboard.slots minus peer slots) — justified
  4. Switch stays enabled when every failure is on a hidden worker — undeclared
  5. The error notice has a fixed maximum height and scrolls — justified
  6. Changed session_failed_to_switch copy and a new retry_failed_session plural key in all catalogs, plus a history.md owner-row update — justified

[FIRST-PRINCIPLES-REVIEWED] 81a8b5f

Description read

[DESCRIPTION-READ] 623cabae85e7c7d927b40418c5bc6f2995e4720a6f8485d54b6e444d3c267ec5

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 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 81a8b5f65634c9d4ee3e3437d2bac8c612b901ac — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader read the named failure notice and "Retry 2 failed sessions" correctly and said they would click it. Every changed state is shown in a screenshot.

Notes

  • Shot-02 shows "Switch 3 sessions" while the error still lists 2 failed sessions. The reader "can't tell whether 3 means the 2 failed ones plus the busy one or every chat" and hesitated to click. One fix: when the request includes the failed sessions, a label such as "Retry 2 failed + 1 more" would answer that.

[UX-REVIEWED] 81a8b5f

Description read

[DESCRIPTION-READ] ff5a2a295cf62fa9a3bbbd7c2ebb06aaec7edb847ad8865d2e43c871b5e565ed

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 81a8b5f

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 81a8b5f65634c9d4ee3e3437d2bac8c612b901ac false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 81a8b5f65634c9d4ee3e3437d2bac8c612b901ac and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 81a8b5f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 81a8b5f65634c9d4ee3e3437d2bac8c612b901ac false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 6, 2026 10:43
@bolichen97
bolichen97 force-pushed the fix/11231-name-failed-switch-sessions branch from e004ca7 to 7cb2adf Compare November 6, 2026 17:26
@bolichen97

bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: retry check reads the full local live roster

  • Retry eligibility excludes workers that the request still switches span=87cbcbbe3701

fixed in 7cb2adf: bulkRetriesFailed partitions the full local live roster (dashboard.slots minus peer slots, so hidden Crew Mode workers and member DMs count), the same set api_chat_slots_model iterates, so the label reads as a retry only when the request touches exactly the failed sessions.
The Retry count is the failed set, and Retry stays enabled when every failure is a hidden worker.
Red/green: hidden worker skipped then idle, and member DM skipped then idle, both read Switch 1 session; each test fails with its production line reverted.

@bolichen97
bolichen97 force-pushed the fix/11231-name-failed-switch-sessions branch from 7cb2adf to 6908a07 Compare November 6, 2026 18:26
@bolichen97

bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: failure notice capped in height and scrolling

  • Long failure lists hide the retry action span=87cbcbbe3701

fixed in 6908a07: the failure notice is max-h-32 with ErrorNotice's existing scrollMessage, the same setup PullRequestPanel uses, so every name stays readable by scrolling and the Cancel / Retry row below it stays in reach.
Red/green: twenty failed sessions with long titles; the test checks the cap, the scroll mode, every title and enabled Retry and Cancel, and fails on the parent.

@bolichen97
bolichen97 force-pushed the fix/11231-name-failed-switch-sessions branch from 6908a07 to eb9febd Compare November 6, 2026 21:15
After Switch All Sessions fails on some sessions, the error notice now
names them the way their sidebar rows do, instead of giving only a
count. When those sessions are all the Switch button would act on, the
button reads "Retry N failed sessions", so the reader can tell a retry
of the failed set from a switch of some other session.

The notice key gains a {{names}} list in every catalog, a plural retry
key is added, en-XA is regenerated and both keys get translator context.
@bolichen97
bolichen97 force-pushed the fix/11231-name-failed-switch-sessions branch from eb9febd to 81a8b5f Compare November 6, 2026 22:53
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved for the on-call. Review lanes pass on 81a8b5f, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 7731a77 into main Nov 7, 2026
97 of 98 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/11231-name-failed-switch-sessions branch November 7, 2026 00:46
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
bolichen97 added a commit that referenced this pull request Nov 9, 2026
A disabled primary button faded its accent fill to 30% opacity, which on
a light canvas reads as a pastel accent rather than a control that is
off. Btn's primary variant and SendBtn now take the muted surface and
label when disabled, and drop their hover glow and sheen; the outline
Btn variants keep the fade. Three call sites that painted the accent
onto a plain Btn use primary, and the embedded chat's send no longer
fades on top of the muted state.

Closes #23978

Backport note: release's Switch All Sessions button has no failed-retry
state (bulkRetriesFailed is from #31333, not on release), so only its
accent classes are swapped for the primary prop on release's line.

Backport note: release's Switch All Sessions button has no failed-retry
state (bulkRetriesFailed is from #31333, not on release), so only its
accent classes are swapped for the primary prop on release's line.

(cherry picked from commit 5658952)
bolichen97 pushed a commit that referenced this pull request Nov 9, 2026
…33387)

The Switch All Sessions panel's Switch button, and the roster Retry
button, took a native disabled while their request ran. The keyboard
press that started it blurred focus to the page, and both requests can
fail with the panel still open, so the reader lost their place before
they could try again.

Both now stay focusable with aria-disabled and aria-busy, look as the
disabled state did, and ignore a second press. Switch with nothing to
switch keeps its native disabled.

Backport note: release's Switch button has no failed-retry state
(bulkRetriesFailed is from #31333, not on release), so the busy swap to
aria-disabled, aria-busy and the click guard is applied to release's
disabled condition and label. The Retry hunk applies as on main. In the
test, the first Switching assertion waits for react-query's notify tick,
as the Retry case already does: on main the click's notice reset (a
#31333 object state) re-renders at once, while release's string state
bails out on an unchanged empty value.

(cherry picked from commit 757df49)
bolichen97 pushed a commit that referenced this pull request Nov 9, 2026
…33387)

The Switch All Sessions panel's Switch button, and the roster Retry
button, took a native disabled while their request ran. The keyboard
press that started it blurred focus to the page, and both requests can
fail with the panel still open, so the reader lost their place before
they could try again.

Both now stay focusable with aria-disabled and aria-busy, look as the
disabled state did, and ignore a second press. Switch with nothing to
switch keeps its native disabled.

Backport note: release's Switch button has no failed-retry state
(bulkRetriesFailed is from #31333, not on release), so the busy swap to
aria-disabled, aria-busy and the click guard is applied to release's
disabled condition and label. The Retry hunk applies as on main. In the
test, the first Switching assertion waits for react-query's notify tick,
as the Retry case already does: on main the click's notice reset (a
#31333 object state) re-renders at once, while release's string state
bails out on an unchanged empty value.

(cherry picked from commit 757df49)
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.

Switch All Sessions: the reset warning overstates what a switch destroys, and every count is anonymous

2 participants