Repository navigation
fix(kas): decide the engine switch from a bot's own harness pin - #31802
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each new field carries the pin from the factory to the spawn, and the pin this PR deletes had itself named #26629 as the change it was waiting for. What this change shipsInventory (7 items) — 7 justifiedIntent: a Bot that pins its own harness gets the KAS engine switch its own pin allows, not the one the installation's pick allows. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 6be76fe Description read[DESCRIPTION-READ] 64a6c91f9c388948caeee95528eb97bc3390b1ce952460d620639bbc28183cac 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. The pin comes from the same selection order the factory uses, so the override precedence holds. Pinned DM and worker sessions skip the warm pool ( Notes
[DESIGN-REVIEWED] 6be76fe Description read[DESCRIPTION-READ] 21774ba3938533b5208c81d62c9a37b2077445f753a519887acd81a35826ddb8 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 |
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: |
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: |
a49f48e to
d85c89d
Compare
|
|
Rebased: main moved in docs/system-specs/modules/acp-client.md, src/kiro_crew/acp/harness/base.py, src/kiro_crew/acp/harness/kas.py, src/kiro_crew/acp/runtime_class.py, src/kiro_crew/docs/configuration.md, src/kiro_crew/providers/acp.py since this head's CI ran (26c8238 -> a47c2d4); CI re-running. |
|
[operator: bolichen97] The fix for the review finding above changes one line of the frozen "Not a goal" section: a per-spawn |
|
d85c89d to
0ce035c
Compare
|
Rebased: main moved in docs/system-specs/modules/acp-client.md, src/kiro_crew/acp/harness/base.py, src/kiro_crew/acp/harness/kas.py, src/kiro_crew/providers/acp.py, test/conftest.py, test/test_acp_bindings.py since this head went green (a47c2d4 -> 0795ebc); CI re-running. Also in this push: the factory test now checks the pinned case next to the override case, and one import in [operator: bolichen97] |
|
[operator: bolichen97] The one red test on this head, |
The KAS route's rule 2 keeps a stored Kiro CLI pick on kiro-cli, but it read only the installation's agent.acp_backend. A Bot pinned to "kiro" under a global "kas" could be moved onto Kiro Crew's own engine, and a Bot pinned to "kas" under a global "kiro" could never switch, so it failed on a missing or signed-out kiro-cli. The provider factory now computes the pin in the selection's order: an explicit backend override outranks the Bot pin, so an overridden session carries no pin and keeps the installation's pick. The provider carries the pin into every runtime it builds, through SpawnContext, and a companion runtime takes its parent provider's. Rule 2 reads that pin when there is one and the global pick otherwise. Part of #26629
0ce035c to
6be76fe
Compare
|
Rebased: main moved in docs/system-specs/modules/acp-client.md, src/kiro_crew/acp/harness/kas.py, test/conftest.py since this head's CI ran (0795ebc -> d27a5fd); CI re-running. The one red on the old head, Also in this push: [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (19 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the KAS engine-switch rule reads the session's own Bot harness pin before the installation default; with tests. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/acp-client.md.
The KAS route's rule 2 keeps a stored Kiro CLI pick on kiro-cli, but it read only the installation's agent.acp_backend. A Bot pinned to "kiro" under a global "kas" could be moved onto Kiro Crew's own engine, and a Bot pinned to "kas" under a global "kiro" could never switch, so it failed on a missing or signed-out kiro-cli. The provider factory now computes the pin in the selection's order: an explicit backend override outranks the Bot pin, so an overridden session carries no pin and keeps the installation's pick. The provider carries the pin into every runtime it builds, through SpawnContext, and a companion runtime takes its parent provider's. Rule 2 reads that pin when there is one and the global pick otherwise. Part of #26629 Backport note: acp-client.md and test_acp_bindings.py resolved onto release's text; the AcpProvider.__init__ signature digest is recomputed for release's constructor. (cherry picked from commit 886f1d5)
Problem / Motivation
Goal: A Bot that pins its own harness gets the KAS engine switch its own pin allows: a Kiro CLI pin stays on kiro-cli, a KAS pin may move onto Kiro Crew's own engine.
When kiro-cli's relay cannot run, a KAS spawn moves onto Kiro Crew's own engine, except for a stored Kiro CLI pick, which stays on kiro-cli. That exception read only the installation's
agent.acp_backend, never the Bot's ownagents.<name>.acp_backend:kirounder a globalkascould be moved onto Kiro Crew's engine;kasunder a globalkirocould never switch, so it failed on a missing or signed-out kiro-cli.Why it matters
A Bot's harness pin exists so the Bot runs where its owner put it. Today the installation's choice overrides the pin in exactly the case where the route matters: a Kiro CLI Bot quietly runs another engine with another sign-in, and a KAS Bot on a host without a working kiro-cli cannot start at all.
Not a goal
kirocrew kas route, the setup gate and the glibc floor have to agree on that first, so the issue stays open for it.kirocrew doctor,kirocrew kas route, the install probe,/api/models?backend=) keep reading the installation's pick.agent.member_acp_backend) is still judged byagent.acp_backend. Whether a defaulted member route counts as choosing KAS is a separate call.backend=override on a pinned Bot's worker is judged by the Bot's pin, not by the override.What changed (motivation → approach → change)
A Bot pinned to a harness had its KAS route decided by the installation's harness choice instead of its own.
The route rule had no way to see the pin:
SpawnContextdid not carry it, and the KAS process is started far from where the pin is read. The pin that matters is the one the backend selection used, and an explicitbackend=override outranks the pin there. So the provider factory works out the pin in the selection's order and the provider carries it to every process it starts. A pinned Bot's DM and worker sessions skip the warm pool, and a companion runtime is keyed to one parent session, so the pin can ride on the process.acp/kas_route.pyautomatic_switch_allowed(pin): the session's pin decides when it has one, else the installation's pickcrewmate_harness.py,config/loader_config.pyroute_pin: the stored Bot pin, or none when an explicit override chose the harness; passed to the provideragent_sdk/drivers/acp.py,providers/acp.py,providers/base.pyharness_pin, declared onLLMProviderwith an empty defaultacp/harness/base.py,acp/runtime_class.py,acp/runtime_spawn_launch.py,providers/acp_runtime_start.pySpawnContext.harness_pin, fromAcpRuntime(harness_pin=)on the first spawn and the resume respawn; the KAS harness passes it to the rulesession_allocation_parts/companions.pyacp-clientspec states the per-pin rule and why a per-process pin is sound; the shippedconfiguration.mdsays which pick a session is judged byAn explicit
backend=override on a pinned Bot's worker now carries no pin, so that worker keeps the installation's pick, as on main (review finding on the first head).Backwards compatibility
Compatible: a session with no Bot pin, or one started with an explicit
backend=override, reads the installation's pick exactly as before;automatic_switch_allowed()with no argument is unchanged; the newSpawnContext,AcpRuntime,AcpProviderandbuild_acp_providerarguments and theLLMProvider.harness_pinproperty default to"".Removes nothing: no key, record, path or function is removed; the only behaviour that changes is which stored pick the route rule reads for a session its Bot pin started.
Tests
test_kas_route.py::TestRuleTwoReadsTheSessionsPinreplacesTestRuleTwoIsGlobalOnly, which pinned the old global-only rule for this issue: with no pin the installation's pick decides; with no kiro-cli, akiropin under a globalkasgets kiro-cli's own missing error and never touches the bundle, and akaspin under a globalkirospawns Kiro Crew's engine.test_kas_route.py::TestThePinReachesTheSpawn: the factory hands a pinned Bot's pin to the provider, and no pin when the Bot is started withbackend_override="kas"; the provider builds its runtime with its pin; the runtime hands the pin to the harness; a companion runtime takes its parent provider's.test_runtime_bindings.pyandtest_acp_bindings.pypin the new constructor arguments and property; thetest_session_coverage.pyprovider double declares the new capability.Proof: PROVEN test/test_acp_bindings.py::test_the_member_set_is_the_frozen_inventory, test/test_acp_bindings.py::test_each_member_keeps_its_kind_shape_and_owner[init], test/test_runtime_bindings.py::test_each_member_keeps_its_kind_shape_and_owner[init], test/test_runtime_bindings.py::test_the_constructor_keeps_its_type_hints (head 0ce035c)
The factory test fails with either half of the fix removed (
assert 'kiro' == ''without the override check,assert '' == 'kiro'when the factory or the driver passes no pin) and passes with it.Determinism:
TestThePinReachesTheSpawnpassed 20 runs at-n0; all 731 tests of the four changed test files passed in a shuffled order (seed 26629).Manual verification
N/A — unit coverage sufficient: the change is one config read and a value passed through the provider into the spawn, each hop tested; a live repro needs a host where kiro-cli's relay cannot run, which the harness tests stand in for.
Screenshots / video
N/A — no frontend change.
Related Issues
Part of #26629
Follow-up from #26393.
Sibling sweep
Swept:
git grep -nE "automatic_switch_allowed|acp_backend_stored_as_kiro|kas_spawn_takes_bundle|crewmate_stored_pin\(" -- src/Sibling: src/kiro_crew/acp/kas_route.py:233 -- not affected -- describes the installation for doctor and kas route, which have no session and so no pin
Sibling: src/kiro_crew/crewmate_harness.py:451 -- not affected -- a ?backend= query names a harness, not a session, so it cannot tell a Kiro CLI pick running on KAS from a KAS pin
Sibling: src/kiro_crew/agent_sdk/backend_install.py:218 -- not affected -- the install probe describes KAS for the installation
Sibling: src/kiro_crew/auth/whoami.py:90 -- not affected -- the sign-in owner answers for the installation's harness
Sibling: src/kiro_crew/kiro_on_kas_notice.py:52 -- not affected -- the once-only notice is about the installation's own Kiro CLI pick
Sibling: src/kiro_crew/agent_sdk/backends.py:903 -- not affected -- the v3 probe decides how the installation's stored pick loads, before any session
Sibling: src/kiro_crew/cli_doctor_parts/kas_relay.py:87 -- not affected -- doctor's engine row describes the installation
Sibling: src/kiro_crew/slack/gateway_runtime/process_entry.py:294 -- not affected -- the boot floor wait is for the installation's pick
Sibling: src/kiro_crew/dashboard/handlers/agent_catalog.py:294 -- not affected -- a display read of the pin, never a route input
Pattern harvest
Not generalizable: one rule shipped scoped to the installation's choice with the per-Bot case deferred to this issue; there is no shared code shape a lint could catch.
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; see the Licensing section of CONTRIBUTING.md.