Repository navigation
feat(app-kit): serve dev-fleet's pod tools through agentTools - #33159
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The PR adds or changes no control, label or state that a user sees. The only frontend line bumps the [UX-REVIEWED] 73665f1 Description read[DESCRIPTION-READ] d866ea7922dee152cd3d47e3a95130336da78eb203785acecf451bc0e1f83e98 That sha256 names everything this verdict read: the PR description, plus the 3 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 new seam key is the smallest generic fix for a gap AGENTS.md calls an App Kit seam gap, and each has exactly one real consumer, Dev Fleet. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: move Dev Fleet's pod tools out of core with no change an agent would notice, so the app can be adopted. ADDITION (a seam extension) plus a move.
[FIRST-PRINCIPLES-REVIEWED] 73665f1 Description read[DESCRIPTION-READ] eaee7519c28a972db5edbc0afa5f22588bb5a953b471aaf36acaf1a8d707f2a3 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 seam extensions (namespace, timeout, text result, gateway-route dispatch) are generic, name no app, and keep every tool name an agent, a profile or a policy already uses. Notes
[DESIGN-REVIEWED] 73665f1 Description read[DESCRIPTION-READ] 8b8e1264302376f8bdcb589c8923d688edb1b50962227ca94fc3bae4f996386d 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: |
92ab4b1 to
66b5d8c
Compare
|
self-added: yes
|
Sensitive Change ReviewSensitive files changed:
|
Sensitive change review
|
66b5d8c to
14e61d4
Compare
Sensitive change review
|
Sensitive change review
|
14e61d4 to
9a8cd30
Compare
26a0618 to
41f5f9b
Compare
|
Rebased again onto Local checks on the rebased tree:
|
Sensitive change review
|
41f5f9b to
0febda4
Compare
|
Rebased onto
No other change. Local checks:
Maintainer note: the marker |
Sensitive change review
|
|
CI red on
Per the red-main rule, this PR gets no push and no override for that red. It will be rebased once #33377 merges. Every other lane on this head is green, including all five AI review lanes. |
Ruling 2 of #26967 keeps app code out of the kirocrew-core MCP server, and E10 refused any dev-fleet adoption pin because mcp_tools/apps.py still declared, ran and mapped pod_up, pod_restart, pod_down, pod_status and pod_ls in core. The wheel copy now declares the five tools in its app.json agentTools block and serves them from one gateway route its backend.hooks.routes registers, running the same agent_pod_api verbs and rendering the same text. The seam gains what that needs without naming the app: a block namespace so tools keep the names agents, skills and policies know, a per-tool timeoutSeconds (a pod boot is bounded at 180s), result "text" so the pod token the tool exists to deliver is relayed as the app wrote it, and dispatch to an app's own gateway route before its sandboxed backend. APP_SDK_LEVEL becomes 4. The core rows go, so core_named_apps() no longer names dev-fleet; the name-keyed channel deny, remote local-only fence and title rows stay and still apply. Part of #26967
0febda4 to
73665f1
Compare
Sensitive change review
|
|
Rebased onto |
|
Pushing a re-sync would throw away this green and rerun the whole matrix, so I proved the rebased tree locally and did not push. Results on
The head stays |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
This review checked head 73665f1. The five pod tool descriptors and input schemas in app.json match the removed core rows exactly; the only addition is the maxLength bounds, which equal the old validator limits. The waits (210/210/120/45/45) match main's timeouts. The name-keyed fences (channel dispatch block, local-only tools) still apply before dispatch. No reader of the removed POD_* names is left. Done well: test_the_core_relays_a_pod_up_reply_byte_for_byte runs a real minted link token through the real core redactor, and the end-to-end test loads the shipped hook into a real RouteRegistry with the proxy set to fail. Together they pin both the reply parity and the new dispatch order.
Security: the new path is no weaker than main. /api/app-tools/call checks internal auth, then the declaration, then exact argument re-validation, then that the app is enabled, then strictSession. The app route is wrapped in the same local-origin plus internal-auth gate, and it checks the host-exec grant again before any pod verb runs. Unknown tools get 404 and a missing grant gets 403. The text result path is stricter than main: every piece is redacted except the one named credential, which is bounded to 16 to 4096 printable characters in 2 to 8 pieces.
- Optional: #32983 also moves APP_SDK_LEVEL from 3 to 4, for a different seam. Whichever PR lands second should move to level 5 in app_sdk_level.py, sdkLevel.ts and the spec's level paragraph.
- Optional: with no Dev Fleet install record, a pod tool call now returns "no installed app declares the tool" where it used to return the route's steps for turning the app on. Consider naming this in Backwards compatibility and pinning it with a pod_ls test.
- Optional: no test fails if the refusal scrub or the code filter in agent_tools._client_view is removed. One parametrized case with a credential-shaped message and a malformed code would pin both.
Problem / Motivation
Goal: Dev Fleet's five agent pod tools are declared and served by the app itself through the manifest
agentToolsseam, under the same names, arguments and replies, so no core table namesdev-fleetand adoption stops refusing it.mcp_tools/apps.pydeclared, ran and mapped (TOOL_APPS)pod_up,pod_restart,pod_down,pod_statusandpod_lsin thekirocrew-coreMCP server. Ruling 2 of #26967 (comment 6713005850) refuses app code in that server, and adoption's E10 (builtin_adoption_checks.core_named_apps) refuses everydev-fleetpin while a core table keys a capability on the app:scripts/adoption_pin.py computeanswerspinned_feature_unsupported.The seam as it stood could not carry these tools unchanged: a tool name had to start with
dev_fleet_, every call waited at most 30s (a pod boot is bounded at 180s in the gateway), the answer was JSON redacted as a whole (the pod'sopen: http://127.0.0.1:<port>/?token=...line is redacted as an exfiltration URL), and a process-backed app's call went to its backend, which is sandboxed and so can neither reach the systemd user bus nor mint a pod token.Why it matters
Campaign #26967 moves every built-in out of core with zero behaviour change for current users. Until no core table names
dev-fleet, its users can never be adopted ontoKiroCrewCaptain/kirocrew-app-dev-fleet, and a rename todev_fleet_*would break the shippedpod-e2e,kirocrew-worktree-devandweb-verifyskills and every profile or policy that names a pod tool.Not a goal
dev-fleetadoption pin, or listing an adopted record's declared tools (app_agent_toolsreads first-party built-in records only; that is a separate change in this campaign).permissions.api(make-live,restart-gateway,pod-token,GET /api/apps): widening the declared permissions is an open owner question (E9)./api/apps/dev-fleet/pod/*gateway routes or their strict-internal rows.What changed (motivation → approach → change)
Goal → move the tools onto the manifest seam, unchanged for an agent → extend the seam generically where it could not carry them, then move them.
Seam (
apps/manifest_agent_tools.py,mcp_tools/app_tools.py,dashboard/handlers/app_agent_tools.py,apps/route_registry.py; no app named):agentTools.namespace: a block may state the prefix its tool names use (a lowercase identifier, at most 32 chars); the default stays the app's name. A core tool still keeps its name, and a name two apps declare is neither's.timeoutSeconds(1-600, default 30, the wait every core post already had): how longkirocrew-corewaits for the forwarded call.result: "text": the app answers with the model-facing text it formatted, and the core redacts it and relays it as text. An answer{"text": [<pieces>], "credential": <str>}keeps one credential verbatim (one printable token, 16-4,096 chars) and the core redacts each piece around it: that is howpod_uphands over the pod's own token, which the core tool never redacted either. Any other answer of such a tool (a gateway refusal, a timeout, any other body) is anError:line, so the tool-call audit records it as failed.jsonstays the default (an exact{"text": <string>}answer is that text).POST /api/app-tools/callserves a tool from the app's own gateway route when the app registered aPOSTroute at exactly the declared route (RouteRegistry.serves), else from its backend as before.apps/manifest.pyfacade binds the newmanifest_agent_toolsconstants.APP_SDK_LEVEL3 → 4 (apps/app_sdk_level.pyandwebsite/src/app-sdk/sdkLevel.ts), because a level-2/3 host refuses a block carrying the new keys.Dev Fleet wheel copy:
app.jsondeclares the five tools under namespacepodwith the core descriptions and schemas byte for byte, plus the bounds the core validator enforced asmaxLength(worktree 200,memory/cpu16), the core waits (210s start/restart, 120s stop, 45s read),result: "text"and a 60,000-char cap; andbackend.hooks.routes: agent_tools:register_routes.agent_tools.pyregistersPOST /api/apps/dev-fleet/agent-tools, re-asserts the pod routes' caller gate (local origin +internal_auth) and the host-exec grant, runs the sameagent_pod_apiverb, reads its answer the way the core gateway client read a route's, and renders the text the core tool rendered (moved verbatim frommcp_tools/apps.py); a pod start's answer names the pod token as itscredential.agent_pod_api.py: each handler's body is split into apod_*_responsefunction both the route and the tool call; the routes are unchanged.Core removals: the pod descriptors, handlers, helpers and
TOOL_APPSrows inmcp_tools/apps.py; thePOD_*schemas invalidation_partsand the validation facade (the declaration is validated by the seam's field-engine schema now).security_posture.pylistsagent_tools.pywith the other Dev Fleet non-egress redactors.Specs:
app-kit-platform.md§7 and §30.1 (keys, dispatch order, text results and the named credential, level 4, Dev Fleet on the seam),dev-fleet.md(model-facing half),docs/architecture/mcp.md.App repo: KiroCrewCaptain/kirocrew-app-dev-fleet@3c0bfa6
That commit carries the same declaration, the
agent_pod_apisplit, the route in itsgateway_hooks.pyand this branch's_answer, so a pod start names its token as the answer's credential there too (no pin exists yet: Not a goal).Backwards compatibility
Compatible: the tools keep their names, descriptions, arguments, validation bounds, waits and reply text; the existing seam keys keep their meaning and defaults, and a block without the new keys validates and dispatches as before (an app with no gateway route at its tool route still goes to its backend).
Two edge readings differ, both in states where the call is refused anyway: a call that the core seam itself refuses (app disabled, gateway unreachable, a timeout) reads
Error: pod_up failed [<code>]: <message>instead of the core tool'sError: pod up '<worktree>' failed: ...(both startError:, so the audit outcome is the same), and a corruptinstalled.jsonhides the tools (the seam's first-party check fails closed) where the core listing showed them and the route refused. The descriptor'sinputSchemanow states themaxLengthbounds the core validator already enforced.Reader: src/kiro_crew/mcp_tools/apps.py:TOOL_APPS -- release -- adoption's core_named_apps() is the reader that must stop seeing dev-fleet; test_adoption_no_longer_refuses_dev_fleet_on_a_core_tool_table
Reader: src/kiro_crew/mcp_tools/apps.py:schemas/HANDLERS (pod_) -- chat|subagent|cron -- the names are now listed and answered by the app_tools domain from the shipped manifest; test_the_pod_tools_keep_their_names_in_the_core_listing
Reader: src/kiro_crew/validation_parts/server_registries.py:MCP_CORE_SCHEMAS (pod_) -- chat|subagent|cron -- mcp_core.validate_args falls through to app_tools.tool_schema; test_pod_tools_keep_the_core_validation_bounds
Reader: src/kiro_crew/validation.py:PODSCHEMA -- release -- no reader outside tests in src/ or scripts/; facade inventory and test_validation_parts_facade updated
Reader: src/kiro_crew/channel.py + src/kiro_crew/session_environment.py (pod by name) -- chat -- unchanged rows, still applied by mcp_core._call_tool_inner to every kirocrew-core call; test_channel_blocked_tools, test_remote_session_local_only_tools
Reader: builtin skills pod-e2e, kirocrew-worktree-dev, web-verify (call pod_up/pod_status) -- chat|subagent -- names unchanged
Tests
test/test_app_agent_tools.py: the new keys parse and every out-of-range value is refused; a stated namespace replaces the app name and a core name still wins; the core waits the declaredtimeoutSeconds; atexttool's text is redacted; a named credential is the one string kept verbatim, each piece around it redacted on its own; a transport failure, a refusal, a malformed credential answer or any other body of atexttool is anError:line; any answer of ajsontool is redacted JSON; a backend app with its own gateway route at the tool route is served there, any other route leaves it on its proxy;RouteRegistry.servesmatches only an exact registered route.test/test_dev_fleet_pod_agent_api.py: the declaration (names, bounds, waits, text result) against the shippedapp.json; every reply, refusal and limit case the core tool tests pinned, now againstagent_tools.py; a pod start names its token as the answer's credential, and through the core's real redaction apod_upreply around a minted link token, and each other pod reply, reads byte for byte what the core tool returned; the tool route's caller gate, grant refusal wording and unknown-tool refusal; the hook registers exactly the declared route; the shipped block is read as first party and its names reachbuild_tool_namesandapp_tools.HANDLERS;core_named_apps()no longer names dev-fleet; apod_lscall through the real/api/app-tools/callhandler and a realRouteRegistryloaded from the shipped hook reaches the gateway route, never the backend proxy.test/test_pod_stop_timeout.py: thepod_downwait it holds above Dev Fleet'spod downbound is read from the shipped declaration.test/test_mcp_apps_tool_gate.py,test/test_validation_parts_facade.py: the apps domain without the pod tools; its one remaining app's listing is checked against the call gate with noinstalled.json, switched off and switched on.Determinism:
test_app_agent_tools.pyandtest_dev_fleet_pod_agent_api.pypass 5 repeats (-n 4) and a shuffled serial order (seed 33159);test_mcp_apps_tool_gate.pypasses 20 repeats at-n0, 10 at-n 4beside two sibling files, and a shuffled order (seed 33159); the changedtest_pod_stop_timeout.pytest passes 20 repeats at-n0, 10 at-n 4beside two sibling files, and its file shuffled (seed 33159);test/test_flake_pattern_ratchet.pyis green.Proof: not provable -- other: a move plus a seam extension, not a defect fix; reverting the production hunks deletes agent_tools.py and fails the moved tests at import
Manual verification
N/A — the call is pinned through the real gateway handler, the real route registry and the shipped hook module; the pod verbs themselves are unchanged and keep their own tests. The app repository's full suite (1,398 tests) passes against this branch and against its pinned Kiro Crew commit.
Related Issues
Part of #26967
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.