Repository navigation
fix(apps): app grants find store servers, enable reaches open chats - #35590
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: grants now read the spec the default agent mounts, and that copy is limited to built-in apps. Enable and registry re-install use the existing Notes
[DESIGN-REVIEWED] 4607da1 Description read[DESCRIPTION-READ] 910deb542f4cd46f33c9ad4518b1d84fa11d0743e4f1e94c3cfcaa57de8341a0 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item traces to #33020, and a test this PR adds pins it. One note: the PR adds a new helper and, in the same diff, a new inline copy of the code that helper replaces. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: a built-in app's granted MCP server works like the default agent's copy, and enabling an app updates chats that are already open. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 4607da1 Description read[DESCRIPTION-READ] 9ab23dd00e9e99441cb4d723686c66eebdf0bb1fbda896c2ab406d6b42b441e5 That sha256 names the PR description this verdict read. 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: |
buluoray
left a comment
There was a problem hiding this comment.
Request changes on 240c3ef. This PR fixes two real problems. First, an app agent that the user granted a server from MCP Management now gets a working launch spec instead of an empty entry that never starts. Second, enabling an app, or updating it through a registry install, now refreshes chats that are already open. The grant fix is tested, and restoring the old lookup turns the new test red. Two things block the merge. First, the registry install stream now reads mcp_servers from the registration result (routes_registry.py:469), but the stub results in test_gateway_appkit_endpoints_install.py:346 and :561 do not have that field. Two tests in that file fail, locally and on CI shard 3.12/8. The fix is to add an empty mcp_servers list to those stubs. Second, I agree with the upheld GPT finding. The enable route reads the manifest before it takes the app's lifecycle lock (routes_enable.py:297) and uses that copy after the lock to decide whether to refresh open chats (routes_enable.py:486). If an update that adds servers to a disabled app races the enable, open chats keep their old tools. Re-reading the app record inside the lock fixes this. Separately, the owner should confirm one design point. A grant comes from the app's own policy file in its data directory, which the app's backend writes. With this change, that grant can copy any server from the default agent's spec (the MCP Management store, registry installs and edition servers) into the app's agent, and it gets auto-approval unless the governance ceiling denies it (bridges_agents.py:291-321, :366). Other apps' servers and servers that are turned off or withheld stay out. Before this change, such a grant could only reach the global mcp.json, which every agent loads anyway, plus the host-managed servers. For Mochi the list is what the user picked in Settings. For other apps, no owner consent record covers it. The owner should either accept that this widens what an app's own grant can reach, or limit the new source to grants that the owner approved. Decisive lines: src/kiro_crew/apps/routes_registry.py:469, test/test_gateway_appkit_endpoints_install.py:346, test/test_gateway_appkit_endpoints_install.py:561, src/kiro_crew/apps/routes_enable.py:297, src/kiro_crew/apps/routes_enable.py:486, src/kiro_crew/apps/bridges_agents.py:291-321
240c3ef to
1fa0887
Compare
|
|
[operator: bolichen97] fixed in 1fa0887, on the change request for 240c3ef, first point. The three install-stream registration stubs in |
|
[operator: bolichen97] fixed in 1fa0887, on the change request for 240c3ef, second point. The enable now reads the app record again inside the lifecycle lock, after the enable, and decides the open-chat step from that copy ( |
|
[operator: bolichen97] needs-a-decision, on the change request for 240c3ef, third point: confirmed. A grant comes from #33020's expected result is the first option below, but the issue did not consider a user-installed app writing its own grant. This needs a maintainer ruling:
I would take the second. The other two points are fixed in the comments above. |
buluoray
left a comment
There was a problem hiding this comment.
Request changes on 1fa0887. Two of the three points from our last review are fixed, and one is still open. Fixed: the install-stream test stubs now carry the mcp_servers field (test/test_gateway_appkit_endpoints_install.py:346, :561, :606); the two tests that failed pass again, and they fail when the field is removed. Fixed: the enable route now reads the app record again inside the lifecycle lock and decides the chat refresh on that copy (src/kiro_crew/apps/routes_enable.py:481-484); the new race test fails when the re-read is removed. Still open: the code at src/kiro_crew/apps/bridges_agents.py:291-321 and :366 is unchanged. An app's backend writes its own grant file. With this change that file can bring any server the default agent mounts into the app's agent, auto-approved unless the governance ceiling denies it. On main the same grant reaches only the global mcp.json and the managed servers. For a built-in app the list is what the user picked in that app's settings. For a user-installed app nothing records that the owner agreed, so the app widens its own access. Our answer to your question in comment 6823786363: the second option clears this change request. Read the default agent's servers only for a built-in app's grant. A user-installed app's grant must keep exactly the sources it has on main, until an owner-consent step exists; that step can be its own design. Please add a test that fails if a user-installed app's grant file pulls in a server that only the default agent mounts. Decisive lines: src/kiro_crew/apps/bridges_agents.py:291-321, src/kiro_crew/apps/bridges_agents.py:366, src/kiro_crew/apps/routes_enable.py:481-484, test/test_gateway_appkit_endpoints_install.py:346
1fa0887 to
e4afd50
Compare
|
Rebased: main moved in docs/system-specs/modules/app-kit-platform.md, src/kiro_crew/apps/bridges.py, src/kiro_crew/apps/bridges_agents.py, src/kiro_crew/apps/routes.py, src/kiro_crew/apps/routes_registry.py and test/test_app_bridges_agent_configs.py since this head went green (ee7a026 -> b563192); CI re-running. |
|
[operator: bolichen97] fixed in e4afd50, on the change request for 1fa0887, the open point (what a user-installed app's grant may reach). Thanks for the ruling; this takes the second option.
The branch is also rebased onto main for a conflict in the import block of |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 14% chance that this change introduces a defect, above the 12% limit for approving on its own. The grant now resolves sources in this order: the agent's own file, managed servers, then (built-in apps only) the default agent's spec minus other apps' servers, then the global mcp.json. Copied entries that are turned off or withheld are skipped, and the provenance record is stripped. The built-in gate (builtin_app_names) fails closed, so user-installed apps can't reach the default agent's spec. The enable route and both registry install routes now take the existing _reach_sessions step after the lifecycle lock, on conditions that match handle_update_app. reach_chats and reg are set on every path that reads them, and get_app always returns a manifest dict. Existing callers and tests of _apply_agent_mcp_policy are unaffected, and the new tests cover the grant sources, the user-installed gate, enable, the registry re-install and the race. The Wheel and Desktop build failures look unrelated but were not confirmed, and backend tests were still pending. No blocking defects found. 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 |
An app agent such as Mochi took a granted server's launch spec only from its template, the Kiro global mcp.json and the managed servers, so a server added on the MCP Management page, installed from a registry or contributed by the edition was skipped with "no launch spec found" while the app reported the policy applied. A built-in app's grant now reads the default agent's own spec ahead of the global file, the rebuild's merge of those sources with the store winning a tie, and leaves out other apps' own servers. A user-installed app writes its own grant file and no owner consent covers what it names, so its grant keeps main's sources. A copied entry that is muted is withheld: turned off, not yet consented, or a secret:// reference the rebuild withholds. Enabling an app, or re-installing an installed one from the registry (how a registry-sourced app updates), wrote its <app>:<server> entries into the agent spec and stopped, so on a harness that does not watch the spec file a chat already open never got the change. These routes now end with the step an MCP page write ends with, as update, disable and uninstall already do; the enable decides it from the app's record as it stands inside the lifecycle lock. A fresh install registers nothing for the disabled record it writes, so it needs no step. Closes #33020
e4afd50 to
4607da1
Compare
|
Rebased: main moved in website/src/pages/chat/AssistantMessage.tsx, src/kiro_crew/apps/backend.py and src/kiro_crew/apps/dev_mode.py since this head's CI ran (b563192 -> b2aac45); CI re-running. The four red checks on e4afd50 (Build Wheel, both Build Desktop jobs, E2E stub ACP backend) were main's [operator: bolichen97] |
buluoray
left a comment
There was a problem hiding this comment.
Approve on 4607da1. The open point from our last review is fixed. A grant now reads the servers that the default agent mounts only when the app is first party. The one place that materializes app agents works this out from the shipped built-in list, which needs both a shipped manifest that names the app and an install record that the built-in registration wrote. Every other caller keeps the default of false. A user-installed app's grant keeps the sources it has on main. The changed order (managed servers first) and the new rule that skips a server that is turned off only narrow what such a grant gets. The new test registers a user-installed app under a shipped built-in's name and checks that its agent does not get a server that only the default agent mounts. It then changes the record to the built-in's and checks that the same grant does copy the server, so the test cannot pass because the grant was never read. Removing the new check, or passing true for every app, turns the first half red. Mochi, the built-in that writes grants, still gets the server it was granted, as on the previous head. This head is a rebase of e4afd50 with the same diff, and every check on it has passed. Decisive lines: src/kiro_crew/apps/bridges_agents.py:300, src/kiro_crew/apps/bridges_agents.py:314-316, src/kiro_crew/apps/bridges_agents.py:1058-1060, src/kiro_crew/apps/bridges_agents.py:1170, src/kiro_crew/apps/execution.py:142-197, test/test_app_bridges_agent_configs.py:455-488
…35590) An app agent such as Mochi took a granted server's launch spec only from its template, the Kiro global mcp.json and the managed servers, so a server added on the MCP Management page, installed from a registry or contributed by the edition was skipped with "no launch spec found" while the app reported the policy applied. A built-in app's grant now reads the default agent's own spec ahead of the global file, the rebuild's merge of those sources with the store winning a tie, and leaves out other apps' own servers. A user-installed app writes its own grant file and no owner consent covers what it names, so its grant keeps main's sources. A copied entry that is muted is withheld: turned off, not yet consented, or a secret:// reference the rebuild withholds. Enabling an app, or re-installing an installed one from the registry (how a registry-sourced app updates), wrote its <app>:<server> entries into the agent spec and stopped, so on a harness that does not watch the spec file a chat already open never got the change. These routes now end with the step an MCP page write ends with, as update, disable and uninstall already do; the enable decides it from the app's record as it stands inside the lifecycle lock. A fresh install registers nothing for the disabled record it writes, so it needs no step. Closes #33020 (cherry picked from commit 712d24f)
Problem / Motivation
Goal: An app agent granted an MCP server gets the same server the default agent runs, and enabling an app brings its MCP tools to chats that are already open.
Two of the four gaps in #33020 are still on main (#33051 and #33194 closed the other two):
policyApplied: true, but the agent's file has no entry for the server, the gateway log saysSkipping MCP grant ... no launch spec found, and the app says the tool is unavailable.Why it matters
The MCP Management page is where users add servers, so a grant that only ever finds servers from the Kiro global
mcp.jsonfails for most of them, silently. Enabling an app is the step the detail page asks the user to take after an install, and re-installing from the registry is how a registry app updates, while update, disable and uninstall through their own routes already reach open chats.Not a goal
url) server: a grant still needs acommand, as it does on main.mcp.jsonat mount time.What changed (motivation → approach → change)
no launch spec foundsecret://reference the rebuild withholds)The grant looked for a server's launch spec in three places only: the agent's own file, the Kiro global
mcp.jsonand the managed servers. The default agent's spec,kirocrew.json, is where the rebuild merges every source, with the store winning a tie. A grant now reads, in order: the agent's own file, the managed servers, the default agent's spec without other apps' own servers, then the global file for a server that spec does not hold yet. Only a first-party app (builtin_app_names: shipped, and the built-in holds its install) reads the default agent's spec; a user-installed app's grant keeps the other three sources until an owner-consent step exists. A copied entry that is muted is withheld, and the rebuild's provenance record is not copied._own_mcp_serversreads that spec through the same new reader.The enable route and both registry install routes wrote the app's
<app>:<server>entries into the agent spec and returned. They now end with the step an MCP page write ends with (_reach_sessions), after the lifecycle lock, logging a failure without failing the route, as update, disable and uninstall already do: enable for a gateway-managed app whose record, read again inside the lock, declares MCP servers, a registry install only when it replaced an installed app. The app-kit-platform spec adds those rows to its lifecycle table and a new §3.1 for the grant's sources and when the copy is taken.Backwards compatibility
Breaking: a grant of a muted server (turned off in MCP Management, a registry install not yet consented, or withheld for a
secret://reference nothing resolves) no longer mounts it in the app agent; on main such a server from the Kiro globalmcp.jsonwas mounted with itsdisableddropped. A managed server name now resolves to the managed spec ahead of a same-named Kiro global entry, as on the default agent. Writer sweep on origin/main @ 72fc530: the one writer ofagent_mcp_policy.jsonisapps/builtins/mochi/agent_policy.py. Its built-inkirocrew-coreandkirocrew-crongrants are managed servers, which resolve before the default agent's spec and are unchanged. Its user grants come from the servers turned on in Mochi's settings; one also turned off in MCP Management now stays off for Mochi, as it is for the default agent. A user-installed app that writes its own policy file keeps main's sources (its agent file, the Kiro globalmcp.jsonand the managed servers) and never reads the default agent's spec; only the muted rule and the managed-first order reach it. On a harness that does not reload MCP servers live, an enable or registry re-install of an app that declares MCP servers resets every open session, as an MCP page write and update, disable and uninstall already do.Reader: src/kiro_crew/apps/bridges_agents.py:_register_agents -- app -- writes the app agent's file without the withheld server and logs why; its other grants and the app's own servers are written as before (test_a_grant_takes_the_mounted_spec_and_withholds_a_muted_one)
Reader: src/kiro_crew/apps/bridges_agents.py:_apply_agent_mcp_policy -- app -- a policy that names another app's
<app>:<server>resolved nothing on main (the global file holds no app servers) and still resolves nothing (same test)Tests
test/test_app_bridges_agent_configs.py::TestAGrantResolvesWhatTheDefaultAgentMounts::test_a_grant_takes_the_mounted_spec_and_withholds_a_muted_one: with a default agent spec holding a store-only server, a server in both files, a turned-off one, a withheld one and another app's server, and a global file with one live and one turned-off server, a grant of all seven copies the store-only, both-files (with the store's command) and live global servers, without the provenance record, and withholds the other four.test/test_app_bridges_agent_configs.py::TestAGrantResolvesWhatTheDefaultAgentMounts::test_a_user_installed_app_grant_never_reaches_a_mounted_only_server: a user-installed app under a shipped built-in's name, whose grant file names a server only the default agent's spec holds, registers an agent without it; once the built-in holds the install, the same registration copies it, which shows the grant was read.test/test_app_lifecycle_reaches_open_chats.py::test_lifecycle_route_reaches_open_chats_when_an_enabled_app_has_mcp_servers:enable,registry-installandregistry-install-streamcases join the update, disable and uninstall ones. Enabling an app that declares an MCP server, and re-installing an enabled one from the registry through either route, take the live-apply step once, with the shipped server already in the spec; a re-install whose new version drops the server takes it with the server gone; an app with no server, or a disabled one, takes no step.test/test_app_lifecycle_reaches_open_chats.py::test_an_enable_reaches_open_chats_before_the_health_watch_writes_the_server: enabling an app whose HTTP server lives on its own backend takes the step although the backend's health watch has not written the server yet.test/test_app_lifecycle_reaches_open_chats.py::test_an_enable_decides_the_step_on_the_record_it_enabled: a re-install that adds a server lands after the enable's first read and before its lifecycle lock; the enable registers that server and takes the step once.test/test_apps_routes_coverage_enable_disable.py::TestRecordReadsRunOffTheLoop::test_enable_disable_and_open_read_the_record_off_the_loop: the enable's in-lock record read is the third read the route makes, and it runs off the event loop like the other two.Proof: PROVEN test/test_app_lifecycle_reaches_open_chats.py::test_lifecycle_route_reaches_open_chats_when_an_enabled_app_has_mcp_servers[registry-install-declared2-True-shipped2-1], test/test_app_lifecycle_reaches_open_chats.py::test_lifecycle_route_reaches_open_chats_when_an_enabled_app_has_mcp_servers[registry-install-stream-declared3-True-shipped3-1], test/test_app_lifecycle_reaches_open_chats.py::test_lifecycle_route_reaches_open_chats_when_an_enabled_app_has_mcp_servers[registry-install-declared19-True-shipped19-1], test/test_app_lifecycle_reaches_open_chats.py::test_lifecycle_route_reaches_open_chats_when_an_enabled_app_has_mcp_servers[registry-install-stream-declared20-True-shipped20-1], test/test_app_lifecycle_reaches_open_chats.py::test_lifecycle_route_reaches_open_chats_when_an_enabled_app_has_mcp_servers[enable-declared21-False-shipped21-1] (head 4607da1)
Determinism:
test/test_app_lifecycle_reaches_open_chats.py,test/test_gateway_appkit_endpoints_install.pyandtest/test_apps_routes_coverage_enable_disable.py(76 tests) passed 20 of 20 runs at-n0;test/test_app_bridges_agent_configs.py(74 tests) passed 20 of 20 runs at-n0and 10 of 10 at-n 4 --dist loadgroup --max-worker-restart=2; all four files' 150 tests passed in a shuffled order (seed 33020). The registration stubs intest/test_gateway_appkit_endpoints_install.pyandtest/test_apps_routes_coverage_registry_install.pycarry themcp_serversfield the registry routes read.Manual verification
N/A — unit coverage sufficient: the grant test reads a real default agent spec file through the same locked reader the registration uses, and the enable cases drive the real route over HTTP with only the backend start and the live-apply step stubbed.
Related Issues
Closes #33020
Sibling sweep
Swept: git grep -nE "_register_app_off_loop(" -- src/kiro_crew/apps
Sibling: src/kiro_crew/apps/routes_enable.py:328 -- changed here
Sibling: src/kiro_crew/apps/routes_registry.py -- changed here
Sibling: src/kiro_crew/apps/routes_install.py -- not affected -- both branches of handle_update_app already take the step, and the local install writes the record disabled, so it registers nothing (app-kit-platform §7.3)
Sibling: src/kiro_crew/apps/default_installs.py:287 -- not affected -- a background pass at gateway start with no request to reach sessions through, already in the spec's table
Sibling: src/kiro_crew/apps/routes_lifecycle.py:283 -- not affected -- a failed update's restore puts back the set an open chat already holds
Swept: git grep -nE "_global_mcp_specs()|ambient.get(name)" -- src/kiro_crew/apps
Sibling: src/kiro_crew/apps/bridges_agents.py:315 -- changed here
Pattern harvest
Rule candidate: review-prompt
Pattern: a second reader resolves an MCP server from a subset of the sources the default agent's rebuild merges, instead of reading the spec that rebuild wrote
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)