Repository navigation
feat(apps): list a third-party app's agentTools on an opt-in prompted kirocrew-apps server - #17015
unstablebrainiac wants to merge 1 commit into
Conversation
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The accepted base RFC Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: let a third-party app's manifest
[FIRST-PRINCIPLES-REVIEWED] 1058694 Description read[DESCRIPTION-READ] c4b04946a148442365220c320da086cb74d15066718c880f84a09bfcc213a2cf That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design blocker: third-party tools go on their own opt-in server that never auto-approves, and the route-level refusals fail closed. Notes
[DESIGN-REVIEWED] 1058694 Description read[DESCRIPTION-READ] 933e7ccc6b6383c6ab0306c2812013e5658e9684b4eca5f7beaa232045e5503a 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 (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — 🔴 changes requested (blocking)Reviewed Adjudication upheld 2 of 2 blocking finding(s); those must be resolved before merging. BLOCKING -- src/kiro_crew/dashboard/handlers/app_agent_tools.py:140 -- Codex sessions cannot execute prompted app tools
BLOCKING -- src/kiro_crew/dashboard/handlers/app_agent_tools.py:127 -- Launch lookup excludes explicitly granted shared subagents
[BLOCK-MERGE] 1058694 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — MEDIUM. A Codex session explicitly granted F2 — MEDIUM. The shared subagent's provider is stored only on |
d9463be to
5e5f61a
Compare
5e5f61a to
7b0b71b
Compare
7b0b71b to
574fa3d
Compare
574fa3d to
f9017de
Compare
|
Replying to r112 at 5de324b. The current head is 8982c31: a rebase onto main plus the two code changes below. Item 4, GET with First Principles item 7, three verb lists. Fixed here. Item 5, re-implementing Item 6, the builtin snapshot copy of Item 1, no in-repo consumer. Unchanged. The first consumer is the external Slack subscription app named in the description, which is not public yet. Whether that is enough is part of the #16910 / RFC #19676 decision. Design punchline, |
|
HOLD at a721b4c. The r112 GET item is fixed: What still blocks approval:
To clear: a maintainer accepts the design and a human does the security review. Our earlier CHANGES_REQUESTED stays until then. No PR code was run locally. — crew-pr-reviewer (r113) |
|
On r113 item 3: a721b4c is a rebase of 8982c31 onto main with no patch change (range-diff identical), so the First Principles dispositions in #17015 (comment) apply to a721b4c as written.
Items 1 and 2 of the hold stay with a maintainer. |
|
HOLD at a721b4c. The author has re-stated the First Principles dispositions for this head, so nothing is left for the author. CI is green, and I found no concrete defect in the admission path. Two items need people, not code:
Our earlier request for changes stays until both clear. — crew-pr-reviewer (r116) |
|
HOLD at dedaa69. This head is a rebase of a721b4c with one small hardening. The Two items need people, not code:
Our earlier request for changes stays until both clear. — crew-pr-reviewer (r119) |
bolichen97
left a comment
There was a problem hiding this comment.
Blocking security finding: an agent app request carries X-Internal-Secret into the same web.Request given to the installed app handler. App code can read and replay that core bearer secret against privileged internal routes.
Required fix: strip core credentials before app dispatch. Keep only scoped session metadata. Add tests proving handlers cannot read or replay the secret.
|
@bolichen97 Fixed in 22ff443. On an agent-route call, Two tests in |
|
HOLD on 22ff443. The new head answers bolichen97's blocking finding in the way they asked. On an agent-route call the app handler now gets a clone of the request without What still blocks, and what clears each:
Our earlier change request is superseded by this hold. No PR code was run locally. Reviewed head: — crew-pr-reviewer (r123) |
|
HOLD at 22ff443. The head is unchanged since our last review. RFC #19676 has now merged, which was the first step of the maintainer ruling, but the merged RFC still reads What still blocks, and what clears each:
No PR code was run locally. — crew-pr-reviewer (r126) |
|
HOLD at e9c44c0. This head is a pure rebase of 22ff443, which we reviewed in r126; the PR's own added and removed lines are identical. I still find no code defect. The credential strip before app dispatch is in place (route_registry.py#L32-L53), every AI lane passes, and every check is green. What blocks, and what clears each:
AI findings judged non-blocking:
I read the source and CI; I did not run any PR code. — crew-pr-reviewer (r134) |
|
HOLD at eb98640. This head rebases e9c44c0 (reviewed in r134) onto newer main. The PR's own added and removed lines are byte-identical, and the branch now merges cleanly with main, so the earlier What blocks, and what clears each:
AI findings judged non-blocking:
I read the source and CI. I did not run any PR code. — crew-pr-reviewer (r136) |
|
On the First Principles BLOCK ("second enablement reader":
Calling The same code drew a First Principles PASS on a1ce5b8 and b8662a8 and a BLOCK on 2282556 and 3c12bc1. |
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does the review scope was never resolved: the generate job did not finish (it timed out, failed or was cancelled), so no leg ran; its log names the step that stopped No |
bolichen97
left a comment
There was a problem hiding this comment.
Thanks: the point from my 10-23 review is fixed at 41965f7. The request an app handler gets is now cloned with scrubbed headers (route_registry.py), so the core secret no longer reaches app code.
Requesting changes for one point: this head adds three regexes in product code, and this repository asks new code to validate text without them.
apps/manifest.py:_AGENT_ROUTE_SEGMENT_REchecks each route segment withfullmatch. Instead, accept a segment that is non-empty and whose characters are all in a fixed set (ASCII letters, digits and._~-). Or accept a{name}segment that starts with{and ends with}, where the inside is non-empty, starts with a letter or_, and has only letters, digits and_.validation_parts/app_schemas.py:_APP_REQUEST_APP_REchecks the app name. Split on-, require every part to be non-empty, and require every character to be an ASCII lowercase letter or digit.validation_parts/app_schemas.py:_APP_REQUEST_PATH_REchecks the request path. Require a leading/, split the rest on/, require every segment to be non-empty, and require every character to be in a fixed set (ASCII letters, digits and._~:@+-).
The tests that cover these validators should pin the same accept and refuse cases. CI is green.
bolichen97
left a comment
There was a problem hiding this comment.
Approving at b72712a. The point from my last review is fixed: _AGENT_ROUTE_SEGMENT_RE, _APP_REQUEST_APP_RE and _APP_REQUEST_PATH_RE are gone, and the diff adds no new regex in product code. The import re lines left in those files are existing ones from main. The core secret is still scrubbed from the request an app handler receives. All checks pass.
|
HOLD at I found no code defect. Since our r136 review at What holds it:
The description's AI findings judged non-blocking: Design note 1 (the session is caller-claimed on TCP; the caller must already hold the secret, and the spec says so); Design note 2 (the Our earlier change request is superseded by this hold. All checks are green and the branch merges cleanly. — crew-pr-reviewer (r149) |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own. The PR adds an opt-in, prompted 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 |
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at f4b502f. I read the whole product diff and the list of tests, and checked the three things that matter for a third-party reach.
Default off. kirocrew-apps is opt_in: an agent reaches it only when its spec is granted @kirocrew-apps, so no default agent gains the surface. The managed-server list entries are additions for a server nobody mounts today, and with no such mount config_mounts_prompt_only_server is false, so final_ceiling_pass, sanitize_agent_config_governance, _ceiling_permitted and the bridge filters return what they returned before. test_a_match_all_grant_stands_on_an_agent_without_the_server and the "keeps wildcards without a prompt-only server" test pin this, so off behaves like main.
Every call still prompts the owner. The server entry has no autoApprove key and the comment says none may be added. may_skip_gate refuses any grant that names the server, and a match-all or @kirocrew-* pattern is withheld from allowedTools of any agent that mounts it, in the materializer, the template ceiling, the packaged bridge filter, the whole-config sanitizer and the KAS projection. Scoped app agents have the whole server withheld, because its tool names are not known when they are built. That only adds prompts, and only for the new server.
What a call can reach. third_party_tools lists only a non-first-party app's tools, in its own namespace, with no strictSession tool and no name a first-party or core tool has. /api/app-tools/prompted-call is strict internal, resolves only third-party declarations, validates the arguments again, refuses a disabled app, and refuses a session owned by another app (cross_app). The core route cannot reach a third-party tool and the prompted route cannot reach a first-party one, and both have tests. A third-party answer never takes the verbatim credential path and is redacted and cut like a core answer.
No regex added; the only new pattern matching is fnmatchcase on a server name. The docs and RFC updates match the code.
The change request that iamwhatever left on an earlier head still gates the merge.
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 631f428. I compared this head with the one I approved earlier (f4b502f) by diffing the PR's own changes on both. Most of the delta is rebase and test counts. The new behavior is in agent_materialization/fork_refresh.py, and I need one change there. I have turned off the auto-merge I set on the earlier approval until it is fixed.
New launch refusal. _require_prompt_only_launch_grants_safe (called from require_shared_template_within_ceiling) raises SharedTemplateOverCeiling and ends the start with "The session was not started" for any authored spec that mounts kirocrew-apps and has an allowedTools entry covering it. It runs for every authored spec, including one no crew is bound to. On main nothing refuses that start, so this makes a session fail to start where it starts today, even though the aim (every call to that server must prompt) is a good one. The earlier head met the same aim without failing a start: the Kiro Crew copy of the spec drops the covering grants and the calls prompt.
Please keep a start working. Two ways that fit:
- Do not refuse. Log the warning and the audit line for the covering refs (the new
report_prompt_only_withheldalready does this for the view) and let the start go on, or - Keep the refusal, but behind a setting that is off by default, so the strict check is opt in.
Everything else in the delta is fine to me: the audit line for withheld wildcards, _project_spec_for_launch skipping the scan when the checkout has no project agents directory, and the test updates. The access design I reviewed earlier is unchanged: the server is opt in, has no autoApprove, and every call still asks the owner. No regex added.
I will approve again once the start is no longer refused by default. iamwhatever's older change request also still gates the merge.
… kirocrew-apps server A first-party app's manifest agentTools are listed under kirocrew-core, which the default agent auto-approves as a whole server, so a third-party app's block listed nothing. Section 30.1 named the missing piece: a listing path that asks before each call, a server of its own outside allowedTools. kirocrew-apps is that server (mcp_apps.py). It is an opt_in managed server like kirocrew-secrets: no default or derived spec carries it, so an agent reaches third-party app code only when its spec is granted @kirocrew-apps, and a worker it spawns does not inherit it. It has no autoApprove and no allowedTools entry, so kiro-cli asks before every call and the PreToolUse gate sees each one; kirocrew doctor never adds it to allowedTools. app_agent_tools.third_party_tools reads an installed app that is not first party, not adopted under pin trust and not named by a shipped manifest, from its data-home app.json. It takes no block that states a namespace other than the app's own or declares a strictSession tool, and drops any name a first-party app declares. Each listed description is led by the name of the app that serves it. A call is validated through the field engine and posted to the new strict internal route POST /api/app-tools/prompted-call. Its handler shares the decision of /api/app-tools/call; each route resolves only its own set of declarations, so neither server can reach the other's tools. The answer is redacted and capped by the code kirocrew-core already uses (app_tools.shape_answer). The post carries the lenient session key, so token_auth names the app that owns the calling session, and the prompted route refuses (403 cross_app) a session one app owns calling another app's tool on both dispatch paths (the signed proxy already refused it; the route registry did not). A text answer's verbatim-credential shape stays first-party only; a third-party answer in that shape is redacted whole. A scoped app agent (permissions.mcpTools) has the server withheld whole, because its tool names are those of the apps installed at call time. This replaces the agentRoutes and app_request design this PR first carried: the agentTools seam (kirodotdev#32660) now covers first-party apps, and this extends it to third-party apps. The RFC for agentRoutes records that no implementation of it is open. Part of kirodotdev#16910
Problem / Motivation
Goal: Let a third-party app's manifest
agentToolsreach agents, with the user approving each call.The
agentToolsseam (#32660, #33542) lets an app declare MCP tools inapp.jsonand serve them from its own route. Its tools are listed underkirocrew-core, and the default agent'sallowedToolsgrants@kirocrew-coreas a whole server, so every call there skips the permission prompt. That approval is right for first-party code and wrong for third-party code, soapp_agent_tools.pyreads first-party blocks only, and a registry app's block validates, installs and lists nothing. Section 30.1 ofapp-kit-platform.mdnames what was missing: "a path that asks before each call (a server of its own outsideallowedTools, or a per-tool approval); that is a maintainer's decision, not this seam's."This PR implements the first of those two options as an opt-in server, so no default agent changes and an agent reaches third-party app code only when its owner grants it.
Why it matters
Until now, a registry app that wants agents to drive it has to ship and run an MCP server of its own. The core already does all of that work for a first-party app's declaration: it validates the schema, forwards the call through the signed proxy, and redacts and caps the answer. This PR lets a third-party app use the same code, without giving it core's auto-approval.
Not a goal
kirocrew-appsis opt-in; whether any agent should carry it by default is a separate decision.strictSessionfor third-party apps. A third-party block that declares it lists nothing. Supporting a declaration that depends on a specific calling session still needs a separate ruling.kirocrew-core, which is the other option section 30.1 names.What changed (motivation → approach → change)
kirocrew-appsserver (mcp_apps.py)opt_inmanaged server, likekirocrew-secrets: no default or derived spec carries it, an agent has it only when its spec is granted@kirocrew-apps, and a worker that agent spawns does not inherit it. It has noautoApproveand noallowedToolsentry, so kiro-cli asks before every call and the PreToolUse gate sees each one;kirocrew doctornever adds it toallowedTools. It lists the installed third-party apps' tools, minus a readably disabled app's, and each description starts withServed by the installed app '<name>', not by Kiro Crew.app_agent_tools.third_party_toolsapp.json. It takes no block that states anamespaceother than the app's own, and no block with astrictSessiontool. A name any first-party app declares stays that app's, and a name two third-party apps declare is neither's.POST /api/app-tools/prompted-call/api/app-tools/call, served by the same decision indashboard/handlers/app_agent_tools.py. Each route resolves only its own set, sokirocrew-corecannot reach a third-party tool andkirocrew-appscannot reach a first-party one. The audit row names the server that posted.mcp_apps.pyis a reflexive module inmcp_core_parts/identity.py), sotoken_authnames the app that owns that exact session (request["app"]). The prompted route refuses (403cross_app) a call from a session another app owns, on both dispatch paths.shape_answerinmcp_tools/app_tools.py, the codekirocrew-corealready ran. Aresult: "text"answer's verbatim-credential shape stays first-party only; a third-party answer in that shape is redacted whole.permissions.mcpToolshaskirocrew-appswithheld whole (apps.permissions._OPEN_ENDED_MANAGED_SERVERS), because its tool names depend on what is installed at call time.platform/governance.pyaddsPROMPT_ONLY_MCP_SERVERS, andmay_skip_gatenever skips the gate for a literal@kirocrew-appsref. KAS withholds covering wildcard grants in its projection. Kiro CLI serves prompted calls only for a session whose launch-time record proves it started on a Crew-minted native skill view or app launch copy; an authored launch or missing strict session identity gets 403approval_grants_undetermined, without re-reading a mutable spec. The launch fact is recorded insrc/kiro_crew/acpand reaches the route throughsrc/kiro_crew/providersasagent_sdk/prompted_calls.pyPromptedCallLaunch. Native skill views withhold covering patterns when the server is mounted by the spec or by the global or workspace.kiro/settings/mcp.json, using the same native settings reader as session startup (agent_sdk/mcp_json_reach.py) and failing closed when a file is unreadable. An app launch copy serves every workspace, so its writer also withholds those patterns whenevertools: "*"could inherit a workspace entry it cannot inspect. Generic writers undersrc/kiro_crew/agent_materializationandsrc/kiro_crew/appsleave wildcard patterns alone._MANAGED_MCP_SERVERSinagent.py,mcp_discovery_managed.py,OPT_IN_BIN_MCP_SERVERSinmcp_cleanup.py,SLIM_SERVERSinmcp_entry.py,mcp_gateway/stub_register.py,MANAGED_STUB_FOLLOWERS,config/integration_sections.py, andcli.py(kirocrew mcp-apps).This PR first carried the
agentRoutesandapp_requestdesign from RFC #19676. TheagentToolsseam on main now covers first-party apps, and this PR extends it to third-party apps, so that design is dropped. The RFC and its index row now say that no implementation of it is open. The force-push replaces the whole diff.Backwards compatibility
Removes nothing: no route, key, field or function main has is deleted or renamed.
Tests
test/test_app_agent_tools_third_party.pycovers:namespace, astrictSessiontool, a first-party or shipped name, a name two third-party apps declare);test/test_prompt_only_mcp_settings.pypins the inherited-entry check: a JSONC global file, a workspace-only entry, an enabled global entry alongside a disabled workspace entry, no workspace read without awork_dir, and an unreadable file that fails closed while an absent one declares nothing.test/test_cli_mcp_doctor.pypins that doctor never adds a granted@kirocrew-appstoallowedTools;test/test_worker_agent.pythat a worker does not inherit it.opt_in, thestrictSessionrefusal, the prompted route's own lookup, the cross-app refusal, the scoped-agent withhold, the credential redaction, the authored-launch refusal, the app-launch-copy serve branch, and the strict session-key requirement each failed its test.test/fixtures/dashboard_mcp_route_table.txtand the boot sequences intest/test_dashboard_server_composition_contract_reach.pygain the new route. The refactor shape pin gains the new registry row.test_the_dashboard_boot_keeps_its_chain_hooks_and_order, depends on the development host's app-window discovery and fails the same way on the previous head.Manual verification
python -m kiro_crew.mcp_appswas driven over stdio against a scratchKIROCREW_HOMEthat held one third-party app declaringdemo_app_ping.initializereturnedkirocrew-appswith the caller-identity capability.tools/listreturneddemo_app_pingwith the descriptionServed by the installed app 'demo-app', not by Kiro Crew.\n\nPing.A live gateway call through the signed proxy was not run. It goes through the same_decidepath as/api/app-tools/call, whichtest_app_agent_tools.pyexercises through the real proxy.Related Issues
Part of #16910
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)