Repository navigation
fix(install): --frozen applies the executables gate and MCP omission evidence - #3938
Conversation
…evidence apm install --frozen derived the current MCP view without the executables gate and without recorded mcp_omissions, so a lock that correctly recorded a gate-parked package server failed with 'missing from apm.lock.yaml'. CurrentMcpConfigView.select is now the one factory install, both frozen MCP checks and audit use to derive the view they compare with the lockfile. Once this run's gate has decided the view, recorded evidence must equal the evidence install would record now; audit keeps accepting structural evidence without re-checking approvals. The omission-evidence architecture rule requires every consumer to route through select and rejects raw derive or local view assembly. Fixes #3925 apm-spec-waiver: frozen MCP omission replay is APM install detail not enumerated by OpenAPM v0.1 Co-authored-by: Copilot App <[email protected]>
…zen-mcp-executables-gate
…3938) Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The frozen preflight fails to forward no_policy, causing apm install --frozen --no-policy to reject an admitted lock baseline when org policy denies a project-approved MCP server.
1 open issue
What changed in this PR
This PR addresses #3925, the frozen-install gap deferred from #3893, by routing install, frozen checks, and audit through a shared MCP configuration selection factory.
Changes:
- Applies the executables gate and validates recorded omission evidence during frozen checks.
- Centralizes MCP selection and strengthens architecture guards against bypasses.
- Adds regression coverage and documents the frozen omission contract.
| File | Description |
|---|---|
tests/unit/policy/test_ci_checks.py |
Updates the test double for selection options. |
tests/unit/integration/test_mcp_config_view.py |
Tests matching evidence, changed approval, and incorrect reasons. |
tests/unit/integration/test_frozen_mcp_evidence.py |
Supplies approval callbacks to hydrated checks. |
tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py |
Adds frozen omission and approval lifecycle coverage. |
tests/integration/test_architecture_mcp_omissions.py |
Adds guard-bypass mutation cases. |
src/apm_cli/security/executables.py |
Adds a lazy MCP gate with silent-check support. |
src/apm_cli/policy/ci_checks.py |
Routes audit through shared selection. |
src/apm_cli/integration/mcp_config_view.py |
Centralizes selection and validates current omission evidence. |
src/apm_cli/install/service.py |
Applies gating and evidence checks during frozen validation. |
src/apm_cli/install/phases/integrate.py |
Supplies the gate to post-hydration validation. |
src/apm_cli/install/mcp/integration.py |
Uses shared selection for install preparation. |
scripts/architecture_linter/checks/mutation_mcp_target_and_scope.py |
Guards selection routes and rejects bypasses. |
scripts/architecture_linter/checks/install_lsp_plugin.py |
Updates the guard for lazy approval resolution. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Documents frozen evidence matching. |
docs/src/content/docs/reference/lockfile-spec.md |
Clarifies frozen omission validation. |
docs/src/content/docs/reference/cli/install.md |
Documents the frozen executables gate. |
CHANGELOG.md |
Records the frozen-install fix. |
Review effort: Balanced
The pre-download --frozen check built its InstallRequest without no_policy, so the executables gate resolved org policy even under --no-policy and rejected an admitted lock baseline. Adds a CLI regression with an org deny_all policy. Addresses Copilot inline on src/apm_cli/install/service.py:439. Co-authored-by: Copilot App <[email protected]>
Folds the #3938 panel follow-ups. project_mcp_executables_gate in the executables owner now builds the gate for install, the frozen preflight and the hydrated frozen check, so building the allow map is no longer a call-site choice; the hydrated check reuses the pipeline's routed allow map. The view flag is renamed selection_replayed to name the exact-evidence regime. The omission-evidence rule now bans CurrentMcpConfigView.derive outside the owner and uninstall, approve=None outside audit, and raw MCP approval filtering outside the executables owner. Tests: gate laziness/silence unit test, no-write assertions on failed --frozen, and --frozen under an org deny_all policy. Addresses CEO follow-ups A1+S2, A2, A3, S1/T1, T2, T3. Co-authored-by: Copilot App <[email protected]>
…zen-mcp-executables-gate
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | All three concerns are resolved at 780e03c: one gate factory owns the allow map, the regime flag says what it means, and the guard is now an allowlist. |
| Supply Chain Security Expert | 0 | 0 | 0 | Both earlier concerns are resolved: frozen without --no-policy is tested against org deny_all, and the hydrated check reuses the pipeline's routed allow map. No new bypass. |
| Test Coverage Expert | 0 | 0 | 0 | All three gaps are closed: an e2e test for policy-on --frozen, a unit test for the gate's laziness and silence, and no-write assertions when --frozen fails. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 1 follow-ups
- [Python Architect] After merge, open a separate issue: pass
include_dependency_mcpto the frozenselectcalls, so thatapm install --frozen --only apmchecks the samemcp_omissionsthat--only apmrecords. -- This is outside the [BUG] apm install --frozen compares MCP config without the executables gate and omission evidence #3925 scope record and the behavior predates this PR.
Recommendation
Ship #3938 at 780e03c. All in-scope follow-ups and the Copilot finding are folded with mutation-break test evidence, and CI is green on the exact head. After merge, open the separate --only apm parity issue.
Folded in this run
- (Copilot) The frozen preflight
InstallRequestnow forwardsno_policy-- resolved in a7dacb9. - (python-architect A1 + supply-chain S2) One
project_mcp_executables_gatefactory for install, the frozen preflight and the hydrated frozen check -- resolved in 87cf7a4. - (python-architect A2) The flag is renamed
selection_replayed, with the selection inputs documented -- resolved in 87cf7a4. - (python-architect A3) Allowlist guard for
derive(,approve=Noneand raw MCP approval filtering, plus bypass cases -- resolved in 87cf7a4. - (supply-chain S1 / test-coverage T1)
--frozenunder an orgdeny_allpolicy: e2e test -- resolved in 87cf7a4. - (test-coverage T2) Unit test for gate laziness and silence -- resolved in 87cf7a4.
- (test-coverage T3) A failed
--frozenasserts the lock bytes are unchanged and nothing was deployed -- resolved in 87cf7a4.
Copilot signals reviewed
src/apm_cli/install/service.py:439-- LEGIT: the frozen preflight dropped--no-policy, so an admitted baseline was rejected under an org deny (resolved in a7dacb9).
Deferred (out-of-scope follow-ups)
- (python-architect) Pass
include_dependency_mcpto the frozenselectcalls for--only apmparity -- scope boundary: the [BUG] apm install --frozen compares MCP config without the executables gate and omission evidence #3925 record covers the gate and recorded omissions for the default selection; this behavior predates the PR.
Regression-trap evidence (mutation-break gate)
tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py::test_frozen_install_applies_executables_gate_and_omission_evidence-- failed on unfixed main 0e19cce (MCP server 'tools-server' is missing from apm.lock.yaml), passes with the fix.tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py::test_frozen_no_policy_gate_ignores_org_policy-- failed before a7dacb9 (no longer declared in apm.yml), passes after.tests/integration/test_package_mcp_executables_gate_lifecycle.py::test_org_deny_all_keeps_package_mcp_server_out-- withexecutable_context=(None, True)at the hydrated gate, the test failed as expected; guard restored.tests/unit/security/test_executables.py::TestProjectMcpExecutablesGate-- with the lazy gated-server check removed, the test failed as expected; guard restored.
Lint contract
ruff check and ruff format --check (ruff 0.15.12, CI paths), pylint R0801 (10.00/10), lint-auth-signals.sh and lint-architecture-boundaries.sh are all clean on 780e03c.
CI
All checks green on 780e03c: CI, Merge Gate, Spec conformance, CodeQL, NOTICE Drift and PR eligibility (0 CI fix iterations).
| PR | Head | Stance | Iterations | Folds | Deferrals | Copilot rounds | CI | Mergeable | Merge state | Notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3938 | 780e03c | ship_now | 2 | 7 | 1 | 2 | green | MERGEABLE | BLOCKED | pending required review |
Full per-persona findings
Python Architect
First pass (all folded in 87cf7a4):
- [recommended] The gate's allow-map input was built three different ways at the call sites, at
src/apm_cli/install/service.py:436. Folded: one owner factory. - [recommended] The
executables_gatedflag selected the evidence regime, but its name described only one input. Folded: renamedselection_replayed. - [recommended] The
derive(ban scanned only three files, andapprove=Nonewas allowed anywhere, atscripts/architecture_linter/checks/mutation_mcp_target_and_scope.py. Folded: allowlist.
Delta: No findings.
Supply Chain Security Expert
First pass (all folded in 87cf7a4):
- [recommended] No test checked that
--frozenwithout--no-policyapplies org policy. Folded. - [recommended] The pre-download gate read raw org policy and dropped trust diagnostics. Folded: shared factory, and the docstring now states the hydrated check is authoritative.
Delta: No findings.
Test Coverage Expert
First pass (all folded in 87cf7a4):
- [recommended] No e2e test ran
--frozenwith org policy active. Folded. - [recommended] The gate's laziness and silence had no unit test. Folded.
- [recommended] Failed
--frozensteps did not assert that nothing was written. Folded.
Delta: No findings.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.
CurrentMcpConfigView.select now takes McpAdmission instead of an approve callable plus trust_transitive_self_defined; install, both --frozen checks and audit admit through security/trust.py. Audit passes exact=False (structural evidence) and still re-checks consent. The omission-evidence rule pins the new routing; org deny-all records reason 'denied'. Drop the duplicated frozen CHANGELOG line (#3938 owns it). Refs req-sc-011, req-sc-016. Co-authored-by: Copilot App <[email protected]>
CurrentMcpConfigView.select now takes McpAdmission instead of an approve callable plus trust_transitive_self_defined; install, both --frozen checks and audit admit through security/trust.py. Audit passes exact=False (structural evidence) and still re-checks consent. The omission-evidence rule pins the new routing; org deny-all records reason 'denied'. Drop the duplicated frozen CHANGELOG line (#3938 owns it). Refs req-sc-011, req-sc-016. Co-authored-by: Copilot App <[email protected]>
CurrentMcpConfigView.select now takes McpAdmission instead of an approve callable plus trust_transitive_self_defined; install, both --frozen checks and audit admit through security/trust.py. Audit passes exact=False (structural evidence) and still re-checks consent. The omission-evidence rule pins the new routing; org deny-all records reason 'denied'. Drop the duplicated frozen CHANGELOG line (#3938 owns it). Refs req-sc-011, req-sc-016. Co-authored-by: Copilot App <[email protected]>
…utables (#3902) (#3918) * feat(security): portable, content-pinned approval for dependency executables Approvals in apm.yml executables.allow can pin each hook file and MCP server to a full SHA-256 of what runs. One owner, security/trust.py admit(), decides every dependency-declared executable item for install, update, install --frozen, apm audit --ci, apm approve and the install prompt; security/trust_fingerprint.py is the only hasher. The lockfile stays evidence only (mcp_omissions reasons definition-changed, denied). - apm approve lists what each package runs and records pins; a changed definition is parked with a re-approve message. - --trust-transitive-mcp stays a one-off and says it does not persist. - install --frozen applies the executables gate like install (#3893). - audit --ci fails servers the lock admits but apm.yml does not approve. - Native plugin hooks are admitted per hook file from the install dir. - Legacy true approvals still deploy and warn. - Guards: executable-item-admission, trust-fingerprint, mcp-admission. Spec: OpenAPM v0.1 amendment 0.1.64 adds req-sc-016 and extends req-sc-011 to frozen install. Refs #3902 Co-authored-by: Copilot App <[email protected]> * docs(changelog): number the #3902 entries (#3918) apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit Co-authored-by: Copilot App <[email protected]> * fix(security): fold panel review of #3918 into the trust owner - Native plugins: an org/project deny wins before any hook file is read, and per-file pins only narrow the package verdict (no empty-pin bypass). - One per-type verdict reader, trust.package_type_verdicts, now backs apm policy explain, approve --list/--pending, doctor, lockfile exec_status and native status; G1 forbids pin-blind resolvers outside security/. - One MCP enumerator feeds install, status and pins, so a changed pinned registry overlay reads as not deployed everywhere. - --trust-transitive-mcp never re-approves a changed self-defined server. - apm audit --ci discovers org policy like install (honoring --no-policy) and names an unavailable policy instead of passing silently. - apm approve prints success after the write, exits 1 on a refused pin or declined prompt, and hints the APM 0.37 requirement on the first pin. - Stale integration tests moved to the pinned shape; new lifecycle traps for --user vs audit, refusal exit code and uninstall survivors. Refs #3902 (req-sc-016, req-sc-011) Co-authored-by: Copilot App <[email protected]> * feat(security): approve native plugins with one whole-root pin A natively loaded plugin is approved as ONE item, executables.allow.<pkg>.plugin: sha256:<64 hex>, over the native plugin file set (path, exec bit, bytes; APM's root apm.yml and .apm/ excluded). Any byte or mode change parks the plugin with the re-approve hint. Per-file hook pins and the stray-file refusal leave the native path; split installs keep per-hook-file pins (D3). Seam for #3290: security.trust.admit_native_plugin(allow_executables, package_keys, plugin_root) -> Admission, and security.trust_fingerprint.native_plugin_fingerprint, delegating to utils.content_hash.compute_native_plugin_hash. Refs req-sc-016 (unchanged; MCP-only text). Co-authored-by: Copilot App <[email protected]> * test: assert every stored hook pin is a full fingerprint Co-authored-by: Copilot App <[email protected]> * fix(security): honour native plugin pins only on the native path Fold the supply-chain review of the whole-root plugin pin: - a plugin pin admits only a native install (admitted Copilot Agent Plugin or Codex bundle); a split install reads item pins, which apm approve now records beside the plugin pin; - with a pin, deny and the content hash are checked even when no executable type is detected; the native type set is one owner (native_root_exec_types); - decision A: an executable surface that references root .apm/ or apm.yml parks the plugin (apm-owned-reference) with one diagnostic naming the reference; - the dev-dependency lifecycle persists consent with apm approve before audit --ci (D6). Co-authored-by: Copilot App <[email protected]> * docs(spec): fold the apm-spec-guardian panel into req-sc-016 (0.1.64) - define the definition fingerprint: full sha256, never by prefix, from installed source, covering every launch-affecting field plus the resolved registry entry; unrecognized means not matching - (b) also admits a per-user req-sc-010 pin (manifest decides); a dependency's own manifest never grants - a stale pin is withheld even under the opt-in; trust.admit no longer lets --trust-transitive-mcp override a changed overlay pin - define the scope terms, (a) semantics, org denial over every path, the req-sc-010 relation and the MCP-only scope; disclose that the grant key and byte construction are implementation-defined - lifecycle: a lockfile depth edit cannot make a transitive server direct Refs req-sc-016, req-sc-011. Co-authored-by: Copilot App <[email protected]> * fix(install): route #3938's select factory through the trust owner CurrentMcpConfigView.select now takes McpAdmission instead of an approve callable plus trust_transitive_self_defined; install, both --frozen checks and audit admit through security/trust.py. Audit passes exact=False (structural evidence) and still re-checks consent. The omission-evidence rule pins the new routing; org deny-all records reason 'denied'. Drop the duplicated frozen CHANGELOG line (#3938 owns it). Refs req-sc-011, req-sc-016. Co-authored-by: Copilot App <[email protected]> * fix(security): fold Copilot review of #3918 into the trust owner - an existing MCP pin is checked even when the new declaration would not need approval (self-defined -> registry no longer bypasses it); the pin probe is policy-free, so no extra org policy discovery - the admission subject fingerprints the authored declaration, as apm approve pins it - apm approve --list/--pending report a transitive server that a legacy mcp: true leaves parked, matching install (D2) Refs req-sc-016. Co-authored-by: Copilot App <[email protected]> * fix(security): fold the delta panel into the native trust owner - every native install (pinned or not) is decided once by admit_native_plugin, over one type set (IR and manifest types passed as extra_types); the caller-side hook overrides are gone - root .apm/ content that is not a byte copy of a pinned plugin file, or a symlink, parks the plugin (apm-owned-reference); approve refuses it with exit 1 and --pending says it cannot be approved - a transitive native plugin with MCP needs the plugin pin (D2); admit_native_plugin gains keyword-only transitive and extra_types - a malformed pin store falls back to the full context, which reports it - denied items point at apm policy explain, not apm approve; the native listing says which split-install item pins it also records - lifecycle: registry rewrite of a pinned server parks, legacy mcp: true shows in --pending, real per-file pins never register a native plugin Refs req-sc-016. Co-authored-by: Copilot App <[email protected]> * fix(security): a bare grant map keeps the native gate on admit_native_plugin read a plain allowExecutables mapping without a routed trust context as gate-off and admitted an unapproved Codex bundle; build a gate-on context from the map so it fails closed (req-sc-009, test_codex_consumer_denies_unapproved_manifest_referenced_mcp). Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: Copilot App <[email protected]>

Description
apm install --frozenderived the current MCP view without the executables gate and without the recordedmcp_omissionsevidence. A lock that correctly recorded a gate-parked package server (reason: unapproved-executables, added in #3893) therefore failed withMCP server 'mysrv' is missing from apm.lock.yaml, althoughapm installandapm audit --ciboth accept it.Root cause: three consumers assembled the view themselves. Install called
deriveand thenwith_unapproved_executables. Audit calledderiveand thenwith_recorded_omissions. Frozen calledderiveonly.Fix, routed through the one
CurrentMcpConfigViewowner:CurrentMcpConfigView.select(..., approve=, recorded=)is the single factory that install, both frozen MCP checks (pre-download and post-hydration) and audit now use.approveandrecordedare required keyword arguments. Audit passesapprove=Nonebecause it does not re-check approvals (out of scope). Install passesrecorded=Nonebecause it records new evidence.security/executables.pygainsmcp_executables_gate(...). It resolves the allow map lazily, only when a gated server exists. A frozen check builds the gate without a logger, so it adds no duplicate "Filtered" warning.executables_gated), recorded evidence must equal the evidence install would record now. As a result, stale evidence, missing evidence, a different reason, or a server approved since the lock was written all fail--frozen. Audit keeps its existing structural acceptance.mutation_writes.mcp_omission_evidencerule (guardhooks-integrations-mcp-omission-evidence) now requires install,service.py(both frozen checks),phases/integrate.pyand audit to route throughselectwith the gate and evidence they need. It also rejectsCurrentMcpConfigView.derive(in those consumers and.with_recorded_omissions(/.with_unapproved_executables(anywhere outside the owner. The existing registryMutationCasestill covers this guard (the matrix allows one case per guard). New bypass cases were added intests/integration/test_architecture_mcp_omissions.py.Issue and approved scope
Issue: Fixes #3925
Human scope-approval comment: #3925 (comment) (Review contact Daniel Meppiel (@danielmeppiel))
Does this PR complete the issue, or what remains? It completes the scope. Out of scope, per the record: audit re-checking approvals between
apm approveand reinstall, and any change to the omission evidence format.Type of change
Testing
Reproduction on main 0e19cce, real CLI with isolated HOME/APM_HOME:
apm installexits 0 and recordsmcp_omissions: {mysrv: {reason: unapproved-executables}}.apm install --frozenthen exits 1 withMCP server 'mysrv' is missing from apm.lock.yaml. After the fix:apm install --frozenexits 0, prints one "Filtered" warning, andapm audit --cipasses all 10 checks.Validation evidence (exact commands and results):
APM_BINARY_PATH=.venv/bin/apm .venv/bin/python -m pytest -p no:xdist -q tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py -k frozen-> 1 failed (MCP server 'tools-server' is missing from apm.lock.yaml)... tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py-> 5 passedAPM_BINARY_PATH=.venv/bin/apm .venv/bin/python -m pytest -p no:xdist -q tests/integration/test_mcp_omission_lifecycle.py tests/integration/test_frozen_native_service_lifecycle.py tests/integration/test_frozen_local_path_lifecycle.py tests/integration/test_frozen_no_rewrite_e2e.py tests/integration/test_architecture_lsp_plugin.py tests/integration/test_architecture_mcp_omissions.py tests/unit/scripts/test_architecture_runner.py-> 142 passed, 1 skippedAPM_BINARY_PATH=.venv/bin/apm .venv/bin/python -m pytest -p no:xdist -q tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py tests/unit/integration/test_mcp_config_view.py tests/unit/integration/test_frozen_mcp_evidence.py tests/unit/install/test_frozen.py tests/unit/install/test_frozen_service_boundary.py tests/unit/policy/test_ci_checks.py tests/unit/security/test_executables.py-> 377 passed.venv/bin/python -m pytest -p no:xdist -q tests/unit/install/test_lsp_integration.py tests/unit/install/test_mcp_integration_extraction.py tests/unit/policy/test_ci_skill_subset_replay.py tests/unit/install/test_copilot_project_mcp_destination.py tests/unit/install/test_mcp_only_lockfile_creation.py tests/unit/install/test_frozen_roots.py tests/spec_conformance/test_mcp_omission_inventory.py-> passed (included in a 356 + 164 pass run before the merge)uvx [email protected] checkandformat --checkonsrc/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py-> clean.pylint R0801-> 10.00/10.bash scripts/lint-auth-signals.sh-> clean.bash scripts/lint-architecture-boundaries.sh-> exit 0. No covered file exceeds 2100 lines.The lifecycle test (installed CLI) covers each of these cases: a correct omission record passes
--frozen; a stale declaration fingerprint fails; missing evidence fails; approval added in apm.yml without reinstall fails; and after reinstall the approved server compares normally and is deployed.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.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
mcp_omissionsreasons are APM lockfile detail that OpenAPM v0.1 does not enumerate (commit carriesapm-spec-waiver).