Repository navigation
feat(session-control): session_set_model takes an optional reasoning_effort - #15422
Conversation
|
👋 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. |
b4b4792 to
90ef615
Compare
|
Intent: Let an agent set another session's reasoning effort through |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check on a real kiro-cli target that an effort-only pick wins over a stale workspace effort overlay left by an earlier dropdown choice. [DESIGN-REVIEWED] 0e0e066 Description read[DESCRIPTION-READ] f8428a1475ccbfe22ea1f083a69899c3f7ae0aff69f874961244c7fb1bd887a4 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, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: on kiro-cli, does a turn-start reset alone apply the new level through What this change shipsInventory (8 items) — 8 justifiedIntent: let a conductor set a worker session's reasoning effort the way it already sets the worker's model (#15420). This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 0e0e066 Description read[DESCRIPTION-READ] 90b5f88c1ffd146ef8bed69bab64df77ed5fdddf785d986350cd0c6487dc61dc That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
90ef615 to
2cb7103
Compare
Backend Tests (3.12, 3) and (Windows, 4) on |
2cb7103 to
e7dfba3
Compare
Windows shard 4 on |
e7dfba3 to
3e5e423
Compare
|
Rebased onto main at |
|
Rebased the same commit onto current main (c9f6803), no code change, to rerun Backend Tests (3.12, 3). Its only failure was |
|
|
Rebased the same commit onto current main (3b61795), no code change, to rerun the Opus 5 Review, which ended "review incomplete" on 6e9d870 with no findings. GPT, Design and First Principles passed there. The other red checks are in modules this PR does not touch: Windows shard 2 ( |
|
|
|
|
|
Rebased onto main a2bb973 (head 3bdaec7). The only conflict was the Session control / Agent chat egress rows in docs/feature-map/README.md: kept main's new include_session_link egress text and this PR's set-model wording. No behaviour change; set_model tests (82) and the feature-map and docs checks pass. |
@iamwhatever @bolichen97, this needs one of you to decide, since the fence only clears with a human override. Either:
|
|
|
Rebased onto main 126d18a to clear a conflict in |
Round 9ec8ebf also no longer reproduces span 36bec42fc986: GPT passed this head, so the needs-a-decision question in the 2026-10-02 17:00Z comment is no longer blocking. @iamwhatever @bolichen97, readiness has passed and the PR is ready to merge whenever you are. |
|
Rebased on main, no behaviour change. New head ad254d9. The conflict was in |
|
|
|
Reviewed, not approving (crew-pr-reviewer). This adds a new parameter to a session-control MCP tool (+800/-92). It is a tool-contract feature, so a maintainer should accept it. |
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 1e1cedf.
- Read the diff and its call paths (session-control set_model pending pick; slot reasoning_effort generation; MCP session_set_model schema; effort dropdown same-level pick).
- PR Readiness is success from github-actions[bot] on 1e1cedf.
- Read review threads and AI-review comments on this head: no open BLOCK, no unanswered CONCERNS, no CHANGES_REQUESTED in force.
- Compat/UX check: compat risk Low, UX risk none; merge-tree is clean against main 6765454 with no semantic overlap.
Reviewed by Kiro (agent) on behalf of bolichen97 as part of a repo-wide PR sweep.
|
Rebased on main 14879f0, no behaviour change. New head 51f0df6. Two conflicts, both resolved by keeping main's change and this PR's change side by side:
The 82 set_model tests pass, along with |
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
|
Same tree as 51f0df6, with only the commit timestamp changed. New head 29b39ed. This reruns Backend Lint & Type Check (3.12), which was cancelled at the 25-minute job limit partway through mypy. The runner was slow: black alone took 15 minutes, against 9 minutes on main's run 37707528729 at about the same time. Every step before mypy passed, and the other checks and all AI reviews passed on 51f0df6. A fork contributor can't rerun a single job, so this push is the retrigger. |
|
This PR lets session_set_model also record a reasoning_effort for a target session. The effort rides the same pending pick that is committed at the target's next turn start, after the target gate re-runs, so no live push happens after the permission check. That is a sound way to add the missing knob without a second tool. I read the description, the file list and the lane verdicts on head 29b39ed. Design and First Principles PASS, UX is skipped, and GPT and Opus report no blocking findings. bolichen97's earlier review is dismissed, not open. It is on hold only because GitHub reports mergeable=CONFLICTING (DIRTY, label "merge conflict"), so I cannot approve the current head. Please rebase onto main, re-run CI on the new head and re-request review. — crew-pr-reviewer |
|
Rebased on main, no behaviour change. New head d8f5655. The only conflict was the table in @iamwhatever, this clears the merge conflict you were holding on. Could you take another look once CI finishes on this head? |
…effort session_set_model gains an optional reasoning_effort argument and model becomes optional; a call must name at least one. The level is validated against the set the effort dropdown route accepts, its restore-allowlist marker is written at call time, and it rides the existing pending pick: apply_pending_model_pick commits it at the target's next turn start in the same synchronous step as the gate, and the reset that follows makes the cold start apply it through reasoning_effort_override. Each half of a pick yields separately to a newer user choice from its own control. session_read_message reports the current and pending level. The tool takes no mode (Autopilot and auto-approve modes would widen a session's autonomy) and no agent (it crosses the memory boundary). Fixes kirodotdev#15420
|
Rebased on main again, no code change. New head 0e0e066. SAST (Semgrep) failed on d8f5655 with one GPT, Design and First Principles had already passed on d8f5655. @iamwhatever, the conflict is cleared on this head too. |
|
This lets an agent set another session's reasoning effort through |
buluoray
left a comment
There was a problem hiding this comment.
Approving, which also answers the hold for a maintainer's product/permission sign-off on this cross-session control. This adds the missing effort knob to session_set_model without a second tool: effort rides the existing pending pick and is committed at the target's next turn start in the same synchronous step as the authorization re-check, so there is no provider await after the gate. Declining mode and agent keeps the change from widening any session's autonomy.
Checked against source on 0e0e066:
- Only the five canonical levels are accepted; "" and harness-specific levels are refused with effort_rejected. On the five levels, the restore marker written before the gate is a no-op, and cold start applies the level through reasoning_effort_override, which wins over the resolved session effort.
- The effort generation (property setter plus the dropdown's same-level fast path) makes any later user choice, including a round trip back to the original level, win over a pending pick. Each half of the pick yields only to its own control, except on codex, where the model picker is the effort control.
- A pick is refused with target_busy while the dropdown holds the session switch lock.
Each of those guards, reverted locally, reddens a named test in test_session_control_set_model_effort.py / test_chat_slot_reasoning_effort.py. I did not run the full suite; CI is green on this head (92 pass, 12 skipped, 0 failed).
Merge note: #14528 edits the same api_chat_slot_reasoning_effort line; whichever lands second must keep this PR's same-level _effort_pick_gen bump.
Non-blocking follow-up: one long unwrapped line in set_model_target's docstring ("It is committed with the model in the same step. It is NOT pushed live ...").
Problem / Motivation
Goal: an agent can set another session's reasoning effort through
session_set_model, the same way it already sets that session's model.A conductor can pick a worker's model with
session_set_model, but the effort level is only reachable from the dashboard's per-session dropdown (POST /api/chat/slots/{slot}/reasoning-effort). Nokirocrew-dashboardMCP tool calls it, so a conductor that wants alowworker for a bulk sweep and ahighworker for a design review has to ask the user to click the dropdown in each tab.Why it matters
Effort is the cheapest cost and quality knob a conductor has, and it is the one it cannot turn. Without it, every worker runs at whatever level its tab happened to have, and the only fix is a manual click per session.
Not a goal
modeargument. The dashboard's slot mode includes Autopilot (orchestrator) and its approval mode includes auto-approve modes, so a mode switch would let one agent give another session more autonomy than it has now.agentargument. Changing the agent changes the memory store a session reads.What changed (motivation → approach → change)
Effort rides the pending pick
session_set_modelalready records, instead of a second tool or a live push. The model tool's design keeps every write after the last permission check synchronous: the pick is committed at the target's next turn start in the same step as the re-check. A live effort push from the tool call would need provider awaits after the gate, which is the window that design closes.session_set_modeltakes an optionalreasoning_effort, andmodelbecomes optional; a call must name at least one (tool schema insrc/kiro_crew/mcp_dashboard.py, argument check insrc/kiro_crew/validation.py, body parsing insrc/kiro_crew/dashboard/handlers/session_control.py).set_model_targetinsrc/kiro_crew/dashboard/session_control.pyaccepts only the five standard levels (lowtomax) and stores the level onPendingModelPickwith the target's effort write generation at call time. Every backend's cold start folds those five onto its own vocabulary, so a level checked at call time cannot go stale before the pick applies. Levels only one harness offers (Pi'sminimal, Claude'sdefault) and""stay dropdown-only and are refused witheffort_rejected; on kiro-cli the default only takes once the workspace effort overlay is cleared, which the dropdown route's liveclear_effortdoes and a cold start does not. An effort pick is refused withtarget_busywhile the target session's switch lock is held, since the dropdown route holds it across its commit, live push and rollback, and a generation captured inside that window would be invalidated by the rollback._ChatSlot.reasoning_effortinsrc/kiro_crew/dashboard/state.pybecomes a property whose setter bumps_effort_pick_genwhenever the level changes. Any change after the call, from the dropdown, a fork or a rollback, drops the pending level, including a round trip back to the level the caller saw. A same-value rewrite does not bump it, so the dropdown route re-committing its own level after an await cannot drop a pick queued during that await.api_chat_slot_reasoning_effortinsrc/kiro_crew/dashboard/chat_handlers.pyalso bumps_effort_pick_genon its same-level fast path, which returns without writing the level: re-picking the level the dropdown already shows is still the user's choice and drops a pending one, as the model route already does for a same-model pick. The bump happens on the comparison, so a codex pin still carrying a legacy[level]suffix, which falls through to the fold, gets it too.reasoning_effort_override, the path the effort route's reset fallback uses. On a backend that spells effort into the model id (codex,gpt-6-astra[max]) a legacy suffix is folded off the pin, as the dropdown route does. A newer model pick drops only the pending model; a newer effort write drops only the pending level. On a pair-id backend the model picker is the effort control, so there a newer model pick drops the pending level too._remember_reasoning_effort_for_restore) is written at call time, off the loop, so the turn-start commit still does no file IO.session_read_messagereportsreasoning_effortandpending_reasoning_effort, andsrc/kiro_crew/docs/session-control.mdplus the module spec describe both arguments, the""refusal and the two non-goals.Backwards compatibility
Compatible: a call with
targetandmodelbehaves as before;modelchanged from required to optional, which only accepts more input.Tests
test/test_session_control_set_model_effort.py(new, 32 cases): an effort-only pick keeps the model, routing and pick generation; a combined pick commits both; an unchanged level arms no reset; unknown and non-standard levels (turbo,HIGH, padded, trailing newline,"",minimal,default) and a call with neither setting are refused before anything is stored; a marker write failure refuses witheffort_marker_unavailable; a newer dropdown level wins, including a round trip back to the original level, while a same-level rewrite does not drop a newer pick; each half yields only to its own control; the turn-start gate drops a pick whose target became channel-linked; a pair-id backend's legacy suffix is folded, and a newer pair-id model pick supersedes the pending level; busy and remote-crew targets are refused, an effort pick is refused while an effort switch holds the session lock and a model-only pick is not; the read reports current and pending levels; the route passes absent fields asNoneand refuses a non-string effort and an explicitnullfor either field; the MCP tool sends only the given fields and renders both. The existingtest/test_session_control_set_model.pypasses unchanged.test/test_chat_slot_reasoning_effort.pygainstest_re_picking_the_shown_level_still_bumps_the_effort_generationandtest_a_same_level_pick_on_a_legacy_codex_pin_bumps_the_effort_generation. The Session control row indocs/feature-map/README.mdnow describes the effort half of set-model.Manual verification
N/A. The change is gateway-side state handling behind an MCP tool with no UI; the unit tests drive the verb, the turn-start commit, the route and the tool text. The scoped backend suite passes locally (35380 passed) apart from 40
test_cloud_source.pycases that fail on this host's sandbox ('/' is owned by another account) andtest_config_validation.py::test_published_metadata_requires_config_validator, which fails the same way on origin/main.Related Issues
Fixes #15420
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement