Skip to content

feat(governance): respect an owner-written MCP autoApprove - #14394

Merged
chenmingwei23 merged 2 commits into
mainfrom
mcp-honour-autoapprove
Sep 27, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
mcp-honour-autoapprove

Conversation

@bolichen97

@bolichen97 bolichen97 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An autoApprove list the owner wrote themselves is honoured again, so the tools they exempted stop asking.

An autoApprove list the owner wrote themselves, in ~/.kiro/settings/mcp.json
or directly in an agent file, was deleted from the agent config Kiro Crew writes.
The owner saw no notice: a logger.info line and a SEL event, neither of which a
person reads. Tools they had deliberately exempted started showing approval cards
again with nothing explaining why, and the documented way back was a config key
with no dashboard control, so recovering the choice meant hand-editing
config.json and restarting.

Why it matters

The list is not something that arrives by accident or from a third party: the
owner typed it into their own file, about their own tools, on their own machine.
Dropping it removed the only way they had to say "stop asking me about this
tool", did so silently, and offered a remedy they could not discover. A product
may decline to honour a dangerous request; it should not quietly discard a
deliberate one and leave nothing in its place.

Not a goal

  • No dashboard control for mcp.honour_auto_approve. It belongs in Settings, and
    its absence is part of what made the old default hard to live with, but the key
    is now on by default, so the missing control no longer stands between anyone and
    the behaviour they asked for.
  • No per-server granularity. One boolean covers every server; a per-server map
    would let an owner honour their own list on one server while keeping the strict
    floor elsewhere, and nothing here forecloses that.
  • No change to allowedTools, the other route around the gate. It keeps its own
    ceiling filter, untouched.
  • No widening of the governance ceiling. A governed ref keeps nothing whatever
    this setting says, and making an owner's config able to widen an operator's
    policy is deliberately out of scope.

What changed (motivation -> approach -> change)

Where What it does now
src/kiro_crew/config/sections.py honour_auto_approve defaults to True, with help text naming what an autoApprove costs
src/kiro_crew/config/loader.py _build_mcp_config reads an ABSENT key as True
src/kiro_crew/platform/governance.py the honoured branch emits mcp_auto_approve_honoured; the ceiling branch is unchanged
config-baseline.json regenerated from the schema registry
docs/architecture/mcp.md, src/kiro_crew/docs/agent-spec-fields.md describe the new default and both audit events
docs/request-for-change/rfc-owner-written-mcp-auto-approve.md, docs/request-for-change/README.md the decision record and its index row
test/test_config_mcp_section.py, test/test_agent.py, test/test_computer_use_registration.py, test/test_app_mcp_scoping.py pin the default at both layers, the opt-out, the new event and the ceiling boundary

Goal: respect the owner's own statement about their own tools, without widening
anything an operator controls.

Approach: the mechanism was already there. strip_ungoverned_auto_approve has an
honoured branch gated on mcp.honour_auto_approve, so the change is the DEFAULT
rather than new logic, which keeps the strict floor reachable by one real false
instead of replacing it.

Change:

  • McpConfig.honour_auto_approve defaults to True, with help text that names
    what an autoApprove actually costs rather than only what the key does.
  • _build_mcp_config reads an ABSENT key as True. This is the load-bearing half:
    that builder sets the field on every load, so a default declared only on the
    dataclass never reaches a loaded config and the change would have been inert for
    every real install. A new test pins the default through the real load path,
    which is the test whose absence let that trap exist.
  • Honouring an owner-written list now emits mcp_auto_approve_honoured, beside
    the existing withheld event. Granting a gate exemption is as much a permission
    decision as revoking one, and until now only the revocation reached the security
    feed, so the calls that skip the gate left no trace of why they were allowed to.
    Only verbs no server spec declares are reported: what a spec declares is Kiro
    Crew's own emission, not the owner's decision.
  • The RFC recording the decision, and its row in the request-for-change index.

Deliberately unchanged: may_skip_gate_now. A governed ref keeps nothing whatever
the setting says, because the ceiling is the operator's policy loaded from a trust
root the agent process does not own, not a preference of whoever uses the machine.
No config value can widen it, and a test pins that the owner's choice loses to it.
allowedTools keeps its own ceiling filter, untouched.

Backwards compatibility

Compatible in the sense the checklist asks about: nothing is rejected, renamed or
removed, and no writer sweep is needed because no contract tightened. It is a
CHANGED DEFAULT, which is the reason the RFC exists.

What behaves differently: a host whose owner had written an autoApprove keeps it
on the next spec rebuild instead of losing it, so those tools stop prompting
again, and those calls do not reach hooks.on_tool_call. An operator who wants
every MCP call gated sets mcp.honour_auto_approve to false, which restores the
previous behaviour exactly. A host that never had an autoApprove sees no change,
which is the common case. Enterprise hosts with a governance ceiling are entirely
unaffected.

Tests

  • test_honour_auto_approve_defaults_to_on and
    test_an_absent_key_reads_as_on_through_the_real_load pin the new default at
    both layers, the second specifically through the loader that decides it.
  • test_a_real_false_opts_out and
    test_a_value_that_is_not_a_boolean_degrades_to_the_default pin the opt-out and
    what a hand-edited wrong type does.
  • test_refresh_keeps_a_user_added_auto_approve /
    test_existing_config_keeps_a_hand_added_mcp_auto_approve pin preservation on
    the two spec-writing paths; test_opting_out_drops_... and
    test_refresh_drops_a_user_added_auto_approve_when_opted_out keep the strict
    floor covered rather than deleting that coverage with the old default.
  • test_honouring_an_owner_written_list_emits_its_own_event,
    test_a_declared_list_is_not_reported_as_the_owners_decision and
    test_the_ceiling_still_wins_over_the_owners_choice pin the new audit event and
    the ceiling boundary.

Manual verification

Exit codes read from each checker itself, not through a pipe: mypy on the three
changed modules 0; black --check on every changed non-baselined file 0
(test/test_app_mcp_scoping.py is in .github/black-baseline.txt and was edited
by hand to match its existing style rather than reformatted); ./scripts/docs-lint.sh
0; and the 22 test files touching this filter or the key, 2258 passed, pytest exit
0. config-baseline.json was regenerated with
scripts/generate_config_baseline.py rather than hand-edited.

Also checked on a live host that the emitted ~/.kiro/agents/kirocrew.json
carries no autoApprove today and that the shared mcp.json declares none, so
the behaviour this changes is reachable only for an owner who wrote one.

Screenshots / video

N/A -- no frontend surface is touched. The setting has no dashboard control today,
which the RFC records as deliberately out of scope for this change.

Related Issues

N/A -- raised directly by the maintainer, whose decision the RFC records.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) -- the MCP architecture doc, the
    agent-spec-fields reference, the RFC and its index row
  • No secrets, credentials, or internal references in the diff

@bolichen97

Copy link
Copy Markdown
Contributor Author

Intent: Respect an autoApprove list the owner wrote themselves, in their own
mcp.json or agent file, instead of deleting it from the agent config Kiro Crew
writes and leaving them no way to express or recover the choice.
Not a goal: a dashboard control for the setting, per-server granularity, any
change to allowedTools, or letting an owner's config widen an operator's
governance ceiling.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ human override accepted

@bolichen97 overrode this lane for 77653dec78086260580b1b29e1a926a83c4d495d via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ human override accepted

Human judgment by @bolichen97 overrides the GPT 5.6 finding for 77653dec78086260580b1b29e1a926a83c4d495d; the recorded reason is authoritative for this commit.

[GPT-OVERRIDE] 77653de

This comment is updated in place on each push.

The model was not re-run because an authorized human decision supersedes it.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 77653dec78086260580b1b29e1a926a83c4d495d: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 77653dec78086260580b1b29e1a926a83c4d495d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

"Owner-written" is decided by absence of counter-evidence, so any unmarked, un-enumerated writer of the shared map inherits the gate exemption by default.

Watch

  • honour_owner_written defaults to True on strip_ungoverned_auto_approve (governance.py), so the safe direction requires the caller to remember to opt out. This PR's own history is the evidence: the fix commit exists because the first commit's honoured branch "tested 'no spec declared this' rather than provenance", and the bridges comment records three staleness rounds finding new app sources. A seventh call site that materializes a map from non-owner input silently honours a third party's autoApprove — a gate bypass with no card — whereas a fail-closed default (False, with the handful of owner-config writers passing True) fails toward an extra prompt instead. Same shape AGENTS.md forbids for harness identity: a negative test fails toward the permissive answer.
    Clears when: the parameter defaults to False and the owner-config write paths in agent.py/bridges.py opt in explicitly, or a pin (like the existing chokepoint source-inspection tests) forces every new caller to state the claim.
  • The RFC's boundary section names three non-owner writers (apps, <app>: entries, Kiro Crew's marker) but never the AGENT as a writer of ~/.kiro/settings/mcp.json. ~/.kiro/agents is write-fenced and sandbox-sealed precisely because a spec write is a self-arming channel, yet mcp.json — which the rebuild merges into that spec — appears in no fence I can find, and an agent-written entry is byte-identical to an owner-written one (mcp_provenance itself says the marker is "NOT a security boundary"). Under the old default the strict floor killed that route at rebuild; under the new default a prompt-injected agent's hand-added autoApprove survives the next restart and skips the gate. The residual may be acceptable (the SEL mcp_auto_approve_honoured event, and config.json was already the same trust class), but a permission-default RFC should record that writer and why it's out of scope — this is a decision gap to record, not a fence for review to demand.
    Clears when: the RFC's boundary section names the agent-written-mcp.json case and the maintainer's reason it is accepted or separately covered.

[DESIGN-REVIEWED] 77653de

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 77653dec78086260580b1b29e1a926a83c4d495d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 77653de

Verdict parsed from the review's SHA-scoped output markers for commit 77653dec78086260580b1b29e1a926a83c4d495d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 77653dec78086260580b1b29e1a926a83c4d495d: <one-sentence reason>

@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 Sep 27, 2026
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from 6da84f2 to a87dbe5 Compare September 27, 2026 07:13
@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 Sep 27, 2026
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from a87dbe5 to 7b80393 Compare September 27, 2026 07:26
@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 Sep 27, 2026
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from 7b80393 to 5e55a33 Compare September 27, 2026 07:28
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: 94bcda2f75 -> f2c732ecf2 (head 5e55a33e15), no conflicts and no file overlap with the base's new commit.

Reason it was needed even though the base moved in nothing this PR touches: the base carried test_slim_skills_do_not_regrow_duplicate_guidance_or_wire_model_ids[prepare-pr-68000] red (assert 68015 <= 68000, a byte-ceiling check on the prepare-pr skill) on both the Linux and the Windows shard 3, which failed Coverage Gate closed behind it. #14398 fixed that on main, and only a new base clears it here. On this head that file is 20 passed.

Re-verified after the rebase: 726 passed / pytest exit 0 across the 6 test files touching this filter, mypy 0 on both changed modules, comment-history gate passed.

@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 Sep 27, 2026
An autoApprove list the owner typed into their own mcp.json or agent file is a deliberate statement about their own tools, and the floor deleted it silently: the only remedy was an undocumented global boolean with no dashboard control, so the choice could be neither expressed nor recovered. mcp.honour_auto_approve now defaults to on and the list survives the spec rebuild.

The default had to move in the LOADER as well as on the dataclass field: _build_mcp_config sets the field on every load, so a default declared only on the field never reaches a loaded config and the change would have been inert for every real install. An absent key now reads as on; opting out still takes a real false, and a value of the wrong type is removed by the schema validator, so it reads as absent and the documented default applies.

The governance ceiling is untouched and still wins: a governed ref keeps nothing whatever the setting says, because the ceiling is the operator's policy from a trust root the agent process does not own, not a preference of whoever uses the machine. Granting an exemption is as much a permission decision as revoking one, so an honoured owner-written list now emits mcp_auto_approve_honoured beside the existing withheld event, naming only the verbs no spec declares.
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from 5e55a33 to 35e5ec1 Compare September 27, 2026 07:52
@bolichen97
bolichen97 requested a review from a team as a code owner September 27, 2026 07:52
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 27, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: f2c732ecf2 -> 6978ac04ef (head 35e5ec1c83), 2 commits replayed with no conflicts.

The base gained #14393, #14408 and #11121. green_age.py reported STALE on 43 files this PR also touches, all of them import-level overlap rather than the same lines, so the scoped re-run covers the modules on both sides: 1277 passed / pytest exit 0 across the 8 test files over this filter, agent config materialization, agent capabilities and crew teams. mypy 0 on both changed modules; comment-history gate passed.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 27, 2026
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from 35e5ec1 to b109751 Compare September 27, 2026 08:06
@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 Sep 27, 2026
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from b109751 to ed836eb Compare September 27, 2026 08:19
… list[str]

The honoured branch tested 'no spec declared this' rather than provenance, so an app manifest's autoApprove and a Kiro Crew authored entry inherited the exemption once the key defaulted on. Provenance is now PASSED by the two app writers, which alone know their keys are not the owner's -- a shipped agent spec picks its own server names and need not namespace them, so no test on the merged map could separate them. The name shape and the provenance marker remain as defence for the host writer, whose input is the owner's own config. A value that is not a list[str] is also declined: kiro-cli rejects it and no rebuild repairs the spec. All of them fall through to the strict floor.
@bolichen97
bolichen97 force-pushed the mcp-honour-autoapprove branch from ed836eb to 77653de Compare September 27, 2026 08:39
@bolichen97

Copy link
Copy Markdown
Contributor Author

Stopping the drive-to-green loop here and handing this to the maintainer: the blocking finding on 77653dec78 is correct, and it is not answerable by another patch on this branch.

The wall. "Owner-written" cannot be both DURABLE and POSITIVELY AUTHENTICATED on this codebase:

  • ~/.kiro/settings/mcp.json is durable, but it carries no sandbox mask and no read-only rule, so an agent write during a temporary approval window lands there and outlives the window. An absent x-kirocrew marker is then read as the owner's authorship, and mcp_provenance.py:14-18 says outright that the marker "is a declaration of who may write, NOT a security boundary".
  • ~/.kiro/agents/ IS sealed read-only against sandboxed processes, and sandbox.py:1006-1016 says that seal is "the enforcement the governance passes rely on" precisely because a process that can rewrite a spec "hands its next spawn forged grants". But the host agent spec is fully REGENERATED by install_agent with no user-edit preservation, so an owner's hand-edit there does not survive a rebuild.

So every source the honoured branch can reach is either agent-writable or not durable. Four rounds of narrowing (app manifest keys, the shipped agent spec's un-namespaced keys, the per-agent policy's servers keys, then the whole-map switch) each closed a real hole and none of them reaches this one, because this one is about the premise rather than the enumeration.

What is already fixed and stands on its own, whichever way the decision goes: the app-materialized map declines the opt-in outright; an app's <app>: entries in the shared file are named third-party; a value that is not a list[str] is declined (it would write a spec kiro-cli rejects, with no rebuild able to repair it); and the honoured path is audited.

The three options, for the maintainer. (1) Move the owner's statement into Kiro Crew's own owner-gated config.json as an explicit per-server verb allowlist, so provenance is stated rather than inferred, and keep mcp.json on the strict floor. (2) Keep honouring mcp.json and accept the injection window with a SHA-pinned /ai-review override gpt. (3) Drop the default flip and keep the strict floor.

Recommendation is (1): it honours the same intent without inferring authorship from a file the agent can write.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 77653de: Maintainer decision to accept the injection window; mcp.json stays the owner's own file and every honoured grant is audited.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@bolichen97 marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 77653dec78086260580b1b29e1a926a83c4d495d.

Maintainer decision to accept the injection window; mcp.json stays the owner's own file and every honoured grant is audited.

This decision applies only to this commit. A new push requires a new judgment.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 77653de: Maintainer decision to flip this default; the RFC recording it ships with the change.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@bolichen97 marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for 77653dec78086260580b1b29e1a926a83c4d495d.

Maintainer decision to flip this default; the RFC recording it ships with the change.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@bolichen97
bolichen97 enabled auto-merge (rebase) September 27, 2026 09:17
@chenmingwei23
chenmingwei23 merged commit e07ba83 into main Sep 27, 2026
97 of 99 checks passed
@chenmingwei23
chenmingwei23 deleted the mcp-honour-autoapprove branch September 27, 2026 10:12
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 27, 2026
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.

2 participants