Skip to content

fix(apps): app grants find store servers, enable reaches open chats - #35590

Merged
bolichen97 merged 1 commit into
mainfrom
fix/33020-app-grant-sources
Nov 13, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/33020-app-grant-sources

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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):

  1. Grant a server to an app agent such as Mochi, where the server was added on the MCP Management page, installed from a registry or contributed by the edition. The app's settings route answers policyApplied: true, but the agent's file has no entry for the server, the gateway log says Skipping MCP grant ... no launch spec found, and the app says the tool is unavailable.
  2. Open a chat on a harness that does not watch the agent spec file, then enable an app that registers an MCP server, or update a registry-sourced app (its Update button re-installs it from the registry). The open chat never gets the change; only a new chat or a restart does.

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.json fails 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

  • Granting an HTTP (url) server: a grant still needs a command, as it does on main.
  • Changing which servers Mochi offers in its settings (a built-in app's own code).
  • Reaching open chats from a fresh install: it writes the app disabled and registers nothing, so there is nothing to reach until the enable.
  • An HTTP server on an app's own backend, which the backend's health watch registers after the route has returned (the spec's existing health-gated row).
  • Re-copying a grant when a server changes on the MCP Management page later: the copy is taken when the app's agents are materialized.
  • The neutralize half of the policy and the dangling-ref warning: both mirror what kiro-cli merges from the Kiro global mcp.json at mount time.

What changed (motivation → approach → change)

Situation Before After
a built-in app's grant (Mochi's) of a server from the MCP Management store, a registry install or the edition skipped, no launch spec found copied from the default agent's spec
a built-in app's grant of a server in both the store and the Kiro global file the global file's command the store's command, as the default agent runs it
a user-installed app's grant (one under a built-in's name included) of a server only the default agent mounts skipped still skipped: the app writes its own grant file and no owner consent covers it
grant of a muted server (turned off, not yet consented, a secret:// reference the rebuild withholds) a global-file server was mounted live withheld, with a log line saying so
enabling an app that declares MCP servers, or re-installing an installed one from the registry, with a chat open the open chat never got the change the open chat gets it

The grant looked for a server's launch spec in three places only: the agent's own file, the Kiro global mcp.json and 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_servers reads 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 global mcp.json was mounted with its disabled dropped. 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 of agent_mcp_policy.json is apps/builtins/mochi/agent_policy.py. Its built-in kirocrew-core and kirocrew-cron grants 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 global mcp.json and 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-install and registry-install-stream cases 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.py and test/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 -n0 and 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 in test/test_gateway_appkit_endpoints_install.py and test/test_apps_routes_coverage_registry_install.py carry the mcp_servers field 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

  • 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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 11, 2026 21:09
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 4607da1c22e8a726894ccce14d0fcff36b68996d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 4607da1c22e8a726894ccce14d0fcff36b68996d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 _reach_sessions step, and the muted-server change is listed as Breaking.

Notes

  • The copy is taken when the app's agents are materialized, so if a server is turned off in MCP Management after the grant, the app agent keeps mounting it until the next refresh. That is the opposite of what the new muted rule promises. §3.1 records this; a follow-up issue would keep it from being forgotten.

[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 .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 Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 4607da1c22e8a726894ccce14d0fcff36b68996d — 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 does not.

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

  • Item 8 — duplicate of routes_registry.py:212 _reach_open_chats: the PR adds that helper, then writes a new inline try: await _reach_sessions(...) except: logger.warning(...) block at routes_enable.py:492. Grepping _reach_sessions under apps/ finds 4 more inline copies: routes_enable.py:636, routes_uninstall.py:821, and routes_install.py:256 and :350. _held_mcp_servers repeats the held = info.get("enabled") and …mcpServers expression in routes_install.py:254 and :348. Subtraction: delete the new inline block at routes_enable.py:492-498 and call _reach_open_chats(request, name).

What this change ships

Inventory (8 items) — 7 justified

Intent: 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.

  1. A built-in app's grant now finds servers from MCP Management, registry installs and the edition — justified
  2. A server in both the store and the global file is granted with the store's command — justified
  3. A managed server name resolves before a global entry with the same name — justified
  4. A grant of a turned-off, unconsented or withheld server no longer mounts it, and a log line says so — justified
  5. The rebuild's provenance record is removed from the copied entry — justified
  6. Enabling an app that declares MCP servers now reaches open chats — justified
  7. Re-installing an installed app from the registry (both routes) now reaches open chats — justified
  8. New helpers _held_mcp_servers and _reach_open_chats, while enable adds another inline copy — duplicate of routes_registry.py:_reach_open_chats

[FIRST-PRINCIPLES-REVIEWED] 4607da1

Description read

[DESCRIPTION-READ] 9ab23dd00e9e99441cb4d723686c66eebdf0bb1fbda896c2ab406d6b42b441e5

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 Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 4607da1c22e8a726894ccce14d0fcff36b68996d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4607da1

Verdict parsed from the review's SHA-scoped output markers for commit 4607da1c22e8a726894ccce14d0fcff36b68996d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 4607da1c22e8a726894ccce14d0fcff36b68996d false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 4607da1c22e8a726894ccce14d0fcff36b68996d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4607da1

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 4607da1c22e8a726894ccce14d0fcff36b68996d false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 11, 2026 21:18

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

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

@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 Nov 11, 2026
@bolichen97
bolichen97 force-pushed the fix/33020-app-grant-sources branch from 240c3ef to 1fa0887 Compare November 12, 2026 12:36
@bolichen97

bolichen97 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author
  • A queued enable uses the pre-update manifest and skips chat refresh span=139117958231

fixed in 1fa0887: the enable reads the app record again inside app_lifecycle_lock, after the enable, and decides the open-chat step from that copy, so a re-install it waited on that added servers takes the step.
Pinned by test_app_lifecycle_reaches_open_chats.py::test_an_enable_decides_the_step_on_the_record_it_enabled: red on the old condition, green on the fix.
[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] fixed in 1fa0887, on the change request for 240c3ef, first point. The three install-stream registration stubs in test/test_gateway_appkit_endpoints_install.py now carry an empty mcp_servers, as the real registration result does. Both failing tests pass, and so does the rest of that file (20 passed). The third stub's test passed before only because it never checks ok, so it now runs an install that succeeds.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[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 (routes_enable.py). In test_an_enable_decides_the_step_on_the_record_it_enabled, a server is added after the enable's first read and before it takes the lock. The test fails on the old condition and passes on the fix. The other reads made before the lock (registration, dependencies, onEnable) are main's code, and this PR leaves them as they are. Main's disable and update routes also decide their own open-chat step from a record read before the lock. This PR does not change them.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] needs-a-decision, on the change request for 240c3ef, third point: confirmed. A grant comes from agent_mcp_policy.json in the app's own data directory, and the app's backend writes that file (bridges_agents.py:_agent_mcp_policy). On this head, such a grant copies any server the default agent mounts, except muted servers and other apps' own servers. It is auto-approved unless the governance ceiling denies it. On main, the same grant could reach only the Kiro global mcp.json (which kiro-cli loads into every agent anyway) and the managed servers. For Mochi, the grants are the servers the user turned on in Mochi's settings. For a user-installed app, nothing records that the owner agreed to its grants.

#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:

  • Land the grant source as is. Any app's own grant reaches what the default agent mounts, and the ceiling still decides auto-approve.
  • Read the default agent's servers only for a built-in app's grant (origin builtin, which is Mochi today), whose list the user picks in that app's settings. A user-installed app's grant keeps main's sources. A consent record for those grants is a separate design.
  • Copy the server for any app, but mount it without auto-approve when the grant comes from a user-installed app. Every call then goes through the approval gate, so an unattended app agent's calls are rejected.

I would take the second. The other two points are fixed in the comments above.

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

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

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
@bolichen97
bolichen97 force-pushed the fix/33020-app-grant-sources branch from 1fa0887 to e4afd50 Compare November 12, 2026 21:37
@bolichen97

Copy link
Copy Markdown
Contributor Author

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]

@bolichen97

Copy link
Copy Markdown
Contributor Author

[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.

  • Only a first-party app's grant reads the default agent's servers. _register_agents passes builtin = app_name in execution.builtin_app_names() to _apply_agent_mcp_policy, which reads _mounted_mcp_servers only then. That set needs both a shipped manifest naming the app and a builtin-owned install record, so a user-installed app under a built-in's name (registration then reads the shipped root, but the grant file in its data directory is the user app's) is not treated as built-in.
  • A user-installed app's grant keeps main's sources: its agent file, the managed servers and the Kiro global mcp.json. The managed-first order and the muted rule also reach it; both only narrow what it gets.
  • New test 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 name whose grant names a server only the default agent's spec holds registers its agent without that server; with a builtin-owned record the same registration copies it. It goes red when the gate is dropped, when the caller passes true for every app, and with the earlier shipped-root check.
  • app-kit-platform §3.1 says the same.

The branch is also rebased onto main for a conflict in the import block of bridges_agents.py. @buluoray could you take another look?

@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 12, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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 e4afd50d93 · 400 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@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 Nov 12, 2026
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
@bolichen97
bolichen97 force-pushed the fix/33020-app-grant-sources branch from e4afd50 to 4607da1 Compare November 13, 2026 03:27
@bolichen97

Copy link
Copy Markdown
Contributor Author

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 GitFork type error from #35517, fixed on main by #36124, which this base carries. The patch is unchanged (git range-diff reports it identical).

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 13, 2026

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

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

@bolichen97
bolichen97 merged commit 712d24f into main Nov 13, 2026
103 of 105 checks passed
@bolichen97
bolichen97 deleted the fix/33020-app-grant-sources branch November 13, 2026 18:16
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 13, 2026
buluoray pushed a commit that referenced this pull request Nov 14, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Four MCP gaps: app agent grants miss store and edition servers, app enable skips open chats, MCP page lacks explanations, failed probe hides the cause

3 participants