Skip to content

feat(agent): per-template MCP additions record and merge - #25172

Merged
chenmingwei23 merged 1 commit into
mainfrom
feat/template-mcp-additions-25157
Oct 29, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
feat/template-mcp-additions-25157

Conversation

@buluoray

@buluoray buluoray commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Give the conductor templates and templates Kiro Crew does not write a record of user-approved MCP servers that lives outside their spec files and is merged into their sessions, so a server the user approves survives every rebuild.

A server cannot be added to a built-in template by any route today. _conductor_mcp_servers rebuilds each conductor's mcpServers to exactly kirocrew-core, kirocrew-dashboard and kirocrew-work on every rebuild, the worker mirrors the default agent, and a third-party custom agent may be rewritten by its own installer. A server written into one of those spec files is wiped, or reads the same as a hand edit. This is part (a) of #25157: the record, the merge at every path a template's servers pass through, removal, and a doctor row. Part (b), the kirocrew-core request tool, gateway route and change card with Undo, builds on this module.

Why it matters

Without a supported place to keep an approved server, an agent that lacks a capability either stops or works around the gap, for example by launching an MCP server's binary from the shell, which bypasses the per-tool gate, approvals and the audit trail. The request card in part (b) needs a store that keeps the grant across rebuilds, adds no trust, and can be undone.

Not a goal

  • The request tool, the gateway route, the change card and its Undo button (part (b)).
  • A user-initiated "add to this template" control on the MCP page, and an elicitation reminder.
  • The default agent (kirocrew) and the worker (kirocrew-worker). kirocrew.json already holds every server installed through the MCP page, and the worker mirrors it, so neither needs the record; it refuses both with a reason that sends the user to the MCP page (owner decision on this PR).
  • The heartbeat, the background agents and a crewmate's own service templates: their installers take no additions, so the record refuses them.
  • Adding a server to a third-party template on kiro-cli. kiro-cli loads such a template from its own file and has no per-session channel for a whole spec, and Kiro Crew never writes into a spec it does not own, so addition_support answers unsupported there with a reason that part (b)'s card shows.
  • Any new reload path. Live apply stays behind the existing live_sessions_apply_mcp_live gate.

What changed (motivation → approach → change)

Goal → one record outside every spec, one ADD-only merge at each path a template's mcpServers takes → what was built:

  • src/kiro_crew/template_mcp_additions.py (new). The record is template-mcp-additions/additions.json under the data home: owner-only (0600 file, 0700 directory), atomic writes, an in-process lock plus a cross-process advisory lock on a sidecar. Each entry is a gateway-resolved server entry (command/args/env or url/headers, type, timeout) plus approved_by, approved_at and card_id. Public API for part (b): read_additions, list_additions, add_addition, remove_addition (with card_id, removes only that card's approval), merge_into, merge_into_spec, merge_at_spawn, addition_support(template, backend), addition_reach(template).
  • Support. addition_support(template, backend): a conductor is supported on every backend that runs a spec's servers (agent_sdk.drivers.acp.backend_delivers_spec_servers: kiro-cli and KAS read the spec, a mirrored backend gets it in its array) and refused with NO_SPEC_SERVERS_REASON on pi (broker-only). Any other covered template needs ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN. addition_reach answers () for a refused template.
  • No trust from the record. autoApprove, allowedTools and every key outside ENTRY_KEYS are refused on write and skipped on read. A merge adds the server and its @server mount in tools, never an allowedTools entry or an autoApprove, so its tools prompt until granted separately and POLICY ∩ PROFILE is unchanged.
  • Sealed directory. template-mcp-additions is registered like mcp-launch-approvals: file-tool write-protected (_WRITE_PROTECTED_HOME_PATHS), read-only and pre-created for the OS sandbox (_CREW_READONLY_LEAVES, _CREW_PRECREATE_READONLY_DIR_LEAVES), no-symlink (_CREW_NOFOLLOW_READONLY_DIR_LEAVES), and withheld from foreign harness children (_CREW_CHILD_WITHHELD_LEAVES). Without the seal a sandboxed writer could record a server of its choosing.
  • Who is covered. The conductors are merged by their installer; any template Kiro Crew does not write is merged at spawn. Refused, with a reason string addition_support returns and add_addition enforces: the default agent and the worker (DEFAULT_REASON), a crewmate's service templates (CREWMATE_REASON), and every other template Crew writes (BUILT_IN_REASON). A refused template is never merged, even from a hand-edited record.
  • The merge points, each ADD-only (a name the template already declares keeps its own entry, unless that entry declares only a restriction, disabled / disabledTools, which then narrows the approved entry):
    • conductor installers: conductor_agents._merge_template_additions, right after _conductor_mcp_servers (the deprecated kirocrew-ledger-conductor alias reads and writes its successor's record);
    • every template Kiro Crew does not write: merge_at_spawn in every branch of harness/kas.resolve_projected_spec and the bound app-agent branch of session_extras (KAS wire), and in session_mcp._session_spec_and_snapshot_for (claude/codex array), never written to the file. Positive membership in a new capability set, ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN = {kas, claude, codex}, each with a live capture of a spec-declared server running; classified in the x-capture gate and as off-card.
  • Doctor. kirocrew doctor prints one mcp additions: row per template that has any (server, card, date). Silent otherwise; never an issue.
  • Specs updated in the same commit: src/kiro_crew/docs/agent-spec-fields.md (where each template is merged and what it reaches), docs/system-specs/modules/agent-host-contract.md §5 (per-harness row, including the kiro-cli gap), docs/architecture/mcp.md (new "Per-template MCP additions" section), docs/system-specs/modules/harness-parity.md (the new set under H6), docs/system-specs/modules/security.md (the sealed leaf and the no-trust rule).

Backwards compatibility

Compatible: with no record on disk every path behaves exactly as on main; the merges add nothing. The default agent, the worker and their rebuild are untouched.

Removes nothing: the diff only adds a record, merge calls, a sealed leaf and a doctor row; no path, field, key or function is hidden, tightened or removed.

Tests

test/test_template_mcp_additions.py (50 tests):

  • the record: a restriction-only entry (a checkout's or the dashboard's switch-off keys) narrowing the approved server instead of withholding it, and the array hosts' read keeping such a server; round trip with provenance, 0600/0700 modes, every trust key refused on write, malformed entries refused, a hand-edited autoApprove never reaching a merge, ADD-only merge, card-scoped remove, an alias writing and removing its successor's record, an unreadable record never overwritten;
  • the seal: the leaf is in every sandbox and write-protect list above;
  • coverage: the default agent and the worker refused on every backend, by add_addition, by addition_reach and by the spawn merge even from a planted record; crewmate service templates and every other built-in template (the heartbeat included) the same;
  • the queries: constants pinned to their owners (DEPRECATED_AGENT_SPECS, _MAIN_AGENT_NAME, the worker file), addition_reach checked against a real install of every conductor and the worker, conductor support matched against backend_delivers_spec_servers for every known backend and refused on pi, other templates needing a per-session channel;
  • conductors (all four installers): addition merged with @server in tools and no grant; removed on the next install; another template's addition does not leak; a conductor left alone by the spawn merge;
  • spawn: merge_at_spawn merges a custom template and writes nothing; the array hosts' read and the KAS user-level, project-checkout and crewmate-folder reads all carry the addition and the spec file is unchanged;
  • doctor row.

Mutation checks (each production guard replaced by its pre-change form, the suite above re-run):

Mutation Result
conductor merge removed red, 5 tests
default/worker refusal removed from addition_support red, 2
add_addition coverage check removed red, 4
crewmate service refusal removed red, 1
built-in template refusal removed red, 1
built-in templates merged at spawn red, 3
array-host spawn merge removed red, 1
KAS user-level / project-checkout / crewmate-folder spawn merge removed red, 1 each
trust-key refusal removed red, 6
whole no-trust rule removed (key checks and allowlist rebuild) red, 8
alias canonicalisation on write removed red, 1
pi refusal for conductors removed red, 2
ADD-only check removed red, 2
restriction-only layering removed red, 2
allowlist rebuild alone replaced by a copy green: redundant with the key check on read, which refuses the same entries first

Not covered by a test: the bound app-agent branch in KasHarness.session_extras (one merge_at_spawn call, the same as the four tested branches).

Also run green locally: the worker, conductor, governed-spec-tail, MCP rebuild, agent refactor contract/facade, backend cards, agent-sdk capabilities, host-contract parity, sandbox governance mask, doctor and session-MCP/KAS suites (about 3,000 tests), plus check_harness_parity.py, check_comment_history.py, check_file_line_cap.py, check_agent_sdk_boundary.py, check_sync_io_in_async.py and scripts/docs-lint.sh. Two local failures are host state and fail identically on origin/main: test_is_kiro_cli_is_positive (a ~/.mcp.json on this host trips the Copilot refusal) and test_the_backend_denies_both_destinations.

Manual verification

N/A for a live gateway: the record has no writer until part (b) lands, and every merge path is exercised by tests that run the real installers, the real rebuild and the real spawn reads. Not verified here: macOS and Windows (the lock uses the existing platform_compat.file_lock and the seal uses the existing leaf lists, unchanged per platform), and a live KAS, claude or codex session carrying an addition (this rests on the existing live captures cited at ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN).

Related Issues

Consumer: #25180 (part (b)) is stacked on this branch and adds the production callers of add_addition and remove_addition (the request card and its Undo). Merge order: #25172, then #25180.

Refs #25157 (part (a) of two)

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

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners October 28, 2026 07:24
@buluoray
buluoray requested a review from dodgeblaster October 28, 2026 07:24
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/sandbox_leaves.py

  • src/kiro_crew/sandbox_precreate.py

  • src/kiro_crew/security/paths_lists.py

  • @buluoray posted a complete reasoning template for 2258b7b.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 2258b7b54ec479ea0ffcbd8940ea2e14953e42fd 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 Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the record is sealed, grants no trust, is read fail-soft at spawn, and changes nothing while it is absent; the patch removes nothing.

Notes

  • session_mcp._session_spec_and_snapshot_for merges for every mirrored host, which includes deepseek, opencode, goose and copilot. ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN and addition_support call those hosts unsupported. So an approved server can reach a backend that part (b)'s card will tell the user it does not reach. Either gate the merge on membership in the set, or accept the gap and document it.
  • Every write API (add_addition, remove_addition) has no caller until part (b) lands. The merge-order dependency belongs in the part (b) PR body, so the sealed leaf is not left without a writer if part (b) stalls.

[DESIGN-REVIEWED] 2258b7b

Description read

[DESCRIPTION-READ] bf2b851424a3b8ddec7ec085bce3ced20369e4d39650cfa677e9e7d4fa95711f

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 Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 2258b7b54ec479ea0ffcbd8940ea2e14953e42fd — 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, and every item can be backed out. The record's writer API has no production caller yet, so in this PR every merge reads an empty record.

Notes

  • Item 8 — zero consumers: none of add_addition, remove_addition, addition_support, addition_reach or backend_delivers_spec_servers is called anywhere in src/ outside template_mcp_additions.py (0 hits per symbol in src/scripts). The description says part (b) "builds on this module". Until then nothing in the product writes additions.json, so items 2–3 merge an empty record. Subtraction: defer those five symbols to part (b), which calls them, and keep only read_additions/list_additions/the merges here.

What this change ships

Inventory (10 items) — 8 justified

Intent: let a server the user approved for a conductor or a third-party template survive spec rebuilds, without granting it any trust. ADDITION.

  1. Approved servers are kept in a per-template record outside every spec file — justified
  2. Conductor rebuilds merge the recorded servers into their specs, ADD-only — justified
  3. Templates Crew does not write get recorded servers merged at spawn on KAS/claude/codex — justified
  4. Default agent, worker, heartbeat, background agents and crewmate service templates are refused — justified
  5. A new sealed template-mcp-additions/ directory is pre-created read-only in every data home — justified
  6. A new backend capability set names which harnesses reach a spawn-time addition — justified
  7. kirocrew doctor prints mcp additions: rows when any exist — justified
  8. Write/remove/support/reach API for part (b) — zero consumers: no production caller yet
  9. backend_delivers_spec_servers helper — zero consumers: called only from item 8's addition_support, undeclared
  10. A project checkout's mute/switched-off keys now narrow an approved server on KAS — justified

[FIRST-PRINCIPLES-REVIEWED] 2258b7b

Description read

[DESCRIPTION-READ] d8cea68d473b09055fc18b54071a313d3fa913b490eb720c010bb54eb9044cad

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 Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 2258b7b54ec479ea0ffcbd8940ea2e14953e42fd — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2258b7b

Verdict parsed from the review's SHA-scoped output markers for commit 2258b7b54ec479ea0ffcbd8940ea2e14953e42fd.

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

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2258b7b54ec479ea0ffcbd8940ea2e14953e42fd and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2258b7b

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

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 2258b7b54ec479ea0ffcbd8940ea2e14953e42fd newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • ubuntu-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • windows-latest (platform windows): 8 classified, 0 newly refused, 8 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The tightening adds one leaf, template-mcp-additions, to the sealed and secret path lists: the file-tool read/write floor, the read-only OS sandbox mounts, the precreate and no-follow lists, and the list of leaves withheld from foreign harness children. None of the three shell tiers reads paths in command text (security/paths.py:631: "This gate does NOT match PATHS in command text"), so the 19 shell candidates are expected to come back unchanged. The real tightening is in the file-tool gate and OS-sandbox layers, which nothing can classify. That gap is named below and does not block.

TIGHTENING: Path fence plus sandbox seal on the new per-template MCP additions record -- it stops a sandboxed agent from planting a server that the next rebuild or spawn launches, and stops a foreign child from reading the credentials an entry carries. From sandbox_precreate.py: + "template-mcp-additions": ( "sealed template MCP additions", "the agent could record a server of its choosing that the next rebuild mounts", ), and from paths_lists.py: + "template-mcp-additions", # approved MCP entries' env/headers; as the bindings above

ADJUDICATED: 19 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: posix, windows and any. The diff assumes two things about platform spelling: the data-home prefixes .kiro/crew and .kirocrew with a /-joined leaf, and the KIROCREW_HOME override that record_path() honours.

  • posix rows cover both prefixes (~/.kiro/crew, ~/.kirocrew), the leaf by name (stat on the directory, grep with the leaf as data), the inline KIROCREW_HOME= override, and test runs on the touched modules.
  • windows rows cover the same operations with %USERPROFILE% and $env:USERPROFILE, drive letters, \ separators, .venv\Scripts\python.exe, PowerShell's $env:KIROCREW_HOME= assignment and an icacls ACL check, since the owner-only mode test runs on posix only.
  • any rows cover kirocrew doctor, which surfaces the new mcp additions: rows, and a commit message that contains the fenced leaf name.
  • No row probes the legacy .kirocrew prefix on Windows.

UNADJUDICATED:

  • File-tool gate (is_sensitive_path over _CREW_SECRET_LEAVES and _WRITE_PROTECTED_HOME_PATHS).
    • Call path: an agent's Read/Write/Edit tool call → HookManager.judge file-path tiers → is_sensitive_path against {.kiro/crew,.kirocrew}/template-mcp-additions/**.
    • Inputs I would have submitted: an agent file-tool read of ~/.kiro/crew/template-mcp-additions as a directory listing. Also a read of a project file whose path merely contains the string template-mcp-additions, such as docs/template-mcp-additions-notes.md in a user checkout, to confirm the leaf matches only under the crew home prefixes and not as a substring anywhere.
  • OS sandbox mask (_CREW_CHILD_WITHHELD_LEAVES, _CREW_READONLY_LEAVES, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES).
    • Call path: a sandboxed spawn → sandbox_wrap.wrap_argv → bind and mask targets built from these leaves.
    • Inputs I would have submitted: a sandboxed kirocrew doctor run inside an agent session. The leaf is masked from the read floor that enforced adapters build from, so the new doctor rows could show nothing, or the read could fail and be skipped silently (_doctor_template_mcp_additions swallows every exception). Also a fresh-home first spawn on Linux, to confirm the precreated directory gets bound before the gateway's first write.
  • Admission validator (template_mcp_additions.validate_entry / _check_covered / addition_support).
    • Call path: change-card approval → add_addition → validate_entry.

    • Inputs I would have submitted:

      • a stdio entry with "type": "stdio" and "timeout": 120000
      • a URL entry with headers and no args
      • a command given as a Windows path, C:\\Program Files\\nodejs\\npx.cmd
      • a server name containing @, e.g. @modelcontextprotocol/server-fetch, which _SERVER_RE refuses
      • a template name longer than 64 characters

      These are a validator's refusals, not shell command lines, so no leg can classify them.

[SCOPE-REVIEWED] 2258b7b

@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 Oct 28, 2026
@buluoray
buluoray force-pushed the feat/template-mcp-additions-25157 branch from 15e3f14 to ef3f6af Compare October 28, 2026 07:45
@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 labels Oct 28, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Review dispositions for head ef3f6af9d9. All findings on 15e3f14d57 were real and are fixed in code, each with a test that fails without the fix.

Opus 5.5 BLOCKING, template_mcp_additions.py:436 (a changed default-agent addition kept the old entry). Fixed. Ownership is now tracked per name with the digest of the record entry that was projected. When the record holds a different entry, the projection replaces the spec entry. Tests: test_a_changed_addition_replaces_the_projected_entry, test_the_real_rebuild_replaces_a_changed_default_addition.

GPT 6.1 F1, :454 (a failed spec write lost pending removals). Fixed. The bookkeeping the projection writes before the spec write is the previous pass's for every tracked name (plus each new name), and rebuild_agent_config commits ownership with commit_projection from the spec read back after write_default_spec lands. A refused write commits nothing, so the next rebuild sees the old file with the old ownership. Tests: test_a_failed_spec_write_keeps_ownership_of_a_pending_removal, test_a_failed_spec_write_keeps_a_pending_change.

GPT 6.1 F2 (fenced), :437 (removal deleted an entry the user had edited). Fixed. Ownership records the digest of the entry as written; a spec entry whose digest differs is the user's and is never retired or replaced. A name a source now declares also keeps the source's entry. Tests: test_an_entry_the_user_edited_is_theirs_and_survives_removal, test_the_real_rebuild_leaves_a_hand_edited_addition_to_the_user, test_a_name_a_source_now_declares_keeps_the_sources_entry.

GPT 6.1 F3, :203 (alias additions stored where no merge reads them). Fixed. add_addition and remove_addition map the deprecated alias to its successor before choosing the bucket, the same mapping read_additions uses. Test: test_an_alias_writes_and_removes_its_successors_record.

GPT 6.1 F4, :318 (pi reported as supported for Crew-owned templates). Fixed. addition_support now asks agent_sdk.drivers.acp.backend_delivers_spec_servers (kiro-cli and KAS read the spec; a mirrored backend gets it in its array) and refuses pi with NO_SPEC_SERVERS_REASON. Tests: test_support_for_a_crew_owned_template_needs_a_backend_that_runs_spec_servers, test_owned_support_follows_the_spec_server_delivery_answer.

GPT 6.1 F5, kas.py:204 (crewmate-folder templates skipped on KAS). Fixed. The crewmate-folder branch of resolve_projected_spec merges after drop_partial_platform_servers. Test: test_the_kas_read_merges_a_crewmate_folder_template.

First Principles note (four functions with no caller yet). Kept, not moved. add_addition, remove_addition, addition_support and addition_reach are the API the request card in part (b) is being built against in parallel; the split was set before implementation and (b) imports them. The lane marked it a note, not a block.

Design note (the default-agent projection is the one stateful merge). Acknowledged and documented in docs/architecture/mcp.md and agent-spec-fields.md.

Backend Lint (isort). Fixed the two import blocks.

Mutation checks were re-run on this head; every guard above turns its named test red when reverted.

@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Sensitive change review

  • Head commit: ef3f6af
  • What rule changed: one new crew-home leaf, template-mcp-additions, is added to the existing seal lists: _CREW_READONLY_LEAVES and _CREW_CHILD_WITHHELD_LEAVES in sandbox_leaves.py, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES and _DELEGATED_OVERLAP_LEAF_REASONS in sandbox_precreate.py, and _WRITE_PROTECTED_HOME_PATHS in security/paths_lists.py. No existing entry is changed or removed.
  • Before -> after (what was allowed/blocked, now): before, the leaf did not exist. After, a sandboxed process can read the directory but not write it (OS read-only mount, pre-created, no symlink accepted), the file-tool gate refuses writes under it, and foreign harness children do not see it. Every other leaf keeps its disposition.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the seal failed, a sandboxed agent could write a server entry into the record and the next rebuild would mount it on a template. If the seal were too strict, nothing breaks today: no sandboxed code reads or writes this record; the gateway and CLI write it from outside the sandbox.
  • Evidence checked (which sandbox result proves it): test_the_record_directory_is_sealed_against_a_sandboxed_writer pins the leaf in all six lists; test/test_sandbox_governance_mask.py (the completeness pin over every crew-home leaf disposition) and test/test_sandbox_precreate_secret_dirs.py pass on this head. A live bwrap run was not done on this host.
  • No regression:
    • Tools still work (which tools/commands were run, result): the worker, conductor, governed-spec-tail, MCP rebuild, session-MCP, KAS and doctor suites pass (about 2,800 tests); check_harness_parity.py, check_agent_sdk_boundary.py and check_comment_history.py pass.
    • Backward compatible (old config / old data / old callers still work, how checked): a data home without the directory reads as no additions, and the pre-create list makes the directory before any sandbox starts; test_no_additions_leaves_the_mirror_bookkeeping_as_before shows the worker's recorded generation is unchanged with no record.
    • Existing tests (which suites passed on this head): test_sandbox_governance_mask.py, test_sandbox_precreate_secret_dirs.py, test_template_mcp_additions.py, test_worker_agent*.py, test_conductor_base_work_ledger.py, test_cli_doctor*.py, test_harness_parity.py (one host-only failure that fails identically on main: a ~/.mcp.json on the test host trips the Copilot refusal).
  • How to undo: revert this PR's commit; the leaf lists return to their previous entries and an existing template-mcp-additions/ directory is then just an unused directory under the data home.

@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 Oct 28, 2026
@buluoray
buluoray force-pushed the feat/template-mcp-additions-25157 branch from ef3f6af to 674207b Compare October 28, 2026 08:31
@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 labels Oct 28, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Review dispositions for head 674207b604, covering every finding on ef3f6af9d9. Each fix has a test that fails without it.

Opus 5.5 BLOCKING, agent-spec-fields.md:508 (both docs named a file that does not exist). Fixed. agent-spec-fields.md and docs/architecture/mcp.md now name template-mcp-additions/additions.json, matching security.md and the code.

GPT 6.1 F1 (fenced), template_mcp_additions.py:486 (an empty pending digest claimed ownership). Fixed in code, no override. A name projected but not committed now carries the digest of the record entry it came from, and counts as Crew's only on positive evidence: the entry, with the rebuild's command resolution undone (mcp_provenance.source_view), must still hash to that record entry. A user's edit fails that check and is left alone. Tests: test_an_uncommitted_entry_the_user_edited_is_still_theirs, test_an_uncommitted_unedited_entry_is_still_retired, test_an_uncommitted_resolved_entry_is_recognised_through_its_derivation_record.

GPT 6.1 F2, :338 (KAS reported support for a crewmate service template its spawn skips). Fixed. A crewmate's own service templates (kirocrew-mate-conductor, kirocrew-mate-worker) are refused by addition_support with CREWMATE_REASON and are never merged at spawn on any harness, because a crewmate's servers change through its own capabilities. Test: test_a_crewmate_service_template_is_refused_and_never_merged_at_spawn.

Backend Lint (mypy, 3 errors). Fixed: merge_at_spawn has overloads for a dict and for None, and validate_entry takes object. mypy is clean on every changed module.

Design note (the array merge runs on every array host, while the set claims three). Not changed. The support answer is the conservative one: it promises delivery only where a live capture shows a spec-declared server running. A host outside the set that also gets the server is not told it will, so the card can refuse where it is unsure and never claims more than is proven.

Design note (doc file name). Fixed with the Opus finding above.

First Principles BLOCK (zero consumers until part (b)). Unchanged and not overridden by me. This is the agreed two-PR split; the owner decides between an override and landing it together with part (b).

Mutation checks were re-run on this head: every guard turns its named test red when reverted, except the allowlist rebuild on read, which is redundant with the key check that refuses the same entries first.

@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Sensitive change review

  • Head commit: 674207b
  • What rule changed: one new crew-home leaf, template-mcp-additions, is added to the existing seal lists: _CREW_READONLY_LEAVES and _CREW_CHILD_WITHHELD_LEAVES in sandbox_leaves.py, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES and _DELEGATED_OVERLAP_LEAF_REASONS in sandbox_precreate.py, and _WRITE_PROTECTED_HOME_PATHS in security/paths_lists.py. No existing entry is changed or removed.
  • Before -> after (what was allowed/blocked, now): before, the leaf did not exist. After, a sandboxed process can read the directory but not write it (OS read-only mount, pre-created, no symlink accepted), the file-tool gate refuses writes under it, and foreign harness children do not see it. Every other leaf keeps its disposition.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the seal failed, a sandboxed agent could write a server entry into the record and the next rebuild would mount it on a template. If the seal were too strict, nothing breaks today: no sandboxed code reads or writes this record; the gateway and CLI write it from outside the sandbox.
  • Evidence checked (which sandbox result proves it): test_the_record_directory_is_sealed_against_a_sandboxed_writer pins the leaf in all six lists; test/test_sandbox_governance_mask.py (the completeness pin over every crew-home leaf disposition) and test/test_sandbox_precreate_secret_dirs.py pass on this head. A live bwrap run was not done on this host.
  • No regression:
    • Tools still work (which tools/commands were run, result): the worker, conductor, governed-spec-tail, MCP rebuild, session-MCP, KAS and doctor suites pass (about 2,800 tests); check_harness_parity.py, check_agent_sdk_boundary.py and check_comment_history.py pass.
    • Backward compatible (old config / old data / old callers still work, how checked): a data home without the directory reads as no additions, and the pre-create list makes the directory before any sandbox starts; test_no_additions_leaves_the_mirror_bookkeeping_as_before shows the worker's recorded generation is unchanged with no record.
    • Existing tests (which suites passed on this head): test_sandbox_governance_mask.py, test_sandbox_precreate_secret_dirs.py, test_template_mcp_additions.py, test_worker_agent*.py, test_conductor_base_work_ledger.py, test_cli_doctor*.py, test_harness_parity.py (one host-only failure that fails identically on main: a ~/.mcp.json on the test host trips the Copilot refusal).
  • How to undo: revert this PR's commit; the leaf lists return to their previous entries and an existing template-mcp-additions/ directory is then just an unused directory under the data home.

@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 Oct 28, 2026
@buluoray
buluoray force-pushed the feat/template-mcp-additions-25157 branch from 674207b to e51737a Compare October 28, 2026 09:27
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 28, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 28, 2026
@buluoray
buluoray enabled auto-merge (squash) October 28, 2026 18:53
@buluoray
buluoray force-pushed the feat/template-mcp-additions-25157 branch from 54e69ef to dae73dc Compare October 28, 2026 20:55
@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 labels Oct 28, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Sensitive change review

  • Head commit: dae73dc
  • What rule changed: one new crew-home leaf, template-mcp-additions, is added to the existing seal lists: _CREW_READONLY_LEAVES and _CREW_CHILD_WITHHELD_LEAVES in sandbox_leaves.py, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES and _DELEGATED_OVERLAP_LEAF_REASONS in sandbox_precreate.py, and the read floor _CREW_SECRET_LEAVES in security/paths_lists.py (which fences file-tool reads and writes). No existing entry is changed or removed.
  • Before -> after (what was allowed/blocked, now): before, the leaf did not exist. After, a sandboxed process can read the directory but not write it (OS read-only mount, pre-created, no symlink accepted), the file-tool gate refuses reads and writes under it, and an enforced foreign harness child has it masked. Every other leaf keeps its disposition.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the seal failed, a sandboxed agent could write a server entry into the record and the next rebuild would mount it on a template. If the seal were too strict, nothing breaks today: no sandboxed code reads or writes this record; the gateway and CLI write it from outside the sandbox.
  • Evidence checked (which sandbox result proves it): test_the_record_directory_is_sealed_against_a_sandboxed_writer pins the leaf in all six lists; test/test_sandbox_governance_mask.py (the completeness pin over every crew-home leaf disposition) and test/test_sandbox_precreate_secret_dirs.py pass on this head. A live bwrap run was not done on this host.
  • No regression:
    • Tools still work (which tools/commands were run, result): the worker, conductor, governed-spec-tail, MCP rebuild, session-MCP, KAS and doctor suites pass (about 2,800 tests); check_harness_parity.py, check_agent_sdk_boundary.py and check_comment_history.py pass.
    • Backward compatible (old config / old data / old callers still work, how checked): a data home without the directory reads as no additions, and the pre-create list makes the directory before any sandbox starts; test_no_additions_leaves_the_mirror_bookkeeping_as_before shows the worker's recorded generation is unchanged with no record.
    • Existing tests (which suites passed on this head): test_sandbox_governance_mask.py, test_sandbox_precreate_secret_dirs.py, test_template_mcp_additions.py, test_worker_agent*.py, test_conductor_base_work_ledger.py, test_cli_doctor*.py, test_harness_parity.py (one host-only failure that fails identically on main: a ~/.mcp.json on the test host trips the Copilot refusal).
  • How to undo: revert this PR's commit; the leaf lists return to their previous entries and an existing template-mcp-additions/ directory is then just an unused directory under the data home.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 28, 2026
@buluoray
buluoray force-pushed the feat/template-mcp-additions-25157 branch from dae73dc to 6886908 Compare October 28, 2026 22:32
@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Sensitive change review

  • Head commit: 6886908
  • What rule changed: one new crew-home leaf, template-mcp-additions, is added to the existing seal lists: _CREW_READONLY_LEAVES and _CREW_CHILD_WITHHELD_LEAVES in sandbox_leaves.py, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES and _DELEGATED_OVERLAP_LEAF_REASONS in sandbox_precreate.py, and the read floor _CREW_SECRET_LEAVES in security/paths_lists.py (which fences file-tool reads and writes). No existing entry is changed or removed.
  • Before -> after (what was allowed/blocked, now): before, the leaf did not exist. After, a sandboxed process can read the directory but not write it (OS read-only mount, pre-created, no symlink accepted), the file-tool gate refuses reads and writes under it, and an enforced foreign harness child has it masked. Every other leaf keeps its disposition.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the seal failed, a sandboxed agent could write a server entry into the record and the next rebuild would mount it on a template. If the seal were too strict, nothing breaks today: no sandboxed code reads or writes this record; the gateway and CLI write it from outside the sandbox.
  • Evidence checked (which sandbox result proves it): test_the_record_directory_is_sealed_against_a_sandboxed_writer pins the leaf in all six lists; test/test_sandbox_governance_mask.py (the completeness pin over every crew-home leaf disposition) and test/test_sandbox_precreate_secret_dirs.py pass on this head. A live bwrap run was not done on this host.
  • No regression:
    • Tools still work (which tools/commands were run, result): the worker, conductor, governed-spec-tail, MCP rebuild, session-MCP, KAS and doctor suites pass (about 2,800 tests); check_harness_parity.py, check_agent_sdk_boundary.py and check_comment_history.py pass.
    • Backward compatible (old config / old data / old callers still work, how checked): a data home without the directory reads as no additions, and the pre-create list makes the directory before any sandbox starts; test_no_additions_leaves_the_mirror_bookkeeping_as_before shows the worker's recorded generation is unchanged with no record.
    • Existing tests (which suites passed on this head): test_sandbox_governance_mask.py, test_sandbox_precreate_secret_dirs.py, test_template_mcp_additions.py, test_worker_agent*.py, test_conductor_base_work_ledger.py, test_cli_doctor*.py, test_harness_parity.py (one host-only failure that fails identically on main: a ~/.mcp.json on the test host trips the Copilot refusal).
  • How to undo: revert this PR's commit; the leaf lists return to their previous entries and an existing template-mcp-additions/ directory is then just an unused directory under the data home.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention 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 readiness: checking Automated validation is still running labels Oct 28, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Sensitive change review

  • Head commit: 3fba3e7
  • What rule changed: one new crew-home leaf, template-mcp-additions, is added to the existing seal lists: _CREW_READONLY_LEAVES and _CREW_CHILD_WITHHELD_LEAVES in sandbox_leaves.py, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES and _DELEGATED_OVERLAP_LEAF_REASONS in sandbox_precreate.py, and the read floor _CREW_SECRET_LEAVES in security/paths_lists.py (which fences file-tool reads and writes). No existing entry is changed or removed.
  • Before -> after (what was allowed/blocked, now): before, the leaf did not exist. After, a sandboxed process can read the directory but not write it (OS read-only mount, pre-created, no symlink accepted), the file-tool gate refuses reads and writes under it, and an enforced foreign harness child has it masked. Every other leaf keeps its disposition.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the seal failed, a sandboxed agent could write a server entry into the record and the next rebuild would mount it on a template. If the seal were too strict, nothing breaks today: no sandboxed code reads or writes this record; the gateway and CLI write it from outside the sandbox.
  • Evidence checked (which sandbox result proves it): test_the_record_directory_is_sealed_against_a_sandboxed_writer pins the leaf in all six lists; test/test_sandbox_governance_mask.py (the completeness pin over every crew-home leaf disposition) and test/test_sandbox_precreate_secret_dirs.py pass on this head. A live bwrap run was not done on this host.
  • No regression:
    • Tools still work (which tools/commands were run, result): the worker, conductor, governed-spec-tail, MCP rebuild, session-MCP, KAS and doctor suites pass (about 2,800 tests); check_harness_parity.py, check_agent_sdk_boundary.py and check_comment_history.py pass.
    • Backward compatible (old config / old data / old callers still work, how checked): a data home without the directory reads as no additions, and the pre-create list makes the directory before any sandbox starts; test_no_additions_leaves_the_mirror_bookkeeping_as_before shows the worker's recorded generation is unchanged with no record.
    • Existing tests (which suites passed on this head): test_sandbox_governance_mask.py, test_sandbox_precreate_secret_dirs.py, test_template_mcp_additions.py, test_worker_agent*.py, test_conductor_base_work_ledger.py, test_cli_doctor*.py, test_harness_parity.py (one host-only failure that fails identically on main: a ~/.mcp.json on the test host trips the Copilot refusal).
  • How to undo: revert this PR's commit; the leaf lists return to their previous entries and an existing template-mcp-additions/ directory is then just an unused directory under the data home.

@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Head 3fba3e7242, rebased onto current main, covering the finding on 6886908932.

GPT 6.1 BLOCKING, kas.py:297 (a concurrent addition discarded a checkout's mute). Fixed as the finding suggested. The project-checkout branch of resolve_projected_spec no longer reads the record itself. It merges once (merge_at_spawn) and then layers the checkout's switch-off keys (_project_restrictions) onto the servers that merge produced. A server approved between two reads either is absent from this spawn or carries the checkout's mute; it can never launch unmuted. Test: test_an_addition_landing_mid_read_never_launches_a_checkout_muted_server (the record changes between reads; red on 6886908932, green here). test_the_kas_read_keeps_a_checkout_mute_on_an_approved_server still passes.

Opus, Design and First Principles passed on 6886908932. The rebase also resolved a conflict in harness-parity.md H6/H7 with main's #25154: H7 is main's, and H6 is main's plus this PR's sentence.

A server the user approves for an agent template now has a place to live that
no installer rewrites: template-mcp-additions/additions.json under the data
home, keyed by template name, each entry a gateway-resolved server entry plus
who approved it, when, and on which card. The record carries no trust:
autoApprove, allowedTools and every key outside ENTRY_KEYS are refused on write
and skipped on read, so a merge adds the server and its @server mount in tools
and never a grant. The directory is sealed like mcp-launch-approvals:
file-tool write-protected, read-only and pre-created for the OS sandbox,
no-symlink, and withheld from foreign harness children.

Covered templates and where the ADD-only merge runs:
- the conductors, in their installers right after _conductor_mcp_servers
  (the ledger alias reads and writes its successor's record);
- any template Kiro Crew does not write, at spawn and never into its file,
  on KAS, claude and codex (ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN). kiro-cli
  loads such a template off disk with no per-session channel, so
  addition_support answers unsupported there with a reason.

Refused with a reason string: the default agent and the worker (kirocrew.json
already holds every server installed through the MCP page and the worker
mirrors it), a crewmate's own service templates, and every other template
Kiro Crew writes. A refused template is never merged, even from a hand-edited
record.

Public API for the request card: read_additions, list_additions,
add_addition, remove_addition (card-scoped), merge_into, merge_into_spec,
merge_at_spawn, addition_support, addition_reach. kirocrew doctor lists each
template's additions. No new reload path: live apply stays behind
live_sessions_apply_mcp_live.

Refs #25157
@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]:

Sensitive change review

  • Head commit: 2258b7b
  • What rule changed: one new crew-home leaf, template-mcp-additions, is added to the existing seal lists: _CREW_READONLY_LEAVES and _CREW_CHILD_WITHHELD_LEAVES in sandbox_leaves.py, _CREW_PRECREATE_READONLY_DIR_LEAVES, _CREW_NOFOLLOW_READONLY_DIR_LEAVES and _DELEGATED_OVERLAP_LEAF_REASONS in sandbox_precreate.py, and the read floor _CREW_SECRET_LEAVES in security/paths_lists.py (which fences file-tool reads and writes). No existing entry is changed or removed.
  • Before -> after (what was allowed/blocked, now): before, the leaf did not exist. After, a sandboxed process can read the directory but not write it (OS read-only mount, pre-created, no symlink accepted), the file-tool gate refuses reads and writes under it, and an enforced foreign harness child has it masked. Every other leaf keeps its disposition.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the seal failed, a sandboxed agent could write a server entry into the record and the next rebuild would mount it on a template. If the seal were too strict, nothing breaks today: no sandboxed code reads or writes this record; the gateway and CLI write it from outside the sandbox.
  • Evidence checked (which sandbox result proves it): test_the_record_directory_is_sealed_against_a_sandboxed_writer pins the leaf in all six lists; test/test_sandbox_governance_mask.py (the completeness pin over every crew-home leaf disposition) and test/test_sandbox_precreate_secret_dirs.py pass on this head. A live bwrap run was not done on this host.
  • No regression:
    • Tools still work (which tools/commands were run, result): the worker, conductor, governed-spec-tail, MCP rebuild, session-MCP, KAS and doctor suites pass (about 2,800 tests); check_harness_parity.py, check_agent_sdk_boundary.py and check_comment_history.py pass.
    • Backward compatible (old config / old data / old callers still work, how checked): a data home without the directory reads as no additions, and the pre-create list makes the directory before any sandbox starts; test_no_additions_leaves_the_mirror_bookkeeping_as_before shows the worker's recorded generation is unchanged with no record.
    • Existing tests (which suites passed on this head): test_sandbox_governance_mask.py, test_sandbox_precreate_secret_dirs.py, test_template_mcp_additions.py, test_worker_agent*.py, test_conductor_base_work_ledger.py, test_cli_doctor*.py, test_harness_parity.py (one host-only failure that fails identically on main: a ~/.mcp.json on the test host trips the Copilot refusal).
  • How to undo: revert this PR's commit; the leaf lists return to their previous entries and an existing template-mcp-additions/ directory is then just an unused directory under the data home.

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

Comment, not approving yet at 2258b7b5. Maintainer review for part (a); one decision below has to land in this PR, because #25180 makes the record writable the moment it merges and auto-merge is on here.

What is right: nothing writes the record at this head (hand edit only; sandboxed agents cannot write it, file tools can neither read nor write it); autoApprove and other grant keys are refused on write and skipped on read, so an added server's tools still ask; the doctor row prints server name, card and date only; every AI-lane BLOCK was fixed in code, zero self-overrides. Good.

Required, maintainer decision: an approval attaches to a template NAME, not to a template. template_mcp_additions.py:441 merge_at_spawn keys by the agent string; acp/session_mcp.py:751 and the project branch of _agent_spec_and_snapshot_for (~:832) merge it into any spec called X: user-level, crewmate folder, app-bound, or a .kiro/agents/X.json in a cloned repo when no user-level X exists. Nothing drops the record when X is deleted, an app is uninstalled, or an installer renames it. The added entry carries the user's command, env and headers. So a checkout picks which approved server set it gets, with the user's keys, under a prompt and tools list the repo controls. Tool calls still prompt, so it is not a silent grant, but "an untrusted checkout never picks the servers" now holds only in letter. Decision: (1) bind the record to the template's source (user-level / mate / app id), not the bare name; (2) skip the merge on the project-checkout branch unless the checkout is trusted; (3) drop or refuse-to-merge the record when the named template's own source is gone (same bar as #20483 and the uninstall decision on #24698). Do this here, not in #25180.

Also before approve:

  • _check_server (:575): refuse KIROCREW_BIN_MCP_SERVERS names (kirocrew-core, kirocrew-debug, ...) for templates that do not declare them; KAS projection and the launch rewriter treat those names specially (acp/kas_agents.py:686, rewriter_launch.py:322).
  • agent_sdk/backends_mcp.py:505 ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN = {kas, claude, codex} but session_mcp.py:751 merges for every mirrored host, so deepseek / opencode / goose / copilot get the server while the card will say "unsupported". Gate the merge on the set, or widen the set and say so.
  • Confirm in the body that the MCP launch-approval gate (mcp_gateway/launch_approval.py:1401) runs for an added server on every merge path including the KAS wire, where KAS does the launch.
  • remove_addition only edits the record; conductor spec files keep the server until the next installer run and live sessions until reset. Part (b)'s Undo must trigger a conductor rebuild and say "applies to new sessions".

Nits: sandbox_leaves.py:703 says "not hidden" while :816 and paths_lists.py:411 hide the file; the agent detail / capabilities readouts do not show spawn-merged additions, only kirocrew doctor does; acp/kas_agents.py:131 strips plaintext env for non-managed servers, so an addition needing an API key may arrive on KAS without it (test it in part (b)).

Posted by code-reviewer (Kiro Crew member) on behalf of @CrysisDeu. Full report on file.

@iamwhatever

Copy link
Copy Markdown
Contributor

Holding 2258b7b for human review.

This PR changes which MCP servers agent sessions launch, carrying the user's command, env and headers, and it adds a sealed leaf to the sandbox and file-tool security lists (sandbox_leaves.py, sandbox_precreate.py, security/paths_lists.py). Changes like these are reserved for a human reviewer.

Open items on this head:

  • The maintainer review's required decision has no reply yet. An approval binds to a bare template name, so the project-checkout branch merges the user's approved servers into a checkout's .kiro/agents/X.json (kas.py#L296, template_mcp_additions.py#L441-L456).
  • The array-host merge runs for every mirrored backend (session_mcp.py#L751), while ACP_BACKENDS_TEMPLATE_ADDITIONS_AT_SPAWN and addition_support call deepseek, opencode, goose and copilot unsupported. The Design Review notes raise the same mismatch. Nothing writes the record at this head, so the harm is latent, but feat(mcp): request_server tool and template.mcp_server card #25180 makes the record writable.

To clear: settle the maintainer's decision in this PR, gate the spawn merge on the backend set (or widen the set and document it), and get a human approval for the sensitive files. CI is green and auto-merge waits for the required approval.

— crew-pr-reviewer (r134)

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

Approved: lanes green, readiness: passed.

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.

4 participants