Skip to content

fix(plugins): keep root skills/ bundles typed skill_bundle; owner-only native plugin copies - #4126

Merged
Daniel Meppiel (danielmeppiel) merged 8 commits into
mainfrom
danielmeppiel-plugin-skill-bundle-type
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 8 commits into
mainfrom
danielmeppiel-plugin-skill-bundle-type

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Two regressions from #3290 (native Claude plugins), found by release validation on main 1b96706b7d (run 44697560532, "Integration Tests (network, linux x86_64)", deterministic over 3 retries). Bisect: the network test passes at 8160ec3cc8 (before #3290) and fails at d8eb528c5f (the #3290 merge).

  1. Package type precedence. install/legacy_plugin_compat.preserve_normalized_marketplace_plugin_type retyped a normalized plugin cache detected as skill_bundle to marketplace_plugin on the cached second pass. The change it came from (4a34515) intended only to stop the parser-generated apm.yml from masquerading as an authored apm_package. A root skills/ bundle keeps skill_bundle, as documented (lockfile --skill subsets apply only to skill_bundle rows), so only apm_package is retyped now.

  2. Native plugin copy modes (Plugin bin/ deploy: trust-posture, producer docs, and hardening follow-ups (from #1591 review panel) #1620 item 3). native_plugins/layout.deploy_plugin copied with shutil.copy2, so a shipped 0o4755 bin/ tool kept setuid and group/other bits under ~/.agents/plugins/<p>/. Deployed files are now owner-only. The native fingerprint records only the owner-execute bit, which is kept, so no lock or approval changes.

  3. Same release validation, frozen and shared-skill suites (merge_group only). Bisected to fix(claude): install intact user plugins through Claude settings, owned by the lock #3290: tests/integration/test_frozen_remote_plugin_lifecycle.py (26 failures) and test_shared_skill_preservation_lifecycle.py::test_native_skill_and_legacy_plugin_share_only_member_ownership[*-user] (2) pass at 8160ec3cc8 and fail at d8eb528c5f. The frozen failures are the same skill_bundle precedence regression and pass with fix 1. The shared-skill user cases are a stale oracle: at user scope the legacy Claude plugin now installs intact (approved fix(claude): install intact user plugins through Claude settings, owned by the lock #3290 design), so the two packages share member ownership only at the Codex root; the user-scope case now asserts that root.

Issue and approved scope

Issue: Refs #3191

Human scope-approval comment: the #3191 scope record (native Claude plugins, #3290); this restores behavior #3290 did not intend to change. Release-validation repair requested by the 0.37 delivery manager.

Does this PR complete the issue, or what remains? It fixes two regressions introduced by #3290; #3191 itself is already fixed.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Evidence:

  • APM_E2E_TESTS=1 APM_RUN_INTEGRATION_TESTS=1 GITHUB_APM_PAT=... pytest tests/integration/test_plugin_e2e.py: 27 passed (was 1 failed on main: test_lockfile_records_package_type).
  • Same env, tests/integration/test_frozen_remote_plugin_lifecycle.py tests/integration/test_shared_skill_preservation_lifecycle.py: 54 passed (were 28 failed at the fix(claude): install intact user plugins through Claude settings, owned by the lock #3290 merge).
  • New tests/unit/install/test_legacy_plugin_compat.py::test_normalized_plugin_with_root_skills_keeps_skill_bundle_type (2 cases); restoring the old {APM_PACKAGE, SKILL_BUNDLE} set fails both.
  • TestPluginBinDeployPermissionsE2E::test_install_global_deploys_plugin_bin_as_0700 now asserts the native plugin root; removing the new chmod fails it.
  • Unit: test_legacy_plugin_compat, test_claude_native_registration, test_claude_native_admission, test_plugin_parser, test_architecture_invariants: 224 passed.
  • Lint mirror: ruff check/format (0.15.12) clean, pylint R0801 10.00/10, lint-auth-signals clean, lint-architecture-boundaries exit 0.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour (req-na-002 root digest unchanged: it records only the owner-execute bit).

…y native plugin copies

Two #3290 regressions found by release validation (run 44697560532):

- legacy_plugin_compat.preserve_normalized_marketplace_plugin_type retyped
  a normalized plugin cache detected as skill_bundle to marketplace_plugin
  on the cached second pass. Its intent was only to stop the parser's
  generated apm.yml from masquerading as an authored apm_package; a root
  skills/ bundle keeps skill_bundle (and --skill subsets), as documented.
  Fixes tests/integration/test_plugin_e2e.py::TestPluginNetworkE2E::
  test_lockfile_records_package_type.
- The native plugin copy used shutil.copy2 and kept setuid and
  group/other bits on a shipped bin/ tool (#1620 item 3). Deployed files
  are now owner-only; the fingerprint records only the owner-execute bit,
  which is kept. The bin permission e2e now asserts the native plugin root.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 08:07

Copilot AI 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.

🟡 Changes recommended

The fingerprint fast path bypasses permission correction for existing native installations, leaving unsafe modes such as 0o4755 unchanged after upgrade or reinstall.

1 open issue
What changed in this PR

This PR repairs two regressions from native Claude plugin support: incorrect classification of root skills/ bundles and overly permissive deployed file modes.

Changes:

  • Preserve skill_bundle classification during normalized-cache detection.
  • Restrict newly copied native plugin files to owner-only permissions while preserving owner execute.
  • Add classification regression tests, update the deployment test to check the native plugin root, and document the fixes.
File Description
tests/​unit/​install/​test_legacy_plugin_compat.py Tests bundle classification with and without a locked type.
tests/​integration/​test_plugin_e2e.py Checks executable permissions at the native plugin destination.
src/​apm_cli/​native_plugins/​layout.py Removes group/other permissions and special bits from copied files.
src/​apm_cli/​install/​legacy_plugin_compat.py Limits normalized-cache reclassification to apm_package.
CHANGELOG.md Records both fixes under Unreleased.

Review effort: Balanced

Comment thread src/apm_cli/native_plugins/layout.py Resolved
…dex root

At user scope a Claude plugin installs intact through Claude settings
(#3290), so a native skill and a legacy plugin share member ownership only
where the plugin still projects loose (Codex). The frozen remote plugin
lifecycle failures from the same release validation are fixed by the
skill_bundle precedence fix in this PR.

Co-authored-by: Copilot App <[email protected]>
The fingerprint fast path returned before any mode change, so a plugin
deployed at 0o4755 before the #1620 guard kept its setuid and group/other
bits after an upgrade. _owner_only() now enforces the postcondition on the
staged copy and on an unchanged deployed root (symlinks not followed); the
fingerprint, which records only the owner-execute bit, is unchanged.

Regression: an already-deployed 0o4755 tool with a matching fingerprint is
0o700 after redeploy, with changed=False (POSIX only).

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 133e4e4 into main Nov 20, 2026
32 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-plugin-skill-bundle-type branch November 20, 2026 10:00
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Fold [Unreleased] into the untagged [0.37.0] - 2026-11-20 block. Contributor, CI and test-only lines are dropped per the cut-release DROP list; exact duplicate lines from parallel merges are removed; the #4126/#4276 plugin-type lines are merged; the #4187 placeholder now names #4271. pyproject.toml is already 0.37.0. Refreshed again on the final release train; its train merge on main is the RC SHA.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Fold [Unreleased] into the untagged [0.37.0] - 2026-11-20 block on the final release train. Contributor, CI and test-only lines are dropped per the cut-release DROP list; exact duplicates from parallel merges are removed; the #4126/#4276 plugin-type lines are merged; the #4187 placeholder names #4271. pyproject.toml is already 0.37.0. The train merge on main is the RC SHA.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
Fold [Unreleased] into the untagged [0.37.0] block on the final release train. Contributor, CI and test-only lines are dropped per the cut-release DROP list; exact duplicates from parallel merges are removed; the #4126/#4276 plugin-type lines are merged; the #4187 placeholder names #4271. pyproject.toml is already 0.37.0. The train merge on main is the RC SHA.

Co-authored-by: Copilot App <[email protected]>
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