Skip to content

fix(mate): carry template mcp allows for base-declared servers to workers - #29893

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
alexcollado:fix/worker-carry-broad-allow
Nov 5, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
alexcollado:fix/worker-carry-broad-allow

Conversation

@alexcollado

Copy link
Copy Markdown
Contributor

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 permissions rules (#28501). When the rule is an mcp allow for a server the worker base also declares, which is any server in the user's own MCP config, every worker start fails with the 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

  • Carrying built-in (non-MCP) allows the worker's allowedTools lacks. They are still refused.
  • Changing what the governance ceiling allows.
  • Changing the conductor (the crewmate's own chat) spec.

What changed (motivation → approach → change)

The carry check refused the allow because it saw no way for it to reach KAS. KAS drops an mcp allow that an allowedTools list could express. And the file's own allowedTools refs for a server the base declares are not carried.

In src/kiro_crew/mate_spec_policy.py, such an allow now lands as the matching allowedTools refs on the worker: server/* becomes @server, and server/tool becomes @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. An mcp allow that no ref can express, and a built-in allow, are refused as before.

docs/system-specs/modules/crew-mode.md describes 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:

  • the reported case: an allow for a base-declared server starts the worker, granting only @notes
  • a tool-scoped allow grants only @notes/search
  • a server the file adds keeps the file's own refs, as before
  • the ceiling withholds the carried ref, and KAS relays no allow for it
  • parametrized refs for whole-server, single-tool and mixed matches
  • an allow no ref can express is still refused and writes nothing
  • a built-in allow is still refused
  • an excluded tool or a muted server gets no auto-approval back, and the worker starts

Proof: 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.py to main by 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.py passes 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_additions and merge_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

  • 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

@alexcollado
alexcollado requested review from a team and KiroCrewCaptain as code owners November 4, 2026 19:31
@alexcollado
alexcollado requested a review from buluoray November 4, 2026 19:31
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Nov 4, 2026
…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.
@alexcollado

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/crew-mode.md (same file) and the src/kiro_crew/ and docs/system-specs/modules/ directories this PR touches, since this head was cut (87a0769 -> 7353b58). Related tests re-run green (351 passed); CI re-running.

@alexcollado
alexcollado force-pushed the fix/worker-carry-broad-allow branch from 9542bee to 2558031 Compare November 4, 2026 19:45
@alexcollado

Copy link
Copy Markdown
Contributor Author

Thanks for approving the runs. Two jobs on head 2558031 failed on GitHub API rate limits, not on the change:

  • Sensitive Change Review (run 41899963239): API rate limit exceeded for installation, and the job asks to be re-run.
  • Dependency License Gate (run 41899962866): the dependency-graph API hit the same rate limit. The job says "This is not a license finding; re-run this job once the API recovers."

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.

@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 Nov 4, 2026
@alexcollado

Copy link
Copy Markdown
Contributor Author

Thanks for re-running the last two. Four more fork lanes on head 2558031 hit the same GitHub API rate limit (API rate limit exceeded for installation, HTTP 403) at their first step, "Resolve and validate PR", around 23:07 UTC, so none of them reviewed or scanned anything:

  • Internal Content Scan (run 41930971097): "could not list open PRs; the query itself failed on all 3 attempts".
  • GPT 6.1 Review (run 41930971119) and Opus 5.5 Review (run 41930971129): same failure. The later scope_redact.py is missing ... on the base commit () error follows from it, because the base commit was never resolved.
  • Security Scope Review (run 41930971356): its generate job failed the same way, so no scope was resolved.

Could a maintainer re-run those four? I'm not pushing anything, so the current approvals stay valid.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 2558031858947bf584130555312363f2b32cef18 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2558031

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 2558031858947bf584130555312363f2b32cef18 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2558031

@alexcollado

Copy link
Copy Markdown
Contributor Author

Every check on head 2558031 has now finished green or skipped, but PR Readiness is still pending. Its last evaluation (00:28 UTC) hit read failures ([read-failed] 9 readiness check(s) still pending) and never re-evaluated after those checks passed. Could a maintainer re-run PR Readiness for this head? Nothing will be pushed.

@alexcollado

Copy link
Copy Markdown
Contributor Author

Thanks, PR Readiness re-evaluated and is down to three lanes: it's waiting on Design Review, UX Review and First Principles Review. Their fork lane runs (41930971153, 41930971163, 41930971118) failed at 23:07 UTC on the same API rate limit exceeded error and never produced a verdict, and the earlier re-run batch didn't include them. Could a maintainer re-run those three? Nothing will be pushed.

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

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.

@bolichen97
bolichen97 enabled auto-merge (squash) November 5, 2026 01:19
@bolichen97
bolichen97 disabled auto-merge November 5, 2026 03:00
@bolichen97
bolichen97 merged commit 963d661 into kirodotdev:main Nov 5, 2026
94 of 97 checks passed
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 5, 2026
bolichen97 pushed a commit that referenced this pull request Nov 5, 2026
…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)
@alexcollado
alexcollado deleted the fix/worker-carry-broad-allow branch November 11, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crewmate worker sessions fail at startup: "permissions rule 0 (allow mcp) cannot be carried"

2 participants