Repository navigation
fix(mate): carry template mcp allows for base-declared servers to workers - #29893
Conversation
…kers A crewmate whose template carries an mcp allow rule for a server the worker base also declares (one from the user's own MCP config) could not start a single worker: the file's allowedTools refs for that server are not carried, KAS drops a derivable allow beside an allowedTools list, and the carry check refused the rule with "permissions rule N (allow mcp) cannot be carried". Carry such an allow as the matching @server / @server/tool refs on the worker's allowedTools, only when those refs provably grant exactly the rule. The governance ceiling still filters the merged list, so the worker never auto-approves more than the crewmate's file declares. A built-in allow and an mcp allow no ref can express stay refused.
9542bee to
2558031
Compare
|
Thanks for approving the runs. Two jobs on head 2558031 failed on GitHub API rate limits, not on the change:
I don't have rights to re-run them from a fork. Could a maintainer re-run those two failed jobs? I'm not pushing anything, so the approved runs stay valid. |
|
Thanks for re-running the last two. Four more fork lanes on head 2558031 hit the same GitHub API rate limit (
Could a maintainer re-run those four? I'm not pushing anything, so the current approvals stay valid. |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
Every check on head 2558031 has now finished green or skipped, but |
|
Thanks, |
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 2558031.
The gate shows 93 checks passed, none red, and only PR Readiness pending. The two jobs that failed earlier on GitHub API rate limits (Sensitive Change Review and Dependency License Gate) passed on rerun.
I read the full diff (3 files, 275 lines). _carry_mcp_allow turns an mcp allow rule that the worker's allowedTools list would otherwise drop into that list's own @server or @server/tool refs, and it writes them only when allow_granted_by_spec then proves the rule is granted, so nothing wider than the rule is added. A pattern that has no exact ref, such as a bracket glob, is still refused. A ref for an excluded tool or a muted server is proved but not written, and the governance ceiling still runs over the merged spec afterwards. This does widen what a worker can auto-approve compared with refusing the worker, and it does so only to the extent the crewmate file already declares. No regex is added in product code. The new tests cover the carried refs, the refusal case, the ceiling withholding a carried ref, and the excluded and muted cases.
…kers (#29893) A crewmate whose template carries an mcp allow rule for a server the worker base also declares (one from the user's own MCP config) could not start a single worker: the file's allowedTools refs for that server are not carried, KAS drops a derivable allow beside an allowedTools list, and the carry check refused the rule with "permissions rule N (allow mcp) cannot be carried". Carry such an allow as the matching @server / @server/tool refs on the worker's allowedTools, only when those refs provably grant exactly the rule. The governance ceiling still filters the merged list, so the worker never auto-approves more than the crewmate's file declares. A built-in allow and an mcp allow no ref can express stay refused. Co-authored-by: Alexander Collado <17326459+alexcollado@users.noreply.github.com> (cherry picked from commit 963d661)
Problem / Motivation
Goal: A crewmate whose template allows an MCP server the worker base also declares starts its workers, with that allow carried exactly.
A crewmate's worker carries its template's
permissionsrules (#28501). When the rule is anmcpallow for a server the worker base also declares, which is any server in the user's own MCP config, every worker start fails withthe crewmate's permissions rule 0 (allow mcp) cannot be carried: they cannot be applied exactly. The crewmate's own chat works, and nothing the user can edit clears it.Why it matters
A crewmate built from a common agent template cannot run a single worker, so all of its delegated work stops at startup.
Not a goal
allowedToolslacks. They are still refused.What changed (motivation → approach → change)
The carry check refused the allow because it saw no way for it to reach KAS. KAS drops an
mcpallow that anallowedToolslist could express. And the file's ownallowedToolsrefs for a server the base declares are not carried.In
src/kiro_crew/mate_spec_policy.py, such an allow now lands as the matchingallowedToolsrefs on the worker:server/*becomes@server, andserver/toolbecomes@server/tool. The refs are written only when they provably grant exactly that rule. A ref for a tool the worker excludes, or for a server it mutes, is not written. The governance ceiling then filters the merged list like any other grant, so the worker never auto-approves more than the crewmate's file declares. Anmcpallow that no ref can express, and a built-in allow, are refused as before.docs/system-specs/modules/crew-mode.mddescribes the carry.Backwards compatibility
Widens nothing a crewmate does not declare: a worker that started before still starts with the same grants. A worker that was refused for this allow now starts. The 2026-11-02 decision (carry exactly or refuse) is unchanged: this carries the rule exactly where it was refused before.
Tests
test/test_mate_spec_policy.py:@notes@notes/searchProof: not provable -- other: prove.py's throwaway worktree errors at collection on this host, so it reports INCONCLUSIVE; reverting
src/kiro_crew/mate_spec_policy.pytomainby hand makes 6 of the new tests fail, and all 71 pass with the fix.Determinism: 20/20 repeats at
-n0, 10/10 runs of the whole file at-n 4, and one shuffled-order run of the whole file, all green.scripts/local-gate.pypasses on both surfaces.Manual verification
N/A: the merge is a pure function of the two specs, which the tests drive end to end through
worker_additionsandmerge_worker_spec.Screenshots / video
N/A: backend only.
Related Issues
Closes #29869
Sibling sweep
Swept: git grep -n "allow_granted_by_spec|permission_allow_derivable" -- src/
Siblings: none -- the derivable-allow refusal has one site, mate_spec_policy._layer_permissions
Pattern harvest
Not generalizable: the refusal guarded a real KAS drop; the gap was a missing exact translation for one rule shape.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)