Repository navigation
feat(mcp): mount-only request_server cards for the default agent and the worker - #28720
Conversation
e98df8f to
c35b170
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/agent_parts/spec_rebuild.py:746 -- A concurrent rebuild can restore a successfully undone server
BLOCKING -- src/kiro_crew/dashboard/handlers/template_server_request.py:461 -- Default-spec success does not establish that the worker received the change
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — LOW. Every condition checks out in the code. The rebuild reads the record without holding the spec lock ( F2 — LOW. False positive or not applicable? A repository writer can comment: |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: Both GPT 6.1 findings on
The other review lanes (UX, Design, First Principles, Opus) also failed on the same rate limit and will run on the new head. |
c35b170 to
959a959
Compare
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item removes the stated Notes
What this change shipsInventory (10 items) — 7 justifiedIntent: let a default-agent or worker chat add an MCP server with one card click, mounted but with no tools approved. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 053f122 Description read[DESCRIPTION-READ] cb57dab9ddc71e22e47436b442fe61d9cbf1181ccea81ff10d9c07c0954bebe0 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level blocker: the change reuses the existing card and record, it takes nothing away, and the rebuild stamp can only remove an entry, never grant one. Notes
[DESIGN-REVIEWED] 053f122 Description read[DESCRIPTION-READ] dd54c6dbef581b6648b4c64b440fb3e3c9ac2b3f8cb0d03c02bb343431436335 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: |
959a959 to
469b286
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: Dispositions for the review findings on Opus 5.5 (blocking, security): a page toggle stub kept an undone server mounted and let the page's grant approve it. Verified: GPT 6.1 F1 (blocking, fenced): a failed Undo destroyed per-tool grants. Verified: the removal stripped GPT 6.1 F2 (downgraded by adjudication): the card reports Applied when the launcher is missing. Not changed in this PR. |
469b286 to
82cd45e
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: GPT 6.1's finding on Verified: when the Undo rebuild commits This is the second round on the same class, so the fix removes the trigger instead of patching the restore. For the default agent, |
…the worker A default-agent or worker session asking for an MCP server mid-chat was refused (409 unsupported, pointing at the MCP page), because the MCP page's add also approves every tool and a card that said "add this server" would have granted more than it said. The request now raises the existing template.mcp_server card. Approving it records a mount_only addition under kirocrew (the worker mirrors that spec): the rebuild mounts the server (mcpServers plus the @server ref in tools) and never writes the bare @server grant, so every call still asks. A per-tool grant the user wrote is kept, as the card's "Already approved" row says, and the governance ceiling's stricter arm still wins when it applies. kirocrew.json is rebuilt on top of itself, so a merged entry is stamped x-kirocrew-card-addition and reconcile_default_spec removes a stamped entry whose record is gone (the card's Undo), unless the MCP page now carries that name. The stamp can only make a rebuild remove an entry, never grant one. A declined default rebuild now puts the record back, as it does for a conductor. Closes #25771 Co-authored-by: Lê Bảo Duy <4734934+vnlebaoduy@users.noreply.github.com>
82cd45e to
053f122
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: GPT 6.1 produced a verdict on 1. Separate record reads let a kept entry take the full grant (security). Verified: 2. A failed Undo loses per-tool grants (third round of this class). The earlier fixes patched one failure source at a time. This one removes the cause: for the default agent the card no longer trusts the rebuild's overall success flag. It reads the outcome from |
bolichen97
left a comment
There was a problem hiding this comment.
Approving at 053f122.
Read every source, doc and test hunk (15 files). Checked as an approval-gate change:
- A default-agent or worker request is recorded once under
kirocrewwithmount_only: true; the worker reaches it through the mirror. A plain addition on the default agent, any addition on the worker, and a hand-edited default entry without the flag are all refused (_parse_mount_only,_check_covered). sync_shared_server_refskeeps the@serverref intoolsand writes no bare@servergrant for a mount-only server, so every call still goes through the approval gate. Per-tool grants the user wrote are kept and listed on the card.- The
x-kirocrew-card-additionstamp can only make the rebuild remove an entry, never grant one, and a page toggle stub does not keep an undone server mounted (page_launched_names). _rebuild_requiredreads the outcome from the default spec itself, so a rollback runs only when the spec did not change.
Gates at this head: mergeable, 95 checks ok, 0 red, 0 pending, no open change requests. Design, First Principles, Opus and GPT lanes pass; UX skipped (no user-facing surface).
Non-blocking: mounting a stdio server runs its command on the host once the user presses Add server. That was already true for conductor cards, and the card shows the entry, so no change asked.
Problem / Motivation
Goal: a chat on the default agent or the worker can ask for an MCP server, and one click on the approval card adds and mounts it, without approving any of its tools.
Today
request_serverrefuses a default-agent or worker caller (409 unsupported, pointing at the MCP page), so the user has to leave the chat, find the MCP page and add the server by hand. The refusal exists because the MCP page's own add also approves every tool of the server (sync_shared_server_refswrites the bare@serverintoallowedTools), so a card that said "add this server" would have granted more than it said.Why it matters
The default agent is where almost every chat runs, so it is where a missing server is most often found. Sending the user to another page costs clicks and asks them to learn the MCP page just to finish the task in front of them. A mount-only card keeps them in the chat and grants nothing beyond what the card shows.
Not a goal
autoApproveorallowedTools, and the record refuses both.template.mcp_servercard is reused.What changed (motivation → approach → change)
Symptom: a default-agent or worker request answered
409 unsupportedand raised no card.Cause:
template_mcp_additionsrefusedDEFAULT_TEMPLATES, because a normal addition onkirocrew.jsonwould be granted on the next rebuild.Approach: reuse #26604's mount-only disposition (credited), then fix three defects found while reviewing it against main.
kirocrewtemplate and the card is proposed withmount_only: true; the owner-only apply step records it.kirocrewaccepts only a mount-only addition, the worker accepts none (it mirrors the default spec, so one record reaches both), and a hand-edited default entry without the flag is skipped on read. (From feat(mcp): mount a default agent's requested server without grants #26604.)sync_shared_server_refs(mount_only=...)mounts the server (@serverintools) and never writes or keeps the bare@servergrant. A per-tool grant the user wrote is kept, since the card lists it under "Already approved" and says existing permissions still apply. When the governance ceiling has an opinion about the server, the ceiling's stricter arm still runs. Mount-only withholds get their own SEL record.kirocrew.jsonis rebuilt on top of itself, so with feat(mcp): mount a default agent's requested server without grants #26604 alone the card's Undo removed the record but left the server mounted forever.reconcile_default_specnow stamps each merged entryx-kirocrew-card-additionand, on the next rebuild, removes a stamped entry whose record is gone, with its bare@serverrefs, unless an MCP page scope launches that name (an entry with acommandorurl; a toggle stub does not count), in which case the page owns it and only the stamp goes. Per-tool@server/toolrefs are the user's and are kept. The stamp can only make a rebuild remove an entry, never add or grant one._spec_carriesnow countskirocrew, so if the rebuild cannot rewritekirocrew.jsonthe card reportsspec_not_rewrittenand the record is put back, as for a conductor.docs/architecture/mcp.md,src/kiro_crew/docs/agent-spec-fields.mdand the feature-map row describe the new shape.The card text is unchanged: it names the server and where it comes from, lists both agents (
kirocrew,kirocrew-worker) and the open chats it reaches, names the server's tools, says "nothing is auto-approved; this agent's existing permissions still apply", and lists any grant that already exists.Governance: every merged server's calls still reach the PreToolUse gate,
_filter_auto_approve(POLICY ∩ PROFILE) is untouched, and the record directory keeps its seal (read-only to sandboxed processes, writers only in the gateway or CLI).Backwards compatibility
Compatible:
mount_onlyis an optional record and card field; an existing record without it keeps its meaning, and existing conductor and third-party additions are untouched.Reader: src/kiro_crew/template_mcp_additions.py:_template_support -- entry: chat -- the default agent now passes only with
mount_only;test_a_default_addition_without_the_flag_or_on_the_worker_is_refusedReader: src/kiro_crew/agent_materialization/mcp_sources.py:sync_shared_server_refs -- entry: chat|cron|subagent -- the bare grant is withheld only for recorded mount-only names;
test_a_mount_only_server_is_mounted_without_a_grantReader: src/kiro_crew/agent_parts/spec_rebuild.py:rebuild_agent_config -- entry: chat|release -- a stamped entry is removed only when its record is gone and no MCP page scope carries the name;
test_an_undone_addition_the_mcp_page_now_carries_staysTests
test_template_server_request.py::test_a_default_or_worker_request_raises_a_mount_only_card: both callers get a card recorded mount-only underkirocrew, reaching the worker, and the card says nothing is auto-approved.test_template_server_request.py::test_a_failed_default_spec_rewrite_puts_the_mount_only_record_back: a declined default rebuild leaves no record.test_template_server_request.py::test_a_failed_default_undo_puts_the_mount_only_record_back: a failed Undo restores the record with its mount-only disposition.test_agent_mcp_merge.py: a mount-only addition is mounted without a grant; Undo then rebuild removes the entry and its refs; an undone name the MCP page now carries stays mounted; a hand-planted stamp only removes its own entry; a failed Undo returns the server with its per-tool grant; a page toggle stub (no launch line) does not keep an undone addition mounted.test_secret_uri_launch_paths.py: the bare grant is withheld and a per-tool grant kept; under the governance ceiling the per-tool grant goes too; a separately installedtime-2keeps its approval when onlytimeis recorded mount-only.test_template_mcp_additions.py: round trip and reach, refusal without the flag or on the worker, a planted default entry without the flag is never merged.Proof: PROVEN test/test_template_mcp_additions.py::test_a_planted_default_entry_without_the_flag_is_never_merged (head e98df8f)
Mutations, each run against its named test: dropping the default→mount-only mapping reddens
test_a_default_or_worker_request_raises_a_mount_only_card; dropping the stamped-entry removal reddenstest_undoing_a_mount_only_addition_unmounts_it_on_the_next_rebuild; dropping the page-owns-it check reddenstest_an_undone_addition_the_mcp_page_now_carries_stays; droppingkirocrewfrom_spec_carriesreddenstest_a_failed_default_spec_rewrite_puts_the_mount_only_record_back; stripping per-tool grants, or not withholding the bare grant, reddenstest_a_mount_only_server_is_mounted_without_a_grant.Manual verification
Run on Linux against a test-mode gateway booted from this branch (
kirocrew gateway --test-mode) on its own data home and its ownKIRO_HOME, so the live gateway and its agent specs were not touched. A pod could not be used: pods on this host do not boot today because the pod's kiro-cli 3.0.0 child cannot find its enginenodeunder the pod's HOME, which is unrelated to this diff.kirocrewagent, asked it to callrequest_serverwith sourceregistryand registry idai.b77/time. The card appeared in that chat (first screenshot): it lists bothkirocrewandkirocrew-worker, and says "nothing is auto-approved; this agent's existing permissions still apply".kirocrew.jsonandkirocrew-worker.json,mcpServers.timewas present with thex-kirocrew-card-additionstamp,@timewas intools, and no@timegrant was inallowedTools.timewas gone frommcpServersand@timefromtoolsin both files.macOS and Windows were not run; nothing in the diff is platform-specific.
Screenshots / video
The card a default-agent chat raises:
After Add server
Related Issues
Closes #25771
Refs #25180, #25157. Builds on #26604 by @vnlebaoduy (credited with a Co-authored-by trailer).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.