Repository navigation
fix(kas): start sub-agent and step sessions on kiro-cli's default model - #36661
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix has a linked issue (#33744), it closes the gap the base spec named itself ("a subagent session on a shared runtime do not read their own folder's Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: KAS sub-agents and workflow sessions run on the operator's kiro-cli default model, like KAS chats already do. FIX.
[FIRST-PRINCIPLES-REVIEWED] fb57d53 Description read[DESCRIPTION-READ] c89e49ce122559cf5522aacc8d9f982991443cc42ce6b45d5a91131777f7b537 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. It is a positive KAS-only check at the two Notes
[DESIGN-REVIEWED] fb57d53 Description read[DESCRIPTION-READ] 74e0738200072fe560985cf558c7770744376dfc97f764c58c4cc1e69fe7c3f7 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: ApproveWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. Approved. On KAS, a shared sub-agent session and a workflow step session that nothing pins now start on the operator's kiro-cli chat.defaultModel. A single helper applies it as inherited, not pinned. Non-KAS runtimes and pinned agents send nothing new, and a refused model leaves KAS's default. The "is it pinned?" test gives the same answer as the chat start. A shared sub-agent can't carry its own model pin, because a pinned one runs in a dedicated process. The step session gets its model while holding its turn permit, and a cancellation gives the permit back correctly. Reused, reset and re-projected sessions all behave correctly. The new behaviour has tests and the spec is updated in the same commit. Nothing blocks. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
kiro-cli starts every unpinned session on its cli.json chat.defaultModel. KAS reads no cli.json, and only the KAS chat start applied that setting. A sub-agent sharing its parent's KAS process and a workflow run's planner, step and review sessions are created straight on a running runtime with no model step, so they ran on KAS's own default instead of the operator's choice. Add agent_sdk/kas_default_model.serve_kiro_cli_default_model and call it at both create sites. On a KAS runtime only, when Crew pins the starting agent no model (no spec model and no Crew default model, the chat start's own test), it reads the setting for the folder the session runs in off the loop and applies it as an inherited model, so the session stays unpinned; a refusal is logged and leaves KAS's default. The sub-agent site runs it after the bind (direct and late-adopted starts), the step site once the session holds its turn semaphore, so no turn runs before it. Any other runtime sends nothing. The acp-client spec paragraph that named this gap describes both sessions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e45ae20 to
fb57d53
Compare
|
Stale-PR cleanup note: rebased onto main with a one-line test-fake fix (head fb57d53); the related tests pass locally. CI on this head was cancelled by a maintainer during the repo-wide run cancellations on 2026-11-19, and we are not rerunning against that. It needs one CI rerun once runners are back to normal. |
|
Stale-PR cleanup note: we reran the cancelled CI jobs on this head at 05:20Z on 2026-11-19, and @bolichen97 cancelled them again at about 05:23Z. We will not retry. When runners are ready, a maintainer can rerun the cancelled runs on this head; no code change is pending from our side. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I reviewed head fb57d53. The latest push changes only a test fake (the step handle gains the kas_memory_mode attribute that open_task_session reads), and the fix itself is unchanged. Both new call sites act only when the runtime is positively identified as KAS and Crew pins no model for the starting agent. They apply the operator's own chat.defaultModel as an inherited, unpinned model, and no model id is hardcoded anywhere in the diff. The step path gives its turn permit back on any exception, and a refused model leaves the default in place. Both touched test files pass on this head, and the new positive tests fail with the source change reverted, so nothing blocks.
Problem / Motivation
Goal: A KAS sub-agent that shares its parent's process, and a workflow run's planner, step and review sessions, start on kiro-cli's
chat.defaultModelwhen nothing pins a model, the way a KAS chat already does.On a KAS runtime, a shared sub-agent session and a workflow run's per-step session are created with no model step, so they run on KAS's own default model even when the operator set
chat.defaultModelin kiro-cli. The same work on kiro-cli, and a KAS chat since #34155, run on that setting.Why it matters
An operator who picked a default model in kiro-cli gets a different model, with a different cost and quality, for every KAS sub-agent and workflow step than for their chats, with nothing on screen saying so.
Not a goal
model, or Kiro Crew's own default model, to a KAS shared session: such a session is left on KAS's default, as it is today.cli.jsonthemselves.What changed (motivation → approach → change)
On a KAS runtime, a shared sub-agent session and a workflow step session start on the
chat.defaultModelof the folder they run in, as an inherited model, the way the KAS chat start does.Symptom: these two sessions ran on KAS's own default model, not the operator's kiro-cli
chat.defaultModel. Cause: #34155 put the model step in the chat's cold start (providers/acp_runtime_start.py) only. These two sessions are created straight on an already-running runtime withruntime.create_session(...), and nothing after that applies a model.Change: one async helper,
serve_kiro_cli_default_model(runtime, handle, work_dir, agent_model), in a newagent_sdk/kas_default_model.py(theagent_sdkboundary, sincecheck_agent_sdk_boundary.pyrefuses a newkiro_crew.acpimport fromsession_allocation.py). It does nothing unlessruntime.acp_backend == ACP_BACKEND_KAS. Off the loop, it asks Crew's own model selection for the starting agent,KiroCrewConfig.acp_effective_model(agent, None)(the agent's spec model, else Crew's default model): a non-empty answer is a pin, so it stops there, the same test as the chat start'sconfigured_model. Otherwise it reads the setting for the session's folder (the runtime's folder when the session names none) and applies it withhandle.set_model(model, inherit=True), so the session stays unpinned. A refusal is logged and leaves KAS's default.subagent_manager/run_start.py_create_shared_session_impl_bind_shared_handlepublishes ownership, on the direct start and in_late_adopteralike, inside the sub-agent's startup clockinfo.cwd, else the pool foldersession_allocation.pyopen_task_sessioncwdThe chat start is untouched. The
acp-client.mdparagraph onchat.defaultModeldescribes both sessions; its warm-pool shortcut stays.Backwards compatibility
Compatible: a non-KAS runtime sends nothing new at either site; on KAS an unpinned session only gets the inherited model a KAS chat already gets, and a refusal leaves today's behaviour.
Removes nothing: no key, field, function or path is removed or narrowed; one helper is added and two call sites call it.
Tests
test/test_session_sharing.py::TestSharedSessionCliDefaultModel: an unpinned shared sub-agent on a KAS parent getsset_model(<setting>, inherit=True)read for its owncwd; a late-adopted one gets the same; a refusedset_modelstill returns the provider; a kiro parent, and an agent Crew pins a model for, get no call and read nothing.test/test_session_more_coverage.py::TestTaskStepCliDefaultModel: an unpinned workflow step on a KAS runtime gets the same call for its owncwd, while it holds its turn semaphore; a step with nocwdreads the runtime's folder; a kiro runtime and a Crew-pinned model get none.kiro_cli_default_modelis mocked everywhere; no test reads a real home.-n0; both files whole are green 10 of 10 at-n 4 --dist loadgroup --max-worker-restart=2(111 tests), and in one shuffled order (seed 22688, 111 passed).Proof: PROVEN test/test_session_more_coverage.py::TestTaskStepCliDefaultModel::test_an_unpinned_kas_step_inherits_the_cli_default, test/test_session_more_coverage.py::TestTaskStepCliDefaultModel::test_a_step_with_no_folder_reads_the_runtimes, test/test_session_sharing.py::TestSharedSessionCliDefaultModel::test_an_unpinned_kas_sub_agent_inherits_its_folders_cli_default, test/test_session_sharing.py::TestSharedSessionCliDefaultModel::test_a_late_adopted_kas_sub_agent_inherits_it_too, test/test_session_sharing.py::TestSharedSessionCliDefaultModel::test_a_refused_cli_default_still_starts_the_sub_agent (head bc0d6407c304)
Manual verification
Reproduced and smoke-tested on Ubuntu 24.04.5 LTS (Linux x86_64, Python 3.12.3). No real KAS engine can run there, so a real
AcpRuntimespawned the repo's fake ACP backend (kiro_crew.testing.fake_acp_backend) as a child process, once as the KAS relay and once as plain kiro-cli.HOME,KIROCREW_HOMEandKIRO_HOMEpointed into a fresh temp dir, and each folder had its own.kiro/settings/cli.json. The realSubagentManager._create_shared_sessionandSessionManager.open_task_sessionwere driven, every request the runtime sent was logged, and a first turn ran on each session.Before (base): no model frame at any site, on KAS or kiro-cli.
After:
On KAS the model goes out as
session/set_config_option(KAS has nosession/set_model). Each session read the folder it runs in, not the parent's or the run's, stayed unpinned, and its first turn replied; a Crew default model and plain kiro-cli send nothing.Related Issues
Closes #33744
Sibling sweep
Swept: git grep -n "create_session(" -- src/
Sibling: src/kiro_crew/subagent_manager/run_start.py:474 -- changed here
Sibling: src/kiro_crew/session_allocation.py:955 -- changed here
Sibling: src/kiro_crew/providers/acp_runtime_start.py:1076 -- not affected -- the KAS chat start already applies the setting (#34155)
Sibling: src/kiro_crew/acp/session_provider.py:418 -- not affected -- new_conversation re-applies the inherited model (#34155)
Sibling: src/kiro_crew/session_background.py:1086 -- not affected -- the background one-liner session (titles, tips) is internal housekeeping, not operator work the issue names
Sibling: src/kiro_crew/connections/mint_kas.py:290 -- not affected -- a connection-mint session that mounts one server and runs no model turn for the operator
Sibling: src/kiro_crew/connections/warm.py:1157 -- not affected -- a warm connection-verifier session, not an agent turn
Sibling: src/kiro_crew/apps/builtins/code_review_sage/sage_lib/review_pool.py:803 -- not affected -- a built-in app's own pool, outside core; not touched here
Sibling: src/kiro_crew/dashboard/handlers/session_control.py:510 -- not affected -- creates a dashboard chat slot, not an ACP session; its first turn takes the chat start above
Sibling: src/kiro_crew/dashboard/workflow_session_port.py:261 -- not affected -- the same dashboard slot create, so the same chat start
Pattern harvest
Not generalizable: a once-per-session start step is missing from two of the create paths. The shared helper is the fix for both; it is not a pattern a lint can match.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.