Skip to content

feat(session-control): session_set_model takes an optional reasoning_effort - #15422

Merged
buluoray merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/mcp-session-configure
Oct 8, 2026
Merged

buluoray merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/mcp-session-configure

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

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). No kirocrew-dashboard MCP tool calls it, so a conductor that wants a low worker for a bulk sweep and a high worker 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

  • A mode argument. 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.
  • An agent argument. Changing the agent changes the memory store a session reads.
  • Renaming the tool.

What changed (motivation → approach → change)

Effort rides the pending pick session_set_model already 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_model takes an optional reasoning_effort, and model becomes optional; a call must name at least one (tool schema in src/kiro_crew/mcp_dashboard.py, argument check in src/kiro_crew/validation.py, body parsing in src/kiro_crew/dashboard/handlers/session_control.py).
  • set_model_target in src/kiro_crew/dashboard/session_control.py accepts only the five standard levels (low to max) and stores the level on PendingModelPick with 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's minimal, Claude's default) and "" stay dropdown-only and are refused with effort_rejected; on kiro-cli the default only takes once the workspace effort overlay is cleared, which the dropdown route's live clear_effort does and a cold start does not. An effort pick is refused with target_busy while 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_effort in src/kiro_crew/dashboard/state.py becomes a property whose setter bumps _effort_pick_gen whenever 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_effort in src/kiro_crew/dashboard/chat_handlers.py also bumps _effort_pick_gen on 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.
  • At turn start the effort is committed with the same gate as the model, and a changed level resets the session so the cold start applies it through 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.
  • The restore-allowlist marker the effort route writes (_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_message reports reasoning_effort and pending_reasoning_effort, and src/kiro_crew/docs/session-control.md plus the module spec describe both arguments, the "" refusal and the two non-goals.

Backwards compatibility

Compatible: a call with target and model behaves as before; model changed 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 with effort_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 as None and refuses a non-string effort and an explicit null for either field; the MCP tool sends only the given fields and renders both. The existing test/test_session_control_set_model.py passes unchanged. test/test_chat_slot_reasoning_effort.py gains test_re_picking_the_shown_level_still_bumps_the_effort_generation and test_a_same_level_pick_on_a_legacy_codex_pin_bumps_the_effort_generation. The Session control row in docs/feature-map/README.md now 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.py cases that fail on this host's sandbox ('/' is owned by another account) and test_config_validation.py::test_published_metadata_requires_config_validator, which fails the same way on origin/main.

Related Issues

Fixes #15420

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

Contribution License Agreement

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

dwu96 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

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

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

@Pearcekieser
Pearcekieser force-pushed the feat/mcp-session-configure branch from b4b4792 to 90ef615 Compare September 30, 2026 14:57
@Pearcekieser
Pearcekieser marked this pull request as ready for review September 30, 2026 14:57
@Pearcekieser
Pearcekieser requested a review from a team as a code owner September 30, 2026 14:57
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: Let an agent set another session's reasoning effort through session_set_model, with the same scope, idle gate and turn-start re-check the model argument already has.
Not a goal: A mode or agent argument, a live effort push from the tool call, clearing a session back to its model's default level (the dropdown does that), or renaming the tool.

@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 labels Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 0e0e066445f424903a6d45882f794b1bd7a0014d via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .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 30, 2026 •

Copy link
Copy Markdown
Contributor

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

Premise-level review of 0e0e066445f424903a6d45882f794b1bd7a0014d via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check before merge: on kiro-cli, does a turn-start reset alone apply the new level through reasoning_effort_override at cold start, without the dropdown's live push?

What this change ships

Inventory (8 items) — 8 justified

Intent: let a conductor set a worker session's reasoning effort the way it already sets the worker's model (#15420). This is an ADDITION.

  1. session_set_model accepts an optional reasoning_effort limited to the five standard levels, applied at the target's next turn start — justified
  2. model is now optional, so a call can change effort only; a call naming neither is refused — justified
  3. session_read_message shows the target's current effort and any pending effort — justified
  4. Re-picking the level the dropdown already shows now cancels a pending agent effort pick — justified
  5. Any later effort write (dropdown, fork or rollback) drops a pending agent effort pick, even if it returns to the level the agent saw — justified
  6. An effort pick is refused with target_busy while that session's effort switch is in flight — justified
  7. On codex-style backends where the effort is part of the model id, a newer model pick drops the pending effort, and an old [level] suffix is removed from the pinned model — justified
  8. New refusal codes effort_rejected and effort_marker_unavailable; "" and backend-only levels stay dropdown-only — justified

[FIRST-PRINCIPLES-REVIEWED] 0e0e066

Description read

[DESCRIPTION-READ] 90b5f88c1ffd146ef8bed69bab64df77ed5fdddf785d986350cd0c6487dc61dc

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 0e0e066

@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 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 0e0e066

@Pearcekieser
Pearcekieser force-pushed the feat/mcp-session-configure branch 2 times, most recently from 90ef615 to 2cb7103 Compare September 30, 2026 16:00
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=29914e6a98b5 issue (non-blocking): the turn-start effort commit skipped two compensations the dropdown route makes. Both fixed in 2cb7103a38.

Both findings were correct. On a model that takes no effort level, apply_pending_model_pick now persists the level (slot._dirty = True) without counting it as a change, so no warm session is reset. The check reads the live provider's supports_effort(), the same answer the dropdown route uses.
On a backend in ACP_BACKENDS_MODEL_EFFORT_PAIR_IDS, set_model_target records that on the pick, and the commit folds a legacy <model>[<level>] suffix off the pin with model_registry.split_effort_suffix, as normalize_legacy_model does. The backend is resolved at call time because the turn-start commit cannot await.
Two new tests cover them: test_a_model_that_takes_no_effort_is_not_reset and test_a_pair_id_backend_folds_the_legacy_suffix_off_the_pin.

Backend Tests (3.12, 3) and (Windows, 4) on 90ef6156b9 failed in test_decisions_model_route_apply.py (KeyError model_chosen) and test_session_export.py. Neither module is touched by this PR, and both pass 3/3 locally. Coverage Gate failed only because those shards did. This head is also re-synced onto current main.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 30, 2026
@Pearcekieser
Pearcekieser force-pushed the feat/mcp-session-configure branch from 2cb7103 to e7dfba3 Compare September 30, 2026 17:07
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=36bec42fc986 issue (blocking): an effort-only pick during a no-effort fallback skipped the reset. Fixed in e7dfba36e6.

Correct. supports_effort() answers for the wire model, which a fallback has moved off the pin, and the primary's restore re-applies effort only from _effort_per_model, which this path never writes. So the level was reported and persisted but never reached the primary.
The no-reset branch now applies only when neither _active_fallback_model nor _refusal_fallback_primary is set, the same two markers the model half already treats as needing a reset. With a fallback serving, the effort commit returns changed and the cold start applies the level through reasoning_effort_override.
A new parametrized test, test_a_fallback_without_effort_still_resets, covers both markers and fails on the previous head.
self-added: yes
mechanism: no-reset branch for effort-incapable models (added for Opus 29914e6a98b5), now fenced off during a fallback

Windows shard 4 on 2cb7103a38 failed in test_crew_log_emit.py::test_the_previous_edge_survives_a_retry_that_finds_the_header_already_written, a module this PR does not touch; it passes locally. This head is also re-synced onto current main.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Sep 30, 2026
@Pearcekieser
Pearcekieser force-pushed the feat/mcp-session-configure branch from e7dfba3 to 3e5e423 Compare September 30, 2026 17:50
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main at 2d4278a18d to clear a conflict with session_end_wait (#15166). Both sides kept in validation.py and the module spec's tool table, with no behaviour change. 1,349 related tests pass locally, including the session_end_wait and revive tests. New head 3e5e423cff.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 2, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased the same commit onto current main (c9f6803), no code change, to rerun Backend Tests (3.12, 3). Its only failure was test_session_export.py::test_a_sent_export_streams_its_staged_file_and_removes_it, a recurring intermittent failure in a module this PR does not touch; it passes locally. Coverage Gate and PR Readiness failed only because of that shard. All AI reviews on e19355b passed with no findings.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=36bec42fc986 issue (blocking): a stale backend suppresses the required effort reset. Fixed in 6e9d870.

Upheld. The no-reset shortcut in apply_pending_model_pick trusted the live provider's supports_effort() without checking which backend that provider is on. After a live agent.acp_backend switch, the old harness's "no effort" answer skipped the reset, so the next turn stayed on the old backend while the slot reported the new level. The shortcut now also requires the live provider's capabilities.backend to equal pick.backend, the same comparison _effort_fits_target makes; otherwise the pick arms the reset. New test test_a_live_session_on_another_backend_still_resets fails on c9f6803 and passes here.

The same push rebases onto main 5a70ce7. test_context_composition_contract.py::test_builder_members_keep_their_kind_and_signature, red on Linux and Windows shard 5, failed at the previous base 1ee3fc2 and was fixed on main by #16083. The Linux shard 4 failure (test_crew_log_emit.py, OSError: Directory not empty in a pytest tmp dir) is in a module this PR does not touch and passes locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

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 (test_native_skill_projection.py, passes locally), Windows shard 3 (test_discord.py file-lock timeout) and the Windows installer build.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Item 4, subtraction: shrink _effort_fits_target to the five standard levels. Fixed in 34de49c.

Agreed. Nobody has asked for a conductor to set a Pi-only level, and the per-target vocabulary machinery was where every stale-pick finding on this PR came from: eight rounds under GPT span 36bec42fc986 / its predecessors, each a different way the target's accepted levels could change between the call and the next turn. With only low, medium, high, xhigh and max accepted, a level checked at call time fits every backend's cold start, so there is nothing left to re-judge.

Deleted: _effort_fits_target, _current_target_backend, PendingModelPick.backend, the backend_changed drop (so a model-only pick behaves as on base after a backend change), the turn-start vocabulary re-check, and the persist-without-reset shortcut for models with no effort level, along with its chat_runner.py save path and the stale-backend guard added in the previous head. A changed level now always resets the session, as the dropdown route's reset fallback does. Pi's minimal, Claude's default and "" are refused with effort_rejected and stay dropdown-only. session_control.py went from +418 to +218 lines and the PR from +1189 to +800; chat_runner.py and test_session_control_set_model.py are back to main.

Tests: the refusal case now includes minimal and default; the 16 cases for the deleted branches are removed. 1,748 related tests and the quick gates pass. The agent doc, tool description, feature map and PR description describe the standard-five rule.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): stale docstring in set_model_target. Accepted and deferred.

Correct: the sentence about Pi taking a level outside the canonical five survived the shrink in 34de49c and now contradicts is_valid_effort(), which refuses every non-standard level. Behaviour, the tool description, the agent doc and the feature map all say backend-only levels stay dropdown-only; only this docstring is stale.

This head has readiness passed, and a docstring-only push would rerun the full CI round and need another fork approval. The fix goes in the follow-up refactor already recorded on #15420 (due 2026-10-08), which touches the same function.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • suggestion (non-blocking): three points on session_control.py. Accepted and deferred.

Line 5065, restart on a model with no effort level: agreed this costs one session reset where the dropdown would only save the level. It is not a correctness bug: the level is stored, the cold start ignores it on that model, and the reset is the same fallback the dropdown route takes when it cannot push live. The persist-without-reset shortcut was removed deliberately in 34de49c because its guards (fallback markers, live backend match) produced four of the stale-pick findings. If it comes back it should come back as the shared helper with the dropdown route, not a second copy.

Line 4608, docstring: same stale sentence GPT raised (span 603a4f56682a); fixed in the follow-up.

Line 4749, unreachable effort_marker_unavailable: agreed, _remember_reasoning_effort_for_restore returns before file IO for every level this verb now admits, so the thread hop and the 503 are dead. Removing them is a subtraction for the follow-up.

All three go into the follow-up refactor recorded on #15420 (due 2026-10-08) rather than a new push on this readiness-passed head.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • thought (non-blocking): _effort_pick_gen bump survives a refused dropdown request. Rebutted.

On a codex pin with a [level] suffix the dropdown route counts the pick before it attempts the switch, so a refusal such as effort_overlay_busy or session_rebound still cancels a queued agent effort pick. That outcome errs toward the user: they acted in the tab after the agent queued its level, and the effort-pick rule on this PR is that the user's newer action wins. The cost is that the agent's level is not applied and session_read_message shows no pending effort, so the agent can see it and retry. Restoring the counter on each refusal path would add a rollback branch per path for a case where dropping the pick is the safer result.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

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.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=36bec42fc986 question (blocking, needs-a-decision): pair-ID flag frozen at call time. Parked for a maintainer.

Real, and narrow. PendingModelPick.pair_id_backend is set from the config backend at call time (session_control.py:4817); the commit at :5057 folds a legacy <model>[<level>] pin only when that flag is set. Reaching the mismatch needs a codex pin that still carries a legacy suffix, a live agent.acp_backend flip away from codex before the call and back before the target's next turn, and no restart or newer pick in between.
The outcome is a pin/level mismatch on one session, not loss or corruption, and one effort-dropdown pick at any level clears it through the live-backend fold (chat_handlers.py:11068-11080). The adjudicator rated it MEDIUM and machine-flagged it as an edge case; it stays blocking only because the fence holds it.
This is the ninth report under this span. Every earlier one was a different way the target could change between the call and the next turn, and round 9 already removed the per-backend machinery that produced them. The fix the reviewer asks for needs either a config read inside the synchronous turn-start commit, whose synchronousness keeps the gate and the writes unsplittable, or a new live-backend handle on the slot for this one path.
Suggested override reason: "Edge case: needs a legacy codex [level] pin plus a hot acp_backend flip and flip-back inside the pending window; outcome is a visible pin/level mismatch that any effort-dropdown pick self-corrects; no loss or corruption."

@iamwhatever @bolichen97, this needs one of you to decide, since the fence only clears with a human override. Either:

  1. Record /ai-review override gpt 3bdaec724427e13e10ed2bc30af1c571b9f6cf4c: with the reason above, after checking it against session_control.py:4817 and :5057-5063. Everything else on this head is green except a Backend Lint job that hit the 25-minute runner limit, which needs a rerun.
  2. Or tell me you'd rather close the gap in code. The smallest version I see is to drop pair_id_backend and fold any legacy [level] suffix off the pin whenever an effort pick commits, whatever the backend. Only codex ever writes that suffix, so on other backends it can only be a leftover. That differs from the dropdown, which folds only when the live provider is codex, so I'd rather not do it without your say.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=3824b5caa77c suggestion (non-blocking): the call-time restore-marker write is unreachable. Accepted and deferred.

Agreed. Since round 9 the verb accepts only the five standard levels, and _remember_reasoning_effort_for_restore returns early for all of them (chat_persistence.py:751, the _REASONING_EFFORT_FALLBACK check), so the marker write, the effort_marker_unavailable 503, its doc text and test_a_marker_failure_refuses_and_stores_nothing guard a path no accepted input reaches. Opus raised the same point on 34de49c.
Deferred to the follow-up refactor recorded on #15420 (due 2026-10-08), which drops the block, the doc text and the test together, so this PR doesn't take another CI round for dead code.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main 126d18a to clear a conflict in src/kiro_crew/dashboard/state.py __slots__: kept main's _crew_log_pending_channel alongside this PR's _reasoning_effort / _effort_pick_gen. No behaviour change. Set-model tests (82) and 1,329 related tests pass. The GPT override question in my earlier comment still stands.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=603a4f56682a nitpick (non-blocking): stale Pi sentence in the set_model_target docstring. Accepted and deferred.

Correct. Since the PR was shrunk to the five standard levels, is_valid_effort refuses minimal on every backend before any backend lookup, so the docstring line about Pi taking a level outside the five is stale. The code, the tool description and the agent doc already say five levels only. Fixing it here would restart the whole CI round for a comment change, so it goes into the follow-up refactor tracked on #15420 (due 2026-10-08), with the dead effort_marker_unavailable path from the Design note.

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.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased on main, no behaviour change. New head ad254d9.

The conflict was in src/kiro_crew/mcp_dashboard.py after #17098 moved the dashboard tools to Tool(...) rows with _run_* bodies. I kept that structure and carried this PR's session_set_model description, the payload that sends only the given fields, and the effort lines in session_read_message. The effort test file now calls the tools through TABLE.call like its siblings, since _call_tool_inner is gone. 130 targeted tests and 1,228 mcp_dashboard and session_control tests pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=561627a72976 issue (blocking): autouse fixtures used the shared monkeypatch. Fixed.

Upheld. _enabled and markers in test/test_session_control_set_model_effort.py now take _floor_monkeypatch and patch through it, like the conftest's own autouse fixtures (_fresh_update_ownership, _inline_taskq_pump), so their pins no longer share the test's undo stack. The 30 effort tests, the set_model tests and test_host_isolation_floor.py pass (209 total). No repo scan enforces this rule, so no new test fails without the change; the fixture signatures are the fix.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=603a4f56682a nitpick (non-blocking): stale Pi sentence in the set_model_target docstring. Fixed.

Correct, and fixed in this head since a push was needed anyway. The docstring now says a reasoning effort must be one of the five canonical levels, which every backend accepts, and that any other level, including "", is refused and set from the dropdown. It no longer claims a Pi exception, matching is_valid_effort. That item comes off the follow-up refactor list on #15420.

@iamwhatever

Copy link
Copy Markdown
Contributor

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
bolichen97 previously approved these changes Oct 7, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

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:

  • src/kiro_crew/dashboard/session_control.py, set_model: feat(remote-crew): delete the turn relay; old relay chats are read-only #17662 replaced the remote-target refusal with the is_relay_archive check (relay_archive_read_only). Main's check stays, with this PR's effort block below it. test_a_remote_crew_target_is_refused in the effort test file now expects relay_archive_read_only, matching main's sibling test.
  • docs/feature-map/README.md, Session control row: main added .../close and the chat_tag_column_* tool endpoints. Both are kept alongside this PR's set-model wording.

The 82 set_model tests pass, along with docs_lint.py and check_feature_map.py against origin/main. @bolichen97, your approval on 1e1cedf was dismissed by the push; the diff is unchanged apart from the two resolutions above.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision 0e0e066445f424903a6d45882f794b1bd7a0014d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

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.

@iamwhatever

Copy link
Copy Markdown
Contributor

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

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased on main, no behaviour change. New head d8f5655.

The only conflict was the table in docs/feature-map/README.md, where two neighbouring rows collided. Main rewrote the Work ledger row and this PR rewrote the Session control row, so the resolution keeps main's Work ledger row and this PR's Session control row. The diff is the same size as before, 11 files with +800/-92. The 97 set_model tests pass, along with docs_lint.py and check_feature_map.py against origin/main.

@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
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased on main again, no code change. New head 0e0e066.

SAST (Semgrep) failed on d8f5655 with one test-sleep-as-barrier finding in test/test_favorite_projects.py:121, a file this PR doesn't touch. The scan is diff-only against the PR's base commit, so it counted main's #16611, which merged after that base, as part of this PR. On the new base #16611 is behind the baseline, so the scan no longer counts it. The resolution is unchanged and the diff is the same 11 files with +800/-92. The 97 set_model tests and check_feature_map.py pass.

GPT, Design and First Principles had already passed on d8f5655. @iamwhatever, the conflict is cleared on this head too.

@iamwhatever

Copy link
Copy Markdown
Contributor

This lets an agent set another session's reasoning effort through session_set_model, riding the existing pending pick that is committed at the target's next turn start in the same synchronous step as the permission re-check. Explicitly declining a mode or agent argument (both would widen autonomy) is the right scope. I read the production diff in dashboard/session_control.py, handlers/session_control.py, mcp_dashboard.py, validation.py and state.py. Effort is validated against the five canonical levels. The restore marker is written before the re-check, so the commit does no I/O. An effort generation counter makes a dropdown pick win over a stale pending one. I found no bypass of the commit-time authorization. I am holding it because it is a new cross-session control capability on the session-control permission surface (one agent changing another session's cost and quality setting), with ~300 production lines in that path. That needs a maintainer's product and permission sign-off rather than an automated approval. Checks are green, both lanes PASS, and bolichen97's earlier review is dismissed. — crew-pr-reviewer

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

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 ...").

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

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session_set_model: take an optional reasoning_effort

5 participants