Repository navigation
fix(install): install --frozen -g verifies native plugin files before writing - #4423
Merged
Merged
Conversation
… writing `apm install --frozen --global` now checks each locked native plugin root against its recorded fingerprint in the frozen hash verification, before any write. A mismatch exits 1 naming the plugin, the expected and observed digests and `apm install --global`, as `apm audit --ci` reports it; nothing is written. A plain install that restores a changed root prints a [!] line. The lifecycle I1 oracle treats a path under a native_plugin root as recorded only when the same lock records that root, the observation is user scope and the tree carries the record's fingerprint. Four gate cells become required; six org-policy cells stay strict under #3703. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 16:55
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
GateReplay.observe() skips fingerprint verification when a locked plugin root is deleted and no managed paths remain, allowing a missing deployment to escape detection without regression coverage.
1 open issue
What changed in this PR
This PR adds native-plugin integrity checks to global frozen installs, aligning drift rejection with apm audit --ci and addressing #4225.
Changes:
- Rejects changed native plugin roots before deployment and reports when a plain install restores them.
- Extends lifecycle lockfile checks to recognize fingerprint-verified native roots at user scope.
- Adds regression coverage and updates gate expectations, leaving user-scope organization-policy failures tracked under #3703.
| File | Description |
|---|---|
src/apm_cli/install/service.py |
Adds native-plugin drift checks to frozen-install enforcement. |
src/apm_cli/claude_plugins/registrar.py |
Detects deployed drift and reports restored plugin roots. |
tests/lifecycle/oracles.py |
Recognizes native-root ownership through scope and fingerprint checks. |
tests/lifecycle/machines/test_m_gate.py |
Adds native-root ownership and mismatch cases. |
tests/integration/test_claude_native_hook_lifecycle.py |
Tests frozen rejection, state preservation, and restoration. |
tests/lifecycle/security/test_gate_removal.py |
Records user scope in lifecycle observations. |
tests/lifecycle/security/gate_slices/native.py |
Promotes fixed native-plugin cases and reassigns remaining failures. |
tests/lifecycle/security/gate_slices/bin.py |
Promotes fixed marketplace executable cases and reassigns remaining failures. |
tests/quality/generated_obligations.json |
Synchronizes required cases and known failures. |
tests/fixtures/lifecycle_bug_ledger.json |
Records #4225 regression coverage. |
CHANGELOG.md |
Documents frozen-install native-plugin verification. |
Review effort: Balanced
Comment on lines
+422
to
+423
| if not under: | ||
| continue |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…plugin files before writing Co-authored-by: Copilot App <[email protected]> # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json
…LOC budget The registrar returns DeployedHashDrift rows, so the frozen gate reports them through its existing reason lines; each names the plugin root, both digests and 'apm install --global'. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…plugin files before writing Co-authored-by: Copilot App <[email protected]>
…lper (AQ003) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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
apm install --frozen --globalnow verifies locked native plugin files before writing anything, so it gives the same verdict asapm audit --ci.Before this change, when files under a native plugin root (
~/.agents/plugins/<name>/) no longer matched thenative_pluginfingerprint inapm.lock.yaml:apm audit --ciexited 1 and named the plugin.apm install --frozen --globalexited 0, rewrote the root and printed "Deployed files verified against apm.lock.yaml".Changes:
InstallService._enforce_frozen_deployed_hashes, pre-deploy pass). It checks every locked native plugin root throughclaude_plugins.registrar.native_deployed_drift, which applies the fingerprint audit's drift check uses (verify_claude_native_cache).--frozen: deployed files do not match the hashes recorded in apm.lock.yaml.- native plugin '<name>' (.agents/plugins/<name>): expected sha256:..., observed sha256:...; run 'apm install --global' to restore it.reconcile_claude_plugins). Whenapm install --globalreplaces a root whose locked fingerprint did not change, it prints[!] Restored ~/.agents/plugins/<name>: its files differed from apm.lock.yaml.tests/lifecycle/oracles.py, reviewed by the Stream T lead). A managed path counts as recorded only when all three hold:native_pluginrecord for the root the path lies under;Observation.user_scope, default False, set byGateReplay.observe);A mismatch is its own I1 violation, and paths outside every root still fail. 4 unit cases in
tests/lifecycle/machines/test_m_gate.py, one negative per condition.Native plugins deploy only at user scope (
install/exec_gate.pyplugin_bin_deployable;NativePluginRecord.rootis under the user's.agents/plugins), so there is no project-scope variant.Cells
Required +4 (previously known-failing under [BUG] The user lockfile does not record the bin/ files a marketplace plugin deployed #4225):
G|marketplace-install|local-deny|binG|marketplace-install|revoke-approval|binG|native-plugin|local-deny|nativeG|native-plugin|revoke-approval|nativeKnown -10 +6. All 10 [BUG] The user lockfile does not record the bin/ files a marketplace plugin deployed #4225 entries leave
known_failing. Six org-policy rows stay strict, re-keyed to the open User-scope (-g) org policy source: govern global installs consistently #3703:G|marketplace-install|org-deny|bin,G|marketplace-install|org-enables-gate|bin,G|marketplace-install|policy-dep-deny|binG|native-plugin|org-deny|native,G|native-plugin|org-enables-gate|native,G|native-plugin|policy-dep-deny|nativeThese six are not new failures. With the I1 gap closed they still fail on I4: an org policy change leaves user-scope deployments in place, because
-ginstalls discover no org policy (User-scope (-g) org policy source: govern global installs consistently #3703).tests/quality/generated_obligations.jsonis updated to match.Issue and approved scope
Issue: Fixes #4225 (scope record: #4225 (comment))
Human scope-approval comment: the scope record above.
Does this PR complete the issue, or what remains? It completes #4225. The org-policy gap at user scope stays with #3703.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Red before:
APM_E2E_TESTS=1 pytest -n 0 "tests/integration/test_claude_native_hook_lifecycle.py::test_frozen_install_verifies_native_plugin_files_like_audit"failed withsrc/stashed: the frozen install exited 0.Green after: that test and
test_plugin_with_root_skills_deploys_bin_natively_after_approve_and_trustpassed (2 passed). The new test also checks:audit --ciexits 1;[!]line, and a later frozen install passes.Oracle unit cases:
pytest -n 0 tests/lifecycle/machines/test_m_gate.py -k i1_: 4 passed.Gate rows:
APM_E2E_TESTS=1 pytest tests/lifecycle/security/test_gate_removal.py -k "marketplace-install and bin or native-plugin": 4 passed, 6 xfailed (strict).Quality checks:
pytest tests/quality/test_gate_cell_obligations.py tests/quality/test_promise_obligations.py tests/quality/test_lifecycle_bug_ledger.py: passed.tests/integration/test_native_plugin_cache_audit.py: 8 passed.Lint mirror:
uvx [email protected] check/format --checkon the changed files: passed.lint-auth-signals.sh: clean.lint-architecture-boundaries.sh: exit 0.check_complexity_ratchet.py --base-ref origin/main: clean.Changelog
## [Unreleased]inCHANGELOG.mdSpec conformance (OpenAPM v0.1)