Repository navigation
fix(chat): name the already-on-model sessions in Switch All - #17670
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the "Skip running sessions" checkbox disappearing after a pick, when every running session is already on that model, is the behaviour you want. [DESIGN-REVIEWED] c892ace Description read[DESCRIPTION-READ] 0c61c09beb5687bd87accc6145234a1fc930552ff3a566fcb5f1bbae05a6998e 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 |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (4 items) — 2 justifiedIntent: let a user see why "Switch N sessions" is lower than the visible rows, or reads 0 (#11103). FIX.
[FIRST-PRINCIPLES-REVIEWED] c892ace Description read[DESCRIPTION-READ] 1cd1c555cca3fae09d70a0bde6f6499728e4d21ad670720c0a5d515f6c9f95d1 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.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: |
UX Review (Opus 5.5) — ✅ human override accepted@buluoray overrode this lane for |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 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: |
The Switch N count left out sessions already on the picked model with nothing on screen to say so, so a lower count or a disabled "Switch 0 sessions" could not be reconciled with the visible rows. The count now comes from partitionBulkSwitch, which puts every excluded session in a named bucket, and the panel renders the on-target bucket as one status line. A partition test fails if a future exclusion has no bucket. Closes #11103
The skip checkbox counted every running session, including ones already on the pick that the new on-target line also counts, so the panel still added up to more than the rows. After a pick it now counts only running sessions not on the pick (partitionBulkSwitch.runningOffTarget). Refs #11103
17078e9 to
c892ace
Compare
|
Disposition of the advisory lanes on
|
|
/ai-review override ux c892ace: the 09:27Z BLOCK asked for running-session screenshots; they were added and the UX re-run on this same head returned CONCERNS (advisory). |
Human judgment recorded@buluoray marked the ux AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
bolichen97
left a comment
There was a problem hiding this comment.
Approving. partitionBulkSwitch in bulkModelSwitch.ts returns the same affected set as the old inline filter, and it checks the model before the busy state, like the server does. The exhaustive partition test is a cheap guard against a future exclusion that shows nothing on screen.
One note, not blocking: once a model is picked, the "Skip N running" checkbox in ChatSidebar.tsx hides when every running session already uses that model. That is correct, since nothing is left to skip, but please say so in the PR body so nobody reads it as a regression.
iamwhatever
left a comment
There was a problem hiding this comment.
partitionBulkSwitch replaces the bare filter().length with named buckets that are disjoint and cover every session. The new "N sessions already use this model" line is what lets the Switch count and a disabled "Switch 0" match the rows on screen, so the root cause is addressed. The button's count and its disable condition give the same value as before. A running session that is already on the pick is now counted once, not twice, and the matrix and component tests pin this. One leftover from First Principles on this head is still unanswered: skippedRunning in website/src/lib/bulkModelSwitch.ts:35 has no production reader and duplicates runningOffTarget. Delete it, or post a disposition. Neither blocks the merge.
@kirocrew-computer was not available in this session. It was not needed for this review.
Problem / Motivation
Goal: In Switch All Sessions, the user can see why the "Switch N sessions" count is lower than the session rows on screen, including a disabled "Switch 0 sessions".
The count leaves out sessions that already use the picked model, and nothing in the panel says so. Running sessions have their own "Skip N running sessions" line, but the already-on-target bucket has no surface at all. A lower count, or a disabled
Switch 0 sessions, therefore cannot be reconciled with the visible rows (#11103).Why it matters
A bulk switch resets every conversation it touches. When the number on the button does not match what the user can see, they cannot tell whether the switch will act on the sessions they expect, and a disabled
Switch 0looks like a bug instead of "nothing to do".Not a goal
What changed (motivation → approach → change)
bulkAffectedCountwas an inlinefilter(...).length, so the excluded sessions were dropped without being counted into any named bucket the panel could render.website/src/lib/bulkModelSwitch.tspartitionBulkSwitch(slots, pick, skipRunning)returns{ affected, onTarget, skippedRunning }, disjoint and exhaustive, in the server's order (api_chat_slots_modelchecks the model before the busy state, so a running slot already on the target isonTarget).ChatSidebar.tsxreadsaffectedfor the button exactly as before, and renders arole="status"lineN sessions already use this model(bulk-model-on-target) when a pick is made andonTarget > 0. After a pick, the "Skip N running sessions" label countsrunningOffTarget(running sessions NOT on the pick), so a running session already on the pick is counted once, in the on-target line, not twice. Before a pick it still counts every running session. The line sits above the error notice and the Cancel/Switch row, so that row stays at two buttons.displayModel): no model string is rendered by this change, only a count, so there is nothing to route through it.pages.chatSidebar.already_on_model(plural) inen.manual.json, every shipped catalog with the forms its language needs,pluralKeys.json, and the regenerateden-XApseudolocale.Backwards compatibility
Compatible: the Switch button's count and disable condition compute the same value as before; the change only adds a status line.
Removes nothing: the diff adds a helper, a status line and catalog keys, and replaces an inline filter with the helper that returns the same
affectedvalue.Tests
website/src/lib/bulkModelSwitch.test.ts(new): an exhaustive model × running × skip matrix asserts every slot lands in exactly one bucket; plus the server-order case (running + on-target →onTarget), skip-off vs skip-on, and an unset model. Mutation: dropping theonTargetincrement reddens 4 of 5 tests.website/src/test/ChatSidebar.bulkModelRosterError.test.tsx(3 new cases): the line names the on-target count and updates when the pick changes; a disabledSwitch 0 sessions(all sessions on the pick, one of them running) shows the line; no line when nothing is on the pick. Mutation: removing the line's render reddens the first two.counts a running session once, in the skip line or the on-target lineplus a no-skip-label assertion in theSwitch 0case: the rendered numbers add up to the rows when a running session is on the pick. Mutation: making the label count every running slot again reddens both.bulkModelSwitch.test.tsalso asserts no slot is in bothonTargetandrunningOffTarget.src/i18nsuite (catalog parity, plural forms, key references): 733 passed.node scripts/i18n-check.mjsexits 0.Manual verification
Driven against a pod built from this branch (
kc-fix-11103, Chromium headless via Playwright): created three sessions throughPOST /api/chat/slots(two onclaude-opus-5.5, one onclaude-sonnet-5.5) next to the default session, opened ⋮ → Switch all to model…, and picked each model. Opus: line2 sessions already use this model, buttonSwitch 2 sessions, and 4 rows on screen reconcile. Sonnet:1 session already uses this model,Switch 3 sessions. Re-driven on a pod rebuilt fromc892ace9bawith a session running a real wait turn: the checkbox is absent when that session already uses the pick (1 + Switch 3 = 4 rows), and readsSkip 1 running sessionwhen it does not (1 + 2 + Switch 1 = 4 rows). Both pods were torn down afterwards.Screenshots / video
Light, pick
claude-opus-5.5(2 of 4 sessions already on it):Dark, pick
claude-sonnet-5.5(1 of 4):With a running session (pod rebuilt from
c892ace9ba; 4 rows: the default session,alphaandgammaonclaude-opus-5.5, andbetaonclaude-sonnet-5.5, running a 240 s wait turn):Pick
claude-sonnet-5.5: the running session already uses the pick, so the "Skip N running sessions" checkbox is gone. The panel reads 1 already on the model + Switch 3 = 4 rows.Pick
claude-opus-5.5: the running session is not on the pick, so the panel reads Skip 1 running + 2 already on the model + Switch 1 = 4 rows.Related Issues
Closes #11103
Decision for the owner
The issue asks which surface should account for the sessions already on the target model: a per-row model chip in the sidebar, a session list inside the panel, or one row-less status line. This draft ships the status line, because it is the smallest change that makes the count and a disabled
Switch 0add up, and it does not make the sidebar denser for every user all the time the way a per-row chip would.Pattern harvest
Rule candidate: review-prompt
Pattern: a derived count that excludes items with a bare
filter(...).lengthhides why each item was excluded; partition into named buckets so every exclusion has a surface and a test.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.