Skip to content

feat(chat): pick effort in Switch All Sessions - #13619

Open
patrigao wants to merge 1 commit into
mainfrom
feat/switch-all-effort
Open

patrigao wants to merge 1 commit into
mainfrom
feat/switch-all-effort

Conversation

@patrigao

@patrigao patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let one Switch All Sessions pass set reasoning effort together with the model, and make a changed Settings default effort show in the composer without a reload.

Switch All Sessions moves every session to one model, but it cannot set their reasoning effort. To run everything at, say, High, a user has to open each session's effort control one by one.

Separately, changing Settings → Chat → Default reasoning effort did not reach the composer. The effort chip kept naming the old level until a hard refresh, even though sessions already ran at the new one.

Why it matters

Effort is the other half of "what does this session run on". A bulk model switch that cannot set it leaves the job half done. The stale chip tells the user their sessions run at a level they do not.

Not a goal

  • Reading a session's effort at every turn. Effort is still fixed when a session starts, and pushed live only where the backend allows it.
  • Changing the Settings default effort itself or how it is stored.
  • Setting effort on sessions that run on another crew. That crew keeps its own level, and the panel names them.
  • A "deferred" flag on the single model-pick response for the narrow case where the model lands but its effort waits for the next start.

What changed (motivation → approach → change)

One Switch All Sessions pass now sets effort with the model, and a changed Settings default shows in the composer at once. This head is a port onto current main: the panel lives in website/src/pages/chat-sidebar/bulkModelSwitch.tsx (#20524), and the endpoint in src/kiro_crew/dashboard/chat_api/slot_model.py.

Before After Where
Switch All Sessions model only an Effort select under the model list chat-sidebar/bulkModelSwitch.tsx, lib/bulkModelSwitch.ts, api/client/chatSlotSettings.ts
POST /api/chat/slots/model model, skip_running optional reasoning_effort; response adds effort_deferred dashboard/chat_api/slot_model.py
Session already on the picked model n/a takes the level through the effort dropdown's live push, never a reset same
Notices around a switch counts, or none every line names its sessions: already on the model (and the effort, while one is picked), switched, busy, deferred, failed bulkModelSwitch.tsx
Effort chip after a Settings change old default until a reload new default at once hooks/useDefaultEffort.ts

Keep current effort is the default and sends no level. The select offers the levels and no Default. The route refuses an empty reasoning_effort with 400 invalid_reasoning_effort, as main's set_model_target does, because a reset cannot clear kiro-cli's workspace effort overlay. Default is set per session, from its own effort dropdown. Bulk Default can return once #39090 fixes the stored-level clear. The select is disabled, with one line saying why, until a model that uses effort is picked.

A model change commits the level with the reset, the same point main commits the model. A session already on the model is reset only while a fallback model serves it and it is idle. It takes the level through _push_live_effort in chat_api/slot_effort.py, the one push step the session effort route also calls. Like that route, the bulk route writes the effort restore marker first, and answers 503 effort_marker_unavailable before any slot changes when it cannot. A running one is skipped unless the Skip box is cleared; then it records the level for its next start, as the session control does mid-turn. A level the live session does not offer lands in failed. A push the live session can take only on a restart records the level and lands in effort_deferred. A refused or failed push lands in failed with nothing changed. A relay archive keeps its effort, as the session effort route refuses it. The red "reply is stopped" caveat counts only running sessions whose model changes.

After a switch that skipped busy sessions or deferred an effort, the panel stays open. It lists the switched, busy and deferred sessions by name, each session in one line only, and its Cancel reads Close, since leaving undoes nothing. When a skipped busy session goes idle, one more line names it and says Switch now moves it without stopping a reply. Picking another model or effort retires those lines, which described the previous pick.

The panel copy is main's (#18843): every switch keeps the conversation. So this head drops the earlier "resets / keeps its conversation" lists. The remote turn relay is retired on main (dashboard/relay_archive.py), so the peer-effort handling and its 409 are gone too. The bulk path uses the session control's own mid-turn guard, so the earlier ACP turn-lock rework is gone.

New strings and the named on-target line are translated in every catalog under website/src/i18n/.

The composer chips read the configured default from the shared ['kirocrewConfig'] entry, which Settings invalidates on save. The private ['default-effort'] query, ProviderAdapter.resolveDefaultEffort and useKirocrewConfigReader are removed.

Backwards compatibility

Compatible: reasoning_effort is optional and an absent field behaves as before; effort_deferred is a new list beside the existing ones.

Reader: website/src/components/useChatPanePickers.ts:defaultEffort -- chat -- reads useDefaultEffort instead of resolveDefaultEffort; useDefaultEffort.test.tsx
Reader: website/src/pages/chat/page/composerChips.ts:defaultEffort -- chat -- same; useChatPageComposerChips.test.tsx
Reader: website/src/providers/types.ts:ProviderAdapter -- chat -- no other implementer or caller of resolveDefaultEffort on origin/main @ 974172e

Tests

  • test/test_bulk_model_switch_effort.py: a model change commits the level with the reset; an effort-only change pushes live through _push_live_effort and never resets, and the session effort route uses the same step; the restore marker is written once, and a marker failure is 503 with nothing changed; a push the session takes only on a restart is recorded and deferred; a running session is skipped by default and deferred when Skip is cleared, except an unoffered level, which fails; a raised or refused push and an unoffered level change nothing; no live session records the level; a relay archive keeps its effort; an absent level leaves every effort alone; an invalid level is 400 invalid_reasoning_effort; an empty level is 400 invalid_reasoning_effort before any slot, reset, push or marker change.
  • website/src/lib/bulkModelSwitch.test.ts: an effort pick moves a session on the model but not on the effort into affected; every slot still lands in exactly one bucket; an effort-only running session never counts as one whose reply stops.
  • website/src/test/ChatSidebar.bulkModelRosterError.test.tsx: the disabled select and its hint; the count and the sent level; the list offers Keep current effort and the levels, with no Default row; a deferred or busy outcome keeps the panel open, names the switched, busy and deferred sessions once each and reads Close, a new pick retires it, and a clean switch closes the panel; the caveat follows model changes only; the on-target line names its sessions and mentions effort while one is picked; a busy session that goes idle is named as the one Switch now moves.
  • website/src/test/useDefaultEffort.test.tsx: one GET shared with the sidebar's observer; a Settings save that invalidates the key shows the new level; "" when unset, failed or disabled.

Manual verification

Vitest drives the real panel in jsdom; the backend tests drive the real handler over HTTP with a mocked session manager. Not yet exercised against a running gateway.

Real-machine verification

Machine: the author's Linux dev box, x86_64, 48 vCPU / 186 GiB
Before (main eecf4c1): pytest -n0 test/test_bulk_model_switch_effort.py -> 34 failed, 3 passed (main ignores reasoning_effort, so only the cases that send no level, or change nothing, pass)
After (head d5a1b41): pytest -n0 test/test_bulk_model_switch_effort.py -> 37 passed
Cleanup: own computer

Screenshots / video

Captured from a vite build of this head against stubbed API routes (no gateway), sidebar at 300 px.

High picked on claude-opus-4.8: the session already on the model and at High is named, the other two are counted:

High picked, Switch 2 sessions, the on-target line names Weekly report draft as already on this model and effort, dark

The Effort list: Keep current effort, then the levels. It has no Default row; each session's own dropdown sets Default:

Effort list open with Keep current effort then Low to Max, and no Default row, dark

After the switch, one session takes High only at its next restart. The panel names what was switched and what waits, each session once, and its exit reads Close:

Switched line names only the switched session, the deferred line names the other, Close beside Switch 0 sessions, dark

A busy session was left alone and is named. Once it goes idle, the panel says Switch moves it without stopping a reply:

Switched and busy lines naming their sessions, no already-on-model line, Close beside Switch 0 sessions, light

The busy session went idle: a third line says Switch moves it without stopping a reply, Switch 1 session, light

Before a model is picked, and the light theme

No model picked: Effort shows a dash and the line says why, light

High picked, light

Effort list open, no Default row, light

Switched and deferred lines, one session each, light

Switched and busy lines, dark

Busy session idle now, dark

No model picked, dark

Related Issues

no linked issue: requested directly by a user; no tracking issue exists.

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

@patrigao
patrigao requested review from a team and cixuuz September 25, 2026 01:02
@patrigao

Copy link
Copy Markdown
Contributor Author

Intent: Let one Switch All Sessions pass set reasoning effort together with the model, and make a changed Settings default effort show in the composer without a reload.
Not a goal: Changing how single-session effort picks work, adding effort-only bulk switching without a model pick, changing the default effort itself, or surfacing config-read failures in the composer (a failed read falls back to "Default" exactly as on main).

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

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the bulk effort path reuses the session control's live-push step (_push_live_effort) and its marker contract. The removed config reader and query key have no readers left in the tree.

Notes

  • An effort-only change on a slot served by a fallback model goes through a reset instead of a live push. It is also skipped while busy, even when skip_running is false. If that skip is only logged server-side, the panel shows it as "busy". Consider naming that case in the busy line so a cleared Skip box that still skips doesn't look like a bug.

[DESIGN-REVIEWED] d5a1b41

Description read

[DESCRIPTION-READ] 3d3b6cdd45bc1935f41c23fede5fa18f32b717fd81dea7a9071d458b9b8a96cf

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 25, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks: the blind reader identified the new Effort select and its outcome lines correctly, and all six panel states appear in screenshots in both themes.

Notes

  • bulk_switch_effort_deferred "…at its next restart": the reader asked "what restarts a chat, or whether I have to do it." Say who restarts it, e.g. "…from its next start (no action needed)", or name the action the user needs to take.
  • bulk_switch_busy_now_idle "1 of them is idle now, so Switch moves it without stopping a reply" was hard to parse (shot-05/11). It also names a session the line above it calls "not switched". Try "Debug the flaky e2e suite has finished its reply. Switch it now without interrupting anything."
  • running is used on the Skip checkbox and busy in the outcome line for the same state. Use one word in both places.

[UX-REVIEWED] d5a1b41

Description read

[DESCRIPTION-READ] f84b9d036d6032fd62eb56e7cd76d1d9ab3fe0fbdadac37abfc103906e421a7c

That sha256 names everything this verdict read: the PR description, plus the 15 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 25, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging d5a1b41f441d16b06a8e0a41accaaf6817d8802e. Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/dashboard/chat_api/slot_model.py:1034 -- Effort-only pushes race incoming channel turns

outcome, _error = await _push_live_effort(live, effort, slot.key)
Trigger: A Slack message reaches an idle, channel-linked Claude session with runtime sharing disabled while the bulk effort push awaits its config RPC. Slack’s _run_turn acquires the unreserved session lease and enters AcpProvider.stream → _prompt_loop alongside set_config_option → _wait_for_response; neither the switch locks nor the stdout claim counter serializes these readers.
Outcome: Both readers await the same stdout StreamReader; the prompt reader raises RuntimeError, aborting the Slack reply even with Skip running selected.
Anchor: defect
Fix: Hold the existing session turn lease across the live push, classify an unavailable lease as skipped/deferred, and release it in finally, following _write_session_switch.
Sites: src/kiro_crew/dashboard/chat_api/slot_effort.py:423 calls the same live push without holding the session turn lease.
[BLOCK-MERGE] d5a1b41
[GPT-REVIEWED] d5a1b41

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — UPHOLD. Harm is LOW-to-MEDIUM: a Slack turn fails visibly in a short window, and resending the message recovers it.

  • The new bulk caller at slot_model.py:1034 sends the live effort change while checking only _switch_target_busy (slot_model.py:1013). That check can't see a channel turn that holds the lease but hasn't sent its prompt yet. The neighbouring writer at slot_effort.py:739-770 already handles this exact window with try_acquire/release. The finding's second site, slot_effort.py:423, was already unguarded on main (base line 371).

  • The fix is cheap: about 10 lines reusing the existing lease pattern, with a busy lease reported as "skipped" or "deferred". It adds no new state or mechanism, so the cost doesn't outweigh the harm.

    [ADJUDICATION] d5a1b41 total=1 uphold=1 downgrade=0
    UPHOLD F1 src/kiro_crew/dashboard/chat_api/slot_model.py:1034 reason=harm-warrants-remedy
    [GPT-ADJUDICATED] d5a1b41

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d5a1b41f441d16b06a8e0a41accaaf6817d8802e 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 Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d5a1b41f441d16b06a8e0a41accaaf6817d8802e — 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 blocks. The effort pick and the composer-chip fix each remove a named harm. The extra outcome lines in the panel go beyond the Goal and are noted.

Notes

  • Item 5 — oversized: the Goal is "set reasoning effort together with the model" plus the stale chip. Naming busy sessions, the "busy session now idle" line and naming the on-target sessions all go beyond that. Only the deferred line comes from effort. Subtraction: delete bulk_switch_skipped_busy, bulk_switch_busy_now_idle, bulkBusyNowIdle, onTargetKeys and already_on_model_and_effort's names; keep the deferred and failed lines; keep the on-target count. Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 6 — rides along, unjustified relabel: "its Cancel reads Close". No report names anyone who misread Cancel. Subtraction: keep pages.chatSidebar.cancel unconditionally and drop bulkOutcomeApplied.

What this change ships

Inventory (10 items) — 8 justified

Intent: let one bulk switch set every session's reasoning effort with the model, and make the composer show a changed Settings default effort at once. ADDITION plus a FIX.

  1. Switch All Sessions has an Effort select (Keep current effort is the default; it is disabled until a model that uses effort is picked) — justified
  2. POST /api/chat/slots/model accepts an optional reasoning_effort; an empty level is a 400 — justified
  3. A session already on the picked model takes the level through a live push and is never reset; the push step is shared with the effort route (_push_live_effort, 2 consumers) — justified
  4. The response adds effort_deferred, and the panel shows a line for deferred sessions — justified
  5. After a busy skip the panel stays open, names the switched and busy sessions and lists busy ones now idle; the on-target line names its sessions — oversized
  6. Cancel reads Close after an applied partial outcome — unjustified move
  7. The red "reply is stopped" caveat counts only sessions whose model changes — justified
  8. A busy session served by a fallback model whose only change is effort is skipped even with Skip cleared — justified
  9. The composer effort chip updates when Settings saves a new default, because the private ['default-effort'] query is gone — justified
  10. resolveDefaultEffort and useKirocrewConfigReader are removed — justified

[FIRST-PRINCIPLES-REVIEWED] d5a1b41

Description read

[DESCRIPTION-READ] abe63c45d9eed9b4529c9b80ef3572fe1f838bd892a37df7cfec52c8d1743bae

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 Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d5a1b41

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

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

@patrigao
patrigao force-pushed the feat/switch-all-effort branch from 6280dfd to 766b715 Compare September 25, 2026 03:09
@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mechanism: _bulk_effort_only_switch -- effort-only slots take the single-slot no-reset ladder

  • span=925d8ebad939 fixed: an effort-only difference no longer resets the session

Outcome: fixed in 766b715.
api_chat_slots_model resets only when the model changes. A slot already on the target model goes through _bulk_effort_only_switch, which mirrors api_chat_slot_reasoning_effort: live change_effort/clear_effort on an idle capable provider, skipped (reported, retryable) mid-turn, persisted no-op on a non-capable model, recorded for the next cold start with nothing live.
A push that does not land is reported failed with the effort unchanged, never a reset. Tests in TestBulkModelSwitch pin each branch.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=2a2c2777c05c fixed: the bulk loop reuses the single-slot change_effort apply for effort-only slots

Outcome: fixed in 766b715.
Effort-only slots call the same change_effort / clear_effort provider methods and the same non-capable no-op (a slot mid-turn is skipped rather than recorded, since a recorded level would not reach the live session), inside the bulk loop's existing lock order (slot._lock -> session lock -> _model_pick_lock). The reset is reserved for model changes, so the Switch count and the panel warning stay honest.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=841ca967ec2f fixed: the panel copy says what a switch resets and what it keeps

Outcome: fixed in 766b715.
The panel reads: "Pick a model for every session, and an effort level if that model uses one. Changing a session's model resets its conversation. Changing only its effort keeps the conversation." The backend matches: effort-only sessions are not reset, so a Switch count that includes them no longer hides a reset.
Screenshots in the PR body show the new copy in every picker state.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=f4b63245c7a6 fixed: an effort-only bulk switch no longer destroys the conversation

Outcome: fixed in 766b715.
The destruction is removed rather than disclosed: a session whose model already matches gets the level the way the per-session effort control applies it (live push, or recorded when nothing is live; a session mid-turn is skipped and reported for a retry), with no reset. The reset remains only for a model change, and the panel copy says so.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b5d374c628ef fixed: the disabled-picker hint uses plain words

Outcome: fixed in 766b715.
The hint reads "This model doesn't use effort levels, so each session keeps its own." Before any model is picked it reads "Pick a model to choose its effort level." Both are linked to the picker with aria-describedby.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=23aa9c766fad fixed: the level list carries a meaning cue

Outcome: fixed in 766b715.
While the picker is live, the line under it reads "Lower levels are faster, higher levels are smarter.", the sibling ReasoningEffortDropdown's Faster/Smarter anchors as a sentence (a vertical list has no left/right end). It is linked with aria-describedby.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=a0dbdb2cfbfc fixed: the effort default row no longer reuses the model list's "Default"

Outcome: fixed in 766b715.
The row reads "Configured default · Medium" when a default is configured, and "Model default" when none is, so it no longer echoes the model list's "auto -- Default" row.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=900b29ed21cf fixed: the effort-only branch reuses the single-slot apply mechanism

Outcome: fixed in 766b715.
No constraint blocked it: _bulk_effort_only_switch runs inside the bulk loop's existing locks and applies the level with the same change_effort / clear_effort calls and non-capable no-op as api_chat_slot_reasoning_effort; a slot mid-turn is skipped instead of recorded. The reset now happens only for a model change.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=cf6f0b56755c fixed: the unread reasoning_effort response field is removed

Outcome: fixed in 766b715.
api_chat_slots_model no longer returns reasoning_effort, and chatSlotsModel's return type drops it; the response shape matches main. Two tests assert the key is absent.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b4e8a17aaf75 fixed: the bulk-switch log line is back to main's text

Outcome: fixed in 766b715.
The Bulk model switch to %r: ... info line is byte-identical to the base; the effort rider is gone.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=78d6e248f252 fixed: committed bulk changes mark the slot dirty

Outcome: fixed in 766b715.
Both commit points in api_chat_slots_model (the effort-only branch and the model-change commit after the reset) set slot._dirty = True, the idiom api_chat_slot_reasoning_effort and api_chat_slot_model use, so the periodic flush persists the change. Tests assert changed slots are dirty and an unchanged slot is not.
A forced awaited save with rollback was not added: no sibling slot handler does that, and the flush owns durability.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=4b27d04f5c9a fixed: the disabled picker explains itself before a model is picked

Outcome: fixed in 766b715.
Whenever the effort picker is disabled, one hint line renders and the picker points at it via aria-describedby: "Pick a model to choose its effort level." before a pick, the no-effort reason after one. A test covers the no-model state.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=d085816e0bea rebutted: "" leaves a stale cli.json overlay entry

Outcome: rebutted (no change needed in this PR for the bulk path; the remaining gap is shared and pre-existing).
On an idle live session an effort-only "" now calls clear_effort(), which clears the overlay entry; None (overlay locked) is reported failed.
The residual case (a reset, or no live session, with no configured default) is the factory seeding _effort_per_model from _read_cli_overlay because slot.reasoning_effort or None cannot tell "" from unset. api_chat_slot_reasoning_effort has the same gap on its reset/no-live paths on main; the fix belongs in the factory, not a bulk-only mirror of it.

@patrigao

patrigao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=d085816e0bea fixed: a remote-bound slot's effort is not written on the local mirror

Outcome: fixed in 766b715.
api_chat_slots_model leaves a remote slot's effort untouched (the peer owns it and this path has no relay); an effort-only remote slot is reported in skipped_running. The model keeps the pre-existing bulk behaviour for remote slots. A regression test covers it.

@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 readiness: checking Automated validation is still running labels Sep 25, 2026

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

Thanks for this. Naming the sessions in each notice, and splitting the ones a switch resets from the ones that keep their conversation, looks like exactly what #11231 asks for. A few things stand between this head (48e03ef) and a merge:

  1. Rebase onto main. The bulk-switch panel has moved out of ChatSidebar.tsx into website/src/pages/chat-sidebar/bulkModelSwitch.tsx (#20524), so this needs a port, not just a conflict fix. Main also reworded the reset copy after this branched (#18843), so please build on main's current strings instead of the resets_its_conversation text here.
  2. The "already on this model" bucket. #17670 added that bucket after this branched, and on main it is still a count only. If it names its sessions the same way the other notices here do, the panel stays consistent.
  3. The open UX Review and Design Review findings on this PR still need answers on the rebased head.

This is a comment only, not a review verdict. Happy to take another look once it is rebased.

@bolichen97

Copy link
Copy Markdown
Contributor

Thanks for this PR. It now conflicts with main. Could you rebase onto the latest main and resolve the conflicts? We will review it again once it is rebased and CI is green.

This branch has had no activity for over 30 days. If there is no further activity in the next 14 days, we may close it. You can always reopen it or open a new PR later.

@patrigao

Copy link
Copy Markdown
Contributor Author

Porting this branch onto current main now, as requested above: the bulk-switch panel moved to website/src/pages/chat-sidebar/bulkModelSwitch.tsx (#20524), and the panel copy will build on the strings from #18843. A single-commit head on main follows on this branch, with replies to the open UX, Design and First Principles findings on that head.

@patrigao

patrigao commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

resolution: removed

  • span=cb9a7d26abf3 fixed: the panel no longer says a switch resets a conversation

fixed in 77cfecd: by the author's decision (D2) the pre-click "resets / keeps its conversation" lists and their strings are gone.
The panel copy is main's from #18843: "Pick a model for every session. The conversation is kept and continues on the new model."
That copy is true here: a model switch resets through SessionManager.reset with the conversation kept, and an effort-only change does not reset at all.
Each outcome notice names its sessions instead: already on this model, switched, busy, deferred, failed.
The one real loss, a running reply, keeps main's red caveat, shown only when a running session's model changes.

@patrigao

Copy link
Copy Markdown
Contributor Author

@cruisercohen ported onto main at 77cfecdacc, one commit:

  1. Port. The effort select lives in website/src/pages/chat-sidebar/bulkModelSwitch.tsx and the endpoint change in src/kiro_crew/dashboard/chat_api/slot_model.py. The panel keeps main's fix(chat): say what Switch All Sessions keeps and what it stops #18843 copy, so the earlier "resets / keeps its conversation" lists are gone.
  2. "Already on this model." The line now names its sessions, like the failure notice: "2 sessions already use this model: A and C".
  3. Open findings. The UX BLOCK on reversibility is answered in its own disposition. The Design concern was the ACP turn-lock rework riding in this PR. That rework is not in this head: Kiro, KAS and Codex chats run on the shared runtime on main, whose queue lets a config write run beside a live turn, and the bulk path now uses the session effort control's own mid-turn guard. The First Principles items no longer apply: there is no new SimpleSelect prop, and the onboarding hunks are gone. The remote-peer effort handling is gone too, since main retired the turn relay.

The lanes are re-running on the new head; anything they raise gets its own reply.

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=f5b5a82bdf71 fixed: after a switch that stays open, the exit reads Close and says what was applied

fixed in 8b6a47f: when a switch skips busy sessions or defers an effort, the panel names the sessions it switched ("Switched 2 sessions: A and B"), the busy ones and the deferred ones, one line each.
The Cancel button reads Close in that state, since leaving the panel undoes nothing; a switch with nothing left to report still closes the panel.
A failure with nothing switched keeps main's Cancel beside "Retry N failed sessions".

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=aa8f4d029522 rebutted: a failed effort push whose rollback also fails is out of proportion here

Rebutted as disproportional, matching this lane's own adjudication: it needs the live push to raise after the overlay write and the rollback to then lose the overlay lock.
The result is a slot that shows the old level while the next start runs the requested one; a retry of the same pick lands it and the slot matches.
The session effort route has the same gap today (slot_effort.py, the change_effort refusal branch), because change_effort reports a failed rollback only in a log line.
Closing it needs a rollback-result contract from the provider, used by both routes, which is a separate change.

@patrigao

Copy link
Copy Markdown
Contributor Author

resolution: removed

  • span=1f389fbb066a fixed: the turn-lock rework, and so the live-gateway run it needed, is gone from this PR

fixed in 8b6a47f: the author's decision (D1) drops the ACP turn-lock rework from this PR; acp/ and providers/ are untouched.
The bulk effort-only path reuses main's single-session effort guard instead: _switch_target_busy before any push, and change_effort or clear_effort on an idle session only.
With no concurrency change left, there is no turn-lock behaviour for a live-gateway run to exercise.

@patrigao

patrigao commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

resolution: removed

  • span=0d61a8855985 fixed: the turn-lock rework no longer rides in this PR, and no lock-first PR follows

fixed in 8b6a47f: by the author's decision (D1) the lock rework is dropped, not split; this head carries only the Switch All Sessions effort and the composer default.
The dependency that tied them is gone: the effort-only push runs only on an idle session, the same guard main's single-session effort control relies on.
The Design lane read PASS on 77cfecd, the first head without the rework.

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=1bbf28c36cdd fixed: one push step for both effort routes

fixed in fc49392: _push_live_effort in chat_api/slot_effort.py now holds the push (change_effort, or clear_effort(every_model=True) for Default). api_chat_slot_reasoning_effort and the bulk route's _bulk_effort_only_switch both call it, and slot_model.py makes no change_effort/clear_effort call of its own.
The bulk route also writes _remember_reasoning_effort_for_restore once per request, before any slot changes, and answers 503 effort_marker_unavailable when it cannot, the same body as the session route. The pick-generation bump comes from the reasoning_effort setter, which the bulk path calls only for a changed level.
test_bulk_model_switch_effort.py patches the shared step and checks both routes call it, and checks the marker write and its 503.

mechanism: one shared push helper, _push_live_effort, replaces the bulk copy of the push
self-added: no

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=0bf16546c271 fixed: the on-target line mentions effort, and each session gets one status

fixed in fc49392: while an effort is picked, the line reads "1 session already uses this model and effort: Weekly report draft" (new key already_on_model_and_effort). A session on the model at another effort is the one "Switch N sessions" counts.
After a switch, each session is in one line only. A deferred session is no longer also listed as switched, and the on-target line is hidden while the outcome is shown. A new model or effort pick retires the outcome, which described the previous pick, and brings the on-target line back. The new screenshots in the description show both frames.
The intro sentence stays main's #18843 copy, per the author's decision recorded on this PR (keep main's copy and name the sessions in each outcome notice).

self-added: no

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=aa8f4d029522 fixed: a busy effort-only switch no longer records a pick that never applies

fixed in fc49392: _bulk_effort_only_switch now skips a running session for Default ("") even when Skip running is cleared, because only the live clear_effort drops the kiro-cli workspace overlay. A level the live session does not offer lands in failed before the busy branch can defer it, through one accepts_effort_level check shared by the busy and idle paths. Only an offered level is deferred mid-turn, as the session effort route does.
The frontend partition mirrors the Default rule, so "Switch N sessions" counts what the backend will change. Tests: test_bulk_model_switch_effort.py (busy Default skipped, busy unoffered level failed) and bulkModelSwitch.test.ts.
The lane's second site, slot_effort.py's mid-turn Default on main's own route, is not code this PR adds. It is deferred to #39090, which also tracks Default on a session with no live process.

mechanism: Default is never deferred mid-turn, and one vocabulary check runs before the busy branch
self-added: no

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=739526faf772 fixed: bulk Default on a running kiro-cli session no longer commits without the overlay clear

fixed in fc49392 for the busy path: a running session is skipped for Default whatever the Skip box says, so nothing is committed and effort_deferred never names it. A retry once the session is idle runs clear_effort(every_model=True) through the shared _push_live_effort.
The no-live-provider path and the model-change path are deferred to #39090. Both commit "" with no clear, and main's session effort route does the same: with no live provider it takes the reset path and commits "". One fix belongs in the shared commit point, for both routes, rather than a bulk-only overlay edit here.

self-added: no

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=612482647314 fixed: the busy-outcome screenshots now come from this head

fixed in the description (no code change): both busy-skip frames are re-captured from a build of fc49392, in both themes, and replace the two older frames.
They show what this head renders after a busy skip: "Switched 1 session: Refactor the auth middleware" and "1 session was busy and was not switched: Debug the flaky e2e suite", with no already-on-model line, and Close beside "Switch 1 session".
The other eight frames were already captured from fc49392.

self-added: no

@patrigao

Copy link
Copy Markdown
Contributor Author
  • span=5adcc0a11066 fixed: after a busy skip, the panel says what Switch moves

fixed in 26caefb: once a skipped busy session goes idle, a line under the busy one names it: "1 of them is idle now, so Switch moves it without stopping a reply: Debug the flaky e2e suite". It names only sessions that are idle and that the Switch count includes, and it is translated in every catalog.
While the session is still replying, no such line shows, so "Switch 0 sessions" offers nothing for it. With Skip unticked, the existing red caveat says a model change stops the reply.
The outcome box is now tall enough for three lines at sidebar width. The new frames in the description show the busy state and the idle-now state from this head, in both themes.

self-added: no

@patrigao

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/ (same-dir specs), src/kiro_crew/cli_config.py and src/kiro_crew/dashboard/handlers/browser_ops.py imports, and related tests since this head went green (9f2919b -> 0d68cae); CI re-running.

@patrigao

Copy link
Copy Markdown
Contributor Author

resolution: narrowed -- the effort-only live push no longer runs for a slot a fallback model serves; that slot returns to main's existing reset path
self-added: no
mechanism: fallback gate on the bulk effort-only branch only

  • span=aa8f4d029522 fixed: a fallback-serving slot takes its effort with the reset, not a live push

fixed in fe9cd7b: the bulk effort-only branch now runs only when the pin equals the pick and no throttle or refusal fallback serves the slot, the predicate the single-slot route uses. A fallback-serving slot falls through to main's reset path, which commits model and level together and bumps the pick generation, so the fallback restore drops its record instead of reapplying the old level.
Main's unchanged shortcut is kept as it was: the lane's second site would have made a model-only pick reset fallback-serving slots main leaves alone, and with Skip unticked stop a reply the panel showed as on-target.
Tests: test_a_fallback_serving_slot_takes_the_level_with_the_reset (fails without the gate) and test_a_fallback_serving_slot_with_no_effort_change_is_unchanged (pins main's behaviour).

@patrigao

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: busy skip for a fallback-served slot whose only change is its effort

  • span=739526faf772 fixed: a busy fallback-served slot is skipped, never reset, for an effort-only change

fixed in cdfa132: past the unchanged and effort-only branches, a slot whose pin equals the pick can only be one a throttle or refusal fallback serves with only its effort changing. For that slot the bulk route uses skip_busy = skip_running or slot.model == model_name at the pre-reset busy check, the reset's skip_if_busy and the decline ladder, so a busy one lands in skipped_running even with Skip unticked.
That matches what the panel already predicts for an effort-only change (no stopped reply, skipped for Default), so the missing caveat no longer hides a torn-down reply. An idle one still takes the reset with its level. A model change keeps skip_running's force semantics.
Tests: test_a_busy_fallback_serving_slot_is_skipped_even_when_not_skipping_running (fails without the change) beside the idle reset test.

@patrigao

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=aa8f4d029522 rebutted: a clear that fails mid-RPC is main's provider behaviour, shared with the per-session route

Rebutted: the partial commit is in AcpProvider.clear_effort (providers/acp_model_effort.py:806-826), which writes the workspace default to the overlay before its RPC and has no rollback. This PR does not change that file (git diff origin/main -- src/kiro_crew/providers/acp_model_effort.py is empty).
The bulk route reaches it through _push_live_effort, the same step api_chat_slot_reasoning_effort calls, so the per-session effort dropdown hits the identical state on the identical transport failure. The bulk route reports the slot as failed and leaves its committed level alone, as that route does.
Adjudication on this head rated the harm LOW: it needs a transport loss during the push, the failure is shown to the user, and the next start re-resolves the level. A rollback belongs in clear_effort for both routes, not in a bulk-only wrapper.

@patrigao

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_handlers.py, website/src/i18n/locales/*.json and same-dir specs under docs/system-specs/modules/ since this head went green (6bd6d5b -> a4efe28); CI re-running.

@patrigao

Copy link
Copy Markdown
Contributor Author

resolution: narrowed -- bulk Default is removed, so no bulk path commits Default without the live clear_effort; Default stays on each session's own effort dropdown
self-added: yes
mechanism: the bulk route refuses an empty reasoning_effort, as main's set_model_target refuses it

  • span=739526faf772 removed: the bulk switch no longer offers Default, so the reset path never commits it

removed in e8cf379: POST /api/chat/slots/model answers reasoning_effort "" with 400 invalid_reasoning_effort, before the restore marker, any reset, any live push or any slot change. The Effort select offers Keep current effort and the levels, with no Default row. The Default-only branches (the busy skip for Default in _bulk_effort_only_switch, its overlay_busy outcome, and the partition rule for an effort-only Default) are deleted with their tests.
A model change or an effort-only change now carries a concrete level, which the reset commits as the session's override and the live push sends as change_effort, so no surface can read Default while kiro-cli's overlay keeps the old level. Bulk Default can return once #39090 fixes the stored-level clear.
Tests: test_default_is_refused_before_any_slot_or_marker_changes (fails with the old check, which accepted ""), and the panel test asserting the list is exactly Keep current effort, Low, Medium, High, Extra High, Max (fails with a Default row).

@patrigao

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_handlers.py, website/src/components/useChatPanePickers.ts, test/test_slot_running_readers.py, docs/system-specs/modules/learn-cron-dashboard.md and website/src/i18n/locales/*.json since this head went green (a4efe28 -> eecf4c1); CI re-running.

Switch All Sessions gains an Effort select beside its model list, so one
pass can move every session to a model and an effort level. "Keep current
effort" (the default) sends no level. The select offers the levels but no
Default: a session goes back to its default from its own effort dropdown.
The select stays disabled, with one line saying why, until a model that
uses effort is picked.

POST /api/chat/slots/model takes an optional reasoning_effort. An empty
level is refused with 400 invalid_reasoning_effort, because a reset
cannot clear kiro-cli's workspace effort overlay. A model change commits
the level with the reset, as before for the model. A session already on
the picked model is never reset: it takes the level through the effort
dropdown's live push. A running one is skipped unless skip_running is
false. A session that can take the level only at its next start records
it and is named in the new effort_deferred list, and the panel stays
open to say so. The panel also names the sessions already on the pick,
as its failure notice already does.

The composer's effort chip now reads the configured default from the
shared ['kirocrewConfig'] entry that Settings invalidates on save, so a
changed default shows without a reload. The private ['default-effort']
query, ProviderAdapter.resolveDefaultEffort and useKirocrewConfigReader
go away.
@patrigao

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: expected effort rows derived from EFFORT_LEVELS

  • span=b9b91bee8cd3 fixed: the no-Default-row panel test derives the levels from the catalog

fixed in d5a1b41: the test builds the expected rows as Keep current effort followed by EFFORT_LEVELS.filter(level => level !== '').map(level => effortLabel(level)), asserts that derived list is non-empty, and checks on its own that no row mentions Default. A level added to the catalog now needs no edit to this test.
Class sweep: git grep -nE "Extra High" over the frontend tests. This PR's test was the only copy of the catalog in a file the PR changes. ChatPanel.defaultModel.test.tsx and KnowledgeSettingsTab.test.tsx are main's files, which this PR does not change.
Proof: with the bulk select offering every catalog entry, Default included, the test fails on the extra row. With the fix in place it passes.

@patrigao

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • span=aa8f4d029522 deferred: a live config push can race a channel turn that takes the session lease

deferred #39429: this is a check-then-await race that main already has in two routes. _try_live_model_switch (the single-session live model switch) and api_chat_slot_reasoning_effort (the per-session effort route) both check that the session is idle, then await the config reply without the session lease.
The bulk effort-only branch runs the same pre-check as the bulk model branch (_switch_target_busy). The model branch is clear of the window only because its reset refuses a held lease atomically, and a live push never goes through that reset.
#39429 covers all three sites with one rule, and names the lease-holding pattern main already uses (land_model_pick_after_channel_turn, _write_session_switch). It also covers what happens to a channel member that holds its lease for its whole listening lifetime.
Harm: a channel reply aborts in a short window, and resending recovers it. It is not a security, data-loss or corruption class.

This branch has not been deployed

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

Labels

readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants