Repository navigation
fix: launch a bot's app servers from the app's current install - #39459
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The one note: the "keep the file's own fields, take the rest from the live app entry" rule now has a second hand-written copy, and the two copies already differ. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: a Bot keeps the tools from its apps' MCP servers after an upgrade removes the app's old install, with no hand edit of the Bot's file. FIX.
[FIRST-PRINCIPLES-REVIEWED] 94d3c53 Description read[DESCRIPTION-READ] 46d351eaa1a7b5c3fcb272766eb06dca0dc824f6999d3184f713e64e78b434e5 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 worker reads the app's current registered entry and keeps the Bot's own selection fields, so a stale install path is fixed at its cause and no Bot file is rewritten. Notes
[DESIGN-REVIEWED] 94d3c53 Description read[DESCRIPTION-READ] a178e670edc49d08bbf5e37353b67f99d0bdc0266c12ee0e70e54010bec653f0 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: |
7031eb1 to
07491bf
Compare
|
self-added: no
|
A Bot's file copies each MCP server's launch line when the server is added. For an app's server that line names the interpreter of the install the app ran from then, so an upgrade that removed that install left the Bot's worker unable to start the server while ordinary chats started it, and only a hand edit of the file fixed it. The worker projection now takes an enabled app's server as the gateway registers it now and keeps the file's own approvals, switch-off and per-tool limits for it. Every other server in the file keeps the launch line the file recorded, and the file is not rewritten. The decision is recorded in docs/decisions. Part of #37400
07491bf to
94d3c53
Compare
|
Rebased: main moved in docs/decisions/README.md and the Crew Mode spec since this head's CI ran (433d99b -> 286d87a). The two Windows reds on the old head were main's flaky tests, [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Checked head 94d3c53: the worker now takes the current registered launch entry only for a Bot file server keyed under an installed, enabled app's own app:server name. It keeps the file's own autoApprove, disabled and disabledTools and drops the registered entry's approvals, so no new auto-approval reaches the worker. User servers, disabled apps and aliased names keep the recorded line, and the Bot file is never rewritten. The new test fails against the base tree and passes here, and 982 tests across the worker, overlay and capability suites pass on this head. Nothing blocks.
Problem / Motivation
Goal: After an upgrade replaces an app's install, a Bot's worker still starts that app's MCP servers, with no hand edit of the Bot's file.
A Bot's file copies each server's launch line when the server is added. For an app's server that line names the interpreter of the install the app ran from at that moment. Once an upgrade deletes that install, the Bot's worker reports the server as failed to start, while ordinary chats start the same server.
Why it matters
Every Bot that was given an app's tools loses them at the next upgrade that removes the old install, and nothing but a hand edit of
~/.kiro/mates/agents/<bot>.jsonbrings them back.Not a goal
What changed (motivation → approach → change)
A Bot's worker now launches an enabled app's server the way the gateway registers it today, not the way it was registered when the server was added.
The worker base never carries app servers, so they reach a Bot's worker only through the Bot's file, whose entry was a copy of the gateway's entry at add time. That copy is now re-read when the worker is built (
resolve_worker_specinmate_worker.py): for a server the file adds under an installed, enabled app's ownapp:serverkey that the agent config lists now, the worker takes that entry, and keeps only the file's ownautoApprove,disabledanddisabledTools. The file's tool selection, approvals and exclusions apply unchanged. Every other server in the file, a disabled app's server included, keeps the launch line the file recorded, and the file is never rewritten./(mounted under an alias such asscope-pkg, which a user server can also hold)The decision is recorded in
docs/decisions/, and the Bot worker sections ofcrew-mode.mdandagent-mcp-and-skill-reach.mdsay the same.Backwards compatibility
Compatible: a Bot file is read the same way and nothing that starts today stops starting; only an enabled app's server changes its launch line, to the one ordinary chats already use.
Removes nothing: a launch line typed by hand for an enabled app's server in a Bot's file is no longer used, but every file field is still read and kept, and no file, route or key is removed.
Tests
test/test_mate_worker.py::TestMateFileForMember::test_an_enabled_apps_server_launches_as_the_gateway_registers_it_now: a Bot file naming a fixture app's server with an old interpreter path gets the registered entry's command, args and env; the registered entry'sautoApprovedoes not come along; the file'sdisabledToolsstays; a disabled app's server and a user server in the same file keep their recorded lines; a user server holding the alias an app's/-named server is keyed by (scope-pkg), and that app server underscope-pkg-2, both keep the file's line.Proof: PROVEN test/test_mate_worker.py::TestMateFileForMember::test_an_enabled_apps_server_launches_as_the_gateway_registers_it_now (head 94d3c53)
With only the
":" not in namecheck taken out ofmate_worker.py, the same test fails atassert servers["scope-pkg"] == user: the user's server takes the registereduvx otherline.Determinism: 20/20 runs at
-n0(plusPYTHONHASHSEED0, 1 and 37400), 10/10 runs oftest/test_mate_worker.pyat-n 4 --dist loadgroup, and 3 shuffled orders (seeds 37400, 1, 2) of its 46 tests, all green.Manual verification
Reproduced and smoke-tested on Ubuntu 24.04.5 LTS (x86_64) against a test-mode gateway in a fresh isolated home per tree: the built-in
auto-improvementapp enabled throughPOST /api/apps/auto-improvement/enable, a Bot created withpython3 -m kiro_crew agent create, and the Bot's file given the app's server as an add copies it, pointed at an interpreter that was then deleted, plus a user server. The Bot's worker spec was resolved the way a worker session resolves it, and each server entry was started with an MCPinitialize.FileNotFoundError: [Errno 2] No such file or directoryinitialize,serverInfo={"name": "auto-improvement", "version": "1.0.0"}All 66 profile gates,
scripts/local-gate.py(backend and frontend shards), semgrep and the flake-pattern ratchet passed on this commit; the one red,npm --prefix website run test:electron(missingelectronmodules on that host), fails identically on the base. A live hand-off to the Bot was not run (no Kiro sign-in on that host).Real-machine verification
Machine: EC2 m7i.2xlarge, Ubuntu 24.04.5 LTS x86_64, 8 vCPU / 32 GiB
Before (main 286d87a):
python3 -m pytest -n0 -q test/test_mate_worker.py::TestMateFileForMember::test_an_enabled_apps_server_launches_as_the_gateway_registers_it_now(this PR's test on the base tree) ->AssertionErroron theacme:srventry, which still has'command': '/old/slot/bin/python3'and'env': {'A': 'old'}; on the test-mode gateway above, the Bot's worker spec kept the deleted interpreter and starting the entry raisedFileNotFoundError: [Errno 2] No such file or directoryAfter (head 94d3c53): the same command ->
1 passed; the same gateway steps give a worker spec with the gateway's live interpreter, and the entry answersinitializewithserverInfo={"name": "auto-improvement", "version": "1.0.0"}Cleanup: each test-mode gateway stopped by its own pid and both worktrees removed; the instance is a disposable verification host with no inbound rules, terminated by the fleet's idle reaper
Related Issues
Part of #37400
Sibling sweep
Swept: git grep -nE "transport_for_file|_collect_app_mcp_servers|registered_app_mcp_servers" -- src/kiro_crew
Sibling: src/kiro_crew/agent_capabilities.py -- not affected -- a custom agent's owned copy already refreshes app server entries from the current install in _maintain_owned
Sibling: src/kiro_crew/mcp_gateway/mate_overlays.py -- not affected -- a dead target is never stubbed, so the worker starts the registered entry; a still-present old target is the residue the spec states
Pattern harvest
Not generalizable: the only copy of a gateway-resolved app launch line that outlived its install was the Bot file's; the custom-agent copy already re-reads it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits