Repository navigation
fix(trust): native plugin mcp.json executables owned by trust.py; approve sees them (#4042) - #4058
Merged
Daniel Meppiel (danielmeppiel) merged 12 commits intoNov 20, 2026
Merged
Conversation
…rove sees them (#4042) security/trust.py is now the single source of a native plugin's executable types. native_plugin_exec_types derives an Agent Plugin's root mcp.json types from the loader IR itself (mcp, plus bin for a server that runs a command), so install/exec_gate.py no longer passes caller-supplied extra_types and native_declared_types is gone. apm approve, approve --pending/--list and apm policy explain read the same set through native_declaration, so a plugin whose only executable is its root mcp.json is listed, approvable and pinned instead of 'not found'. A partial type-level grant names the missing grant when it parks the plugin. Fail-closed is unchanged. The install-deployment-executable-item-admission guard rejects native type derivation outside trust.py, with mutation cases. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…rom trust.py (#4042) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…t message (#4042) Docs re-home after #3996: | Page here | After #3996 | | --- | --- | | reference/cli/approve.md | reference/cli/approve.md (unchanged path) | | consumer/copilot-agent-plugins.md | consumer/install-plugins.md | Co-authored-by: copilot-swe-agent[bot] <[email protected]>
8 of 15 tasks
Resolutions: admit_native_plugin keeps main's one_off and transitive gate-off path and drops extra_types (trust.py owns native types); approve.py keeps main's user_scope in _is_native_plugin; the #4042 mutation fragment now anchors on main's one_off line; copilot-agent-plugins.md was deleted by #3996 (re-homed next commit). Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4042) consumer/copilot-agent-plugins.md was folded into consumer/install-plugins.md by #3996; the Agent Plugin row now carries the note. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
#4058 fixes #4042, so #4040's strict known failure for gate cell b would XPASS; remove it. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
install_portable_trust.py: keep #4025's inventory-wide guard; approve.py routes keep the native_declaration calls (#4042), and native plugin type derivation outside trust.py stays rejected. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…orks (#4042) #4040's spine reached update and deny with the plugin still pending because approve never took effect for a root-mcp.json Agent Plugin. With #4042 fixed the plugin is approved there, so the required update|plugin|pending and deny|plugin|pending cells went unvisited. Revoke and reinstall the plugin before update to keep them covered. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
6 of 14 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 11:46
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 11:46
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Without a lockfile, approve --pending and --list still omit Agent Plugins whose only executable is root mcp.json, requiring canonical plugin detection and a no-lockfile regression test.
1 open issue
What changed in this PR
This PR addresses #4042 by centralizing native plugin executable detection in security/trust.py, so install and approval views use the same types for Agent Plugins with a root mcp.json.
Changes:
- Routes native plugin admission, approval listings, and summaries through the shared trust owner.
- Reports missing executable grants and documents whole-plugin approval.
- Adds lifecycle and architecture regression coverage, replacing the resolved expected failure.
| File | Description |
|---|---|
tests/unit/copilot_plugins/test_pr2705_folds.py |
Uses on-disk Agent Plugin fixtures for native admission tests. |
tests/integration/test_mcp_portable_approval_lifecycle.py |
Covers MCP-only approval, changed content, partial grants, and URL-only servers. |
tests/integration/test_generated_gate_state_machine.py |
Adjusts the sequence after plugin approval starts working. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds mutations checking native type ownership and approval routing. |
tests/integration/_gate_machine_kit.py |
Removes the expected failure for #4042. |
src/apm_cli/security/trust.py |
Owns native executable types and missing-grant details. |
src/apm_cli/security/executables.py |
Includes native types in executable detection and summaries. |
src/apm_cli/install/native_plugin_admission.py |
Uses trust-owned types to gate registration. |
src/apm_cli/install/exec_gate.py |
Removes caller-derived types and enriches blocked declarations. |
src/apm_cli/install/deployment_plan.py |
Displays incomplete-grant parking reasons. |
src/apm_cli/commands/approve.py |
Adds native types before filtering installed packages. |
scripts/architecture_linter/checks/install_portable_trust.py |
Guards centralized native type derivation. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Updates approval guidance for root MCP definitions. |
docs/src/content/docs/reference/cli/approve.md |
Explains native MCP and binary grant requirements. |
docs/src/content/docs/consumer/install-plugins.md |
Documents Agent Plugin executables and approval. |
CHANGELOG.md |
Records the user-visible approval fix. |
Review effort: Balanced
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
… -g (#4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
With no apm.lock.yaml, approve's fallback scan has no recorded package_type, so a root-mcp.json-only Agent Plugin was not marked native and dropped from --pending/--list. Ask the canonical loader (detect_agent_plugin) instead. Adds a no-lockfile lifecycle case. Addresses review thread on approve.py:1085. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-4042-native-trust
branch
November 20, 2026 12:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
TL;DR —
apm approvecould not see a native Agent Plugin whose only executable is its rootmcp.json. Install parked the plugin, butapm approve <path>said "not found",--pendingsaid everything was approved, and{mcp: true}still parked it because of a hiddenbintype.security/trust.pyis now the single source of a native plugin's executable types, and install, approve,--pending/--list,policy explainand the pin summary all read that one set. Fail-closed behaviour is unchanged.Important
Rebase after #4025 (P5a). #4025 rewrites the same
admit_native_plugin(...)calls ininstall/exec_gate.py(closed_exec_map(...)). This PR's exec_gate hunk only drops theextra_types=lines, removesnative_declared_types, and wraps the blocked declaration, so the conflict is a two-line rebase. #4044 (stacked on #4025) touches exec_gate ~108-121, which this PR does not.Warning
Pre-merge: after #4040 lands, remove the strict xfail for gate cell b (#4042) in #4040's
tests/integration/test_generated_lifecycle_state_machine.pyas part of the rebase onto main (this fix makes that cell XPASS).Problem (WHY)
On main 67936cd, with the installed CLI:
apm install./pkgs/npparked (gated_pending_approval)apm approve ./pkgs/npnot found in installed packages, exit 0apm approve --pendingAll packages with executables are approved.apm approve --list/apm policy explainnot foundexecutables.allow: {./pkgs/np: {mcp: true}}security/executables.pyscan_package_executablescounts MCP only fromapm.yml, soapprove.pydropped the plugin at itshas_executablesfilter.trust.native_plugin_exec_typeslooked for.mcp.json, not the Agent Pluginsmcp.json.mcp/binfrom outside the owner (exec_gate.native_declared_types→extra_types=), so install and approve saw different sets.Approach (WHAT)
security/trust.py(executable-item-admission)agent_plugin_exec_types(root)derivesmcp, plusbinfor a command server, from the Agent Plugins loader IR (a rootmcp.jsonthe loader cannot read still counts asmcp).native_plugin_exec_types(root)includes it; theextra/extra_typesparameters are gone.native_declaration(decl, root)puts that set on anExecutableDeclaration. A partial grant parks withdetailnaming the missing types.security/executables.pyExecutableDeclaration.native_exec_typesfeedshas_executables,exec_typesandsummary_line.install/exec_gate.pynative_declared_typesandextra_types=removed; the blocked declaration carries the native set.install/native_plugin_admission.pytrust.native_plugin_exec_types; its local IR-type helper moved to trust.install/deployment_plan.pyParked native plugin <pkg>: not approved (missing grant: bin).commands/approve.pynative_declarationto native plugins before thehas_executablesfilter.scripts/architecture_linter/checks/install_portable_trust.pyextra_types=,native_declared_types(anddef agent_plugin_exec_types(outside trust.py, and requires the new routes.Trade-offs
bincomes from the loader's executable classification (what install already used), so it is not re-derived and the bin policy is unchanged (out of scope per the record).has_mcp/has_hookswere dropped from exec_gate because trust's manifest scan already reads.codex-plugin/plugin.jsonmcpServers/hooksand thehooks/dir. The Codex lifecycle suites stay green.apm_owned_referencedoes not scan the rootmcp.jsonfor.apm/references (pre-existing; separate issue if wanted).Issue and approved scope
Issue: Fixes #4042
Human scope-approval comment: #4042 (comment) (
eligibility.cjs:record-present,contact_confirmation_needed: false)Completes the issue: every Done-when item is covered below.
Type of change
Testing
Scenario evidence
mcp.jsonplugin is parked, listed by--pending/--list/policy explain, approved by a whole-plugin pin, registered, parked again whenmcp.jsonchanges, and re-approvedtests/integration/test_mcp_portable_approval_lifecycle.py::test_native_plugin_with_only_a_root_mcp_json_is_approvable{mcp: true}alone parks and namesbin;{mcp, bin}admits...::test_native_plugin_mcp_grant_alone_parks_and_names_the_missing_binbin...::test_native_plugin_url_mcp_server_needs_no_bin_grantMutationCases (install-deployment-executable-item-admission) intests/integration/test_architecture_owner_rule_mutations.pyFails on main (installed CLI,
APM_BINARY_PATH=.venv/bin/apm, run before the fix):After the fix
tests/unit/copilot_plugins/test_pr2705_folds.py: the native fixture was aSimpleNamespaceIR with no plugin root. It is now a real Agent Plugin written by the existingwrite_agent_pluginbuilder, because types come from disk via trust.py.Full
tests/unitlocally: the remaining failures are environment-only in this sandbox (commit signing, Unix install ownership, network guard). I re-ran each non-obvious one on main, and they fail identically there. CI is the authority.Lint contract (
.apm/instructions/linting.instructions.md, HEAD up to date with main): ruff check, ruff format --check, pylint R0801 10.00/10,lint-auth-signals.shclean,lint_architecture_boundaries.py --root .exit 0.How to test
APM_BINARY_PATH=$PWD/.venv/bin/apm uv run --extra dev pytest tests/integration/test_mcp_portable_approval_lifecycle.py -q -k "root_mcp_json or missing_bin or url_mcp"→ 3 passed (3 failed on main).uv run --extra dev pytest tests/integration/test_architecture_owner_rule_mutations.py -q -k 4042→ the 3 guard mutations are caught.Changelog
## [Unreleased]inCHANGELOG.md: user-visible effect first, 25 words or fewer, ending with(#PR); breaking changes only under upgrade notes; no Highlights; see.github/instructions/changelog.instructions.md.Docs are in ONE isolated last commit (
reference/cli/approve.md,consumer/copilot-agent-plugins.md, apm-usagecommands.md). Docs re-home after #3996:reference/cli/approve.mdreference/cli/approve.md(same path)consumer/copilot-agent-plugins.mdconsumer/install-plugins.mdSpec conformance (OpenAPM v0.1)
Co-authored-by: Copilot [email protected]