Repository navigation
fix(claude): install intact user plugins through Claude settings, owned by the lock - #3290
Conversation
Register new plugins disabled via the qualified native CLI, preserve activation, and reconcile owned metadata from locked sources. Authenticated runtime qualification remains pending. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Read saved lock state, preserve parser-normalized legacy plugin types, and retain selector/preflight ownership while suppressing loose projection. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Cover user-hook migration, standalone and replay controls, full-source safety, interrupted ownership recovery and native transport metadata exclusion. Document qualified metadata versus pending runtime execution. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Fold independent PR3290 panel findings and observed CI failures. Exercise installed APM hook metadata lifecycle without native hook execution. Preserve canonical empty survivors until native cleanup succeeds, keep target-aware diagnostics, and document the missing runtime witnesses. Metadata protocol fixture extracted from Daniel Meppiel's command lifecycle test in commit 41bdcf1, preserving its metadata-only boundary. Co-authored-by: Daniel Meppiel <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a # Conflicts: # src/apm_cli/install/drift.py
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Refuse unsupported automatic migration through the existing hook owner. Exercise req-lk-021 byte preservation and malformed-state refusal with real component conformance cases; keep native runtime qualification open. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve retained-hook compliance and the canonical native replay seam. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Keep existing package and lockfile hash semantics unchanged. Provide one canonical raw-content and Git executable-bit fingerprint for native consumers. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Exercise complete publisher assets, Git executable bits, transport exclusions, symlink refusal, and unchanged historical package hashes without any native runtime. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Use the sole canonical native fingerprint API for admission, retained ownership, readback and read-only audit. Bind remote attestations to saved source pins, refuse unfingerprinted legacy adoption, and retain recoverable removal intent. Normalize local replay inputs only in scratch. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Exercise missing pins, independently callable pre-write checks, mixed-version removal recovery, normalization stability and real local CLI audit. Keep the pre-existing local MCP consistency diagnostic distinct from native drift evidence. Document audit scope and retained fingerprint boundaries. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Fold the independent CEO synthesis follow-up without weakening the generic MCP source-admission contract. Raw local legacy plugins can retain a separate config-consistency failure while their native fingerprint is healthy. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
APM Review Panel:
|
Preserve both native registrars, selected-format admission, audit replay and cleanup. Retain canonical native hashing and source-plan authority; cover combined target selection and defer the Claude phase import. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
The exact merged candidate emitted the required user-scope refusal, but Rich wrapped the phrase across a line. Normalize diagnostic whitespace while retaining the failure, wording and unchanged-native-state assertions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Keep dynamic function lookup through the existing pure lockfile_state owner. This removes a redundant function-local import and restores the unchanged 200-statement budget after the native merge, without changing cleanup or refusal behavior. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Share prepared native admission with batch skill preflight, verify local locks against the original source image, and inspect raw local MCP declarations in disposable validated snapshots. Keep Claude audit verification isolated from loose deployment replay and preserve independent cache fingerprints. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Integrate published #3290 d23d1ac and main 7e20 while preserving the independent #3181 command contracts and contributor ancestry. Native runtime acceptance remains unmet; this merge does not grant consent. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 583dd1bc-30be-41e1-b45e-a1dd8988136e
|
Published The resumed repair shares native admission with batch skill preflight, preserves same-name personal loose skills, checks local locks against original source snapshots, validates raw local MCP declarations in disposable scratch, and keeps complete Claude audit verification out of loose-deployment replay. The command companion #3291 consumed this public foundation; no private producer patch was required. Evidence: 424 functional and 120 static passes on the merged working tree; full conformance 517 passed / 2 skipped; 46 exact-head functional cases bind all 8 detected owners; full current lint mirror and strict guards pass. Four process-memory guard mutations produced 10 intended failures with zero errors before restoration. Current CI, spec conformance, and Merge Gate are successful at this head. The original lifecycle job completed 394 tests successfully, with 13 skips, then hit its 10-minute job deadline. Its one isolated retry passed in 511.37 seconds / 9:05 total job time. No timeout, selection or source was changed. The original cancellation remains recorded; historical 6/3/2 is preserved, with cumulative CI recoveries now 3. Acceptance remains blocked, not ready to merge. Normal native consent for the isolated owned fixture session is still absent. Actual Claude Code 2.1.291 Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors. |
Resolve two conflicts while keeping main's behavior and this PR's native Claude registration owner: - uninstall: keep main's _persist_uninstall_lockfile (symlink refusal, committed-claim binding, profile-scoped updates) and extend it with defer_empty_removal so an empty last-package lock is still retained until Claude native cleanup converges, then removed. - mcp_config_view: adopt main's #3540 redirect to the install-synthesized apm_modules/_local manifest for local Claude plugins (with missing-manifest warning and frozen cold-cache deferral). Drop the superseded scratch snapshot and retarget the marketplace-integrations-claude-ownership static guard and its mutation cases to main's redirect. Co-authored-by: Copilot App <[email protected]>
- Route uninstall lock persistence through main's guarded _persist_uninstall_lockfile call; a small helper persists survivors, converges native registrations, then removes an empty last-package lock, keeping uninstall() within its statement budget. - Extract _queue_native_claude so integrate_package_primitives stays within the C901 limit after combining main's changes. - Align the local Claude MCP read-only test with main's #3540 semantics: without the install-synthesized manifest, servers stay uncollected and the publisher source is never mutated. Co-authored-by: Copilot App <[email protected]>
Fold delta-panel follow-ups on the merge resolution: - _persist_lock_then_resync_native takes deploy_root, modules_dir and scope explicitly instead of forwarding **kwargs. - Unit traps for _persist_uninstall_lockfile defer_empty_removal branches and for removing an empty last-package lock only after native resync converges (mutation-break: no-defer -> 3 failures, unlink-before-resync -> 2 failures). Co-authored-by: Copilot App <[email protected]>
Native Claude check (10 minutes)This is the merge gate for #3181: Claude Code itself must load the plugin APM registered and run its namespaced command, with Requirements: macOS or Linux, 1. Isolated tools (about 3 minutes)export CHECK="$(mktemp -d /tmp/apm-native-claude-check.XXXXXX)"
export SHA="$(git ls-remote https://github.com/microsoft/apm refs/heads/danielmeppiel-claude-command-qualification | cut -f1)"
echo "check dir: $CHECK stack head: $SHA"
# Claude Code 2.1.291 is the only version APM's native route is qualified for.
npm install --silent --prefix "$CHECK/npm" @anthropic-ai/[email protected]
# APM from the #3290 + #3291 stack head.
if ! { uv venv -q "$CHECK/apm-venv" && uv pip install -q --python "$CHECK/apm-venv/bin/python" "git+https://github.com/microsoft/apm@$SHA"; }; then
# Fallback if uv cannot resolve from your index: run the stack source with
# the .venv of an existing microsoft/apm checkout.
export APM_REPO="$HOME/Repos/awd-cli"
git -C "$APM_REPO" fetch -q origin danielmeppiel-claude-command-qualification
git -C "$APM_REPO" worktree add -q --detach "$CHECK/apm-src" "$SHA"
mkdir -p "$CHECK/apm-venv/bin"
printf '#!/bin/sh\nPYTHONPATH="%s/apm-src/src" exec "%s/.venv/bin/python" -m apm_cli.entrypoint "$@"\n' "$CHECK" "$APM_REPO" > "$CHECK/apm-venv/bin/apm"
chmod +x "$CHECK/apm-venv/bin/apm"
fi
"$CHECK/apm-venv/bin/apm" --version # the version line ends with the first 9 chars of $SHA2. Isolated HOME and CLAUDE_CONFIG_DIRexport REAL_HOME="$HOME"
export HOME="$CHECK/home"
export CLAUDE_CONFIG_DIR="$CHECK/home/.claude"
export PATH="$CHECK/npm/node_modules/.bin:$CHECK/apm-venv/bin:$PATH"
mkdir -p "$HOME/.apm" "$CHECK/work"
claude --version # expect: 2.1.291 (Claude Code)3. Install the fixture plugin globally with APMcat > "$HOME/.apm/apm.yml" <<EOF
name: native-claude-check
version: 1.0.0
targets: [claude]
dependencies:
apm:
- git: microsoft/apm
ref: $SHA
path: tests/fixtures/native_claude_commands
EOF
(cd "$CHECK/work" && apm install -g --target claude --only apm)Expected output includes: claude plugin list --json
ls "$CLAUDE_CONFIG_DIR/commands" 2>&1 # expect: No such file or directory (no loose copies)Expected: exactly one entry, 4. Your consent: enable the pluginAPM never enables plugins. You do that: claude plugin enable apm-command-context@apm-claude --scope user5. Run the namespaced command in a real sessioncd "$CHECK/work"
APM_COMMAND_PROBE_MARKER="$CHECK/witness.jsonl" claudeIn Claude:
{"root":"<CHECK>/home/.apm/apm_modules/microsoft/apm/tests/fixtures/native_claude_commands","resource":"APM_NATIVE_COMMAND_CONTEXT","argument":"qualified-3181"}
6. Verify the witness (proof of success)python3 - "$CHECK" <<'PY'
import json, pathlib, sys
check = pathlib.Path(sys.argv[1]).resolve()
rows = [json.loads(l) for l in (check / "witness.jsonl").read_text().splitlines() if l.strip()]
assert len(rows) == 1, rows
row = rows[0]
assert row["resource"] == "APM_NATIVE_COMMAND_CONTEXT", row
assert row["argument"] == "qualified-3181", row
root = pathlib.Path(row["root"]).resolve()
assert root.is_relative_to(check / "home"), root
assert (root / "scripts/context.mjs").is_file() and (root / "resources/identity.txt").is_file(), root
print("[+] NATIVE CLAUDE CHECK PASSED")
print(" root:", root)
PYSuccess means the script prints Failure looks like one of these: Heads-up from the agent dry run: 7. Clean up(cd "$CHECK/work" && apm uninstall -g microsoft/apm/tests/fixtures/native_claude_commands)
claude plugin list --json # expect: []
export HOME="$REAL_HOME"; unset CLAUDE_CONFIG_DIR
[ -n "${APM_REPO:-}" ] && git -C "$APM_REPO" worktree remove --force "$CHECK/apm-src"
rm -rf "$CHECK"Then open a new shell so What the agent already verified at stack head Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors. |
Refs #3948. The 12 link-target changes the CDO moved out of #3996, plus the two #3290 links to the retired installing-from-marketplaces anchor. Prose unchanged. Co-authored-by: Copilot App <[email protected]>
A project that targets Claude or Copilot installs an eligible Claude plugin, or an Agent Plugin, intact: the approved root is copied to the committed .agents/plugins/<plugin>/, .agents/plugins/.claude-plugin/marketplace.json is generated, and the marketplace is declared with the relative path ./.agents/plugins under apm-p-<hash(apm.yml name)> in .claude/settings.json and/or .github/copilot/settings.json, following each dependency's targets. - Move #3290's reconcile out of the Claude registrar into the shared native_plugins owner (reconcile, binding, harnesses, claimants) and reuse its record, layout and settings writer. Ownership stays lock-only; all settings files are one rollback unit with the deployed roots. - Pin Copilot CLI 1.0.112's observed file precedence (.github/copilot over .claude) and refuse a foreign same-name marketplace in any file a harness reads. - Project locks record a path+bytes digest (interim helper, byte-identical to #3989's compute_native_plugin_pin; swap on rebase). - Move the Copilot Agent Plugin route onto the shared owner; copilot_plugins now only migrates a legacy apm-registration.json registration. - Keep req-tg-013 claimant selection, split install with a warning for ineligible plugins at project scope, and refusal of plugins that declare dependencies. - Wire install, uninstall, prune, approve and audit replay; retarget the ownership guard and owner registry. Fixes #3921 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
A project that targets Claude or Copilot installs an eligible Claude plugin, or an Agent Plugin, intact: the approved root is copied to the committed .agents/plugins/<plugin>/, .agents/plugins/.claude-plugin/marketplace.json is generated, and the marketplace is declared with the relative path ./.agents/plugins under apm-p-<hash(apm.yml name)> in .claude/settings.json and/or .github/copilot/settings.json, following each dependency's targets. - Move #3290's reconcile out of the Claude registrar into the shared native_plugins owner (reconcile, binding, harnesses, claimants) and reuse its record, layout and settings writer. Ownership stays lock-only; all settings files are one rollback unit with the deployed roots. - Pin Copilot CLI 1.0.112's observed file precedence (.github/copilot over .claude) and refuse a foreign same-name marketplace in any file a harness reads. - Project locks record a path+bytes digest (interim helper, byte-identical to #3989's compute_native_plugin_pin; swap on rebase). - Move the Copilot Agent Plugin route onto the shared owner; copilot_plugins now only migrates a legacy apm-registration.json registration. - Keep req-tg-013 claimant selection, split install with a warning for ineligible plugins at project scope, and refusal of plugins that declare dependencies. - Wire install, uninstall, prune, approve and audit replay; retarget the ownership guard and owner registry. Fixes #3921 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Refs #3948. Wave 3 of the 0.37 docs sweep, stacked on #3290: - lockfile-spec: native_plugin record row (name, root, fingerprint, marketplace; no harnesses) - uninstall: extraKnownMarketplaces cleanup and the real recovery hint - apm-usage/commands.md: global uninstall of native plugins, Claude user-plugin pins, hook keys on the publisher file, deprecated apm install --update, copilot/minimal compile fallback - cache.md: mark apm install --update deprecated - targets.md: apm update instead of apm deps update Co-authored-by: Copilot App <[email protected]>
Refs #3948. The 12 link-target changes the CDO moved out of #3996, plus the two #3290 links to the retired installing-from-marketplaces anchor. Prose unchanged. Co-authored-by: Copilot App <[email protected]>
Description
Reshaped per the 2026-11-19 #3094 design record and brief. Claude only, user scope.
apm install --global --target claudenow installs an eligible Claude plugin intact. Its hooks (#3191,process.env.CLAUDE_PLUGIN_ROOT) and commands (#3181,${CLAUDE_PLUGIN_ROOT}) find their own bundled files. APM never runs theclaudeCLI.~/.apm/apm_moduleskeeps the fetched source.native_plugin_files: native bundle minus.git, rootapm.ymland root.apm/) to~/.agents/plugins/<plugin>/, and generate~/.agents/plugins/.claude-plugin/marketplace.json.settings.json(CLAUDE_CONFIG_DIRhonored) with onlyextraKnownMarketplaces.<apm-u-hash>(directory) andenabledPlugins["<plugin>@<apm-u-hash>"]: true.Ownership comes only from
apm.lock.yaml. Each entry carries anative_pluginrecord{name, root, fingerprint, marketplace{name,path}}(the loading harness follows from the entry's targets); settings keys and roots are derived from the previous and next lock. There is no receipt file.trueonly when a key is absent, and keeps an explicitfalse, foreign entries and edited roots.MCP and LSP servers (
.mcp.json,.lsp.json,mcpServers,lspServers) are supported. Claude loads them from the plugin; the whole-plugin approval covers them; every declared MCP server goes through the org MCP checks (policy_checks.mcp_policy_checks, the one composition the install gate also uses). APM's MCP/LSP writers skip the Claude runtime for a natively routed dependency (native_service_runtimes) and retire any loose Claude entry they wrote earlier; other targets still get APM's copy.Refusals:
enforcement: block;warnreports and enables), or declared plugindependencies. Never a loose fallback.bin/, unknown manifest capabilities, manifest or server paths outside the plugin, and case-folded name collisions.Approval pin portability: the approval binds paths and bytes (#3989
compute_native_plugin_pin); the mode-including root digest still gates source, deployed copy and lock. Spec amendment 0.1.66 (revises req-na-005 in place; no count change) is folded here once #3989 lands.Dropped:
claude_plugins/client.py(CLI driving), the Claude version allow-list, theapm-registration.jsonledger and the disabled default. Registrations from earlier heads of this PR are migrated by a guarded cleanup.src/apm_cli/native_plugins/{record,layout,settings}.pyclaude_plugins/registrar.py(reconcile_claude_plugins,verify_claude_native_cache),claude_plugins/admission.py(park, refusals)deps/lockfile.py(native_pluginfield),install/phases/lockfile.py(records, carry-forward across a one-shot--targetwithout Claude)install/phases/claude_plugins.py,commands/uninstall/cli.py(pre-mutation snapshot and lock restore)utils/content_hash.py(native_plugin_files,compute_native_plugin_hash; #3918 hosts the canonical copy when it lands)Merge order: #3929 (landed) -> #3918 -> this PR. When #3918 merges I switch the hooks bool to
security.trust.admit_native_plugin(allow_executables, package_keys, plugin_root)and import its hasher. Until then the interim approval is the legacyallowExecutableshooks bool, and no new approval path is added.Issue and approved scope
Issue: Fixes #3191; Fixes #3181
Human scope-approval comment: #3191 (comment) (reshape, supersedes the CLI-driven route); companion record #3181 (comment). Review contact: Daniel Meppiel (@danielmeppiel).
Does this PR complete the issue? Yes, once the human runtime witness passes on this head; its recipe was sent to the coordinator. The #3094 design study observed a settings-only SessionStart on real Claude 2.1.322. The command and UserPromptSubmit witness at 4624e7f used the earlier CLI route, so neither is evidence for this head. Out of scope: project scope and Copilot (#3921), Codex (#3920), the plugin dependency resolver, README.
Type of change
Testing
Validation at the pushed head (macOS arm64):
uvx [email protected] checkandformat --checkover the CI lint scope: passed (2454 files).pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/...: 10.00/10.bash scripts/lint-auth-signals.shandbash scripts/lint-architecture-boundaries.sh: clean. The 2100-line andrelative_toguards: clean.APM_E2E_TESTS=1 pytest tests/integration/test_claude_native_hook_lifecycle.py: 7 passed. Covers two plugins whose realnodehooks resolve per-plugin roots, userfalseand foreign keys preserved, a one-shot--target codexkeeping Claude declarations,--frozen, audit tamper and mode drift, both failure-and-recovery paths, and a trapclaudeonPATHthat is never run.pytest tests/spec_conformance/test_native_activation_profile_reqs.py tests/unit/install/test_claude_native_*.py: passed. The req-na-001/006 waivers are skipped.pytest tests/unit tests/spec_conformance -n 8: 29017 passed, 14 failed. Each failure was rerun in isolation:test_ci_topologyandtest_targets_phase.test_is_tool_available.5b902f828. This head adds only the CHANGELOG line.apm install -g obra/superpowers(22f0b46) in an isolated HOME:~/.agents/plugins/superpowerswith noapm.yml,.apm/or.git, and all 4 hook files present.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. Section 5.2 gains thenative_pluginrow (fields, plus install/frozen/restore/audit timing), cited from req-na-002 and req-na-004. The req-na-002 digest exclusion is stated as unconditional (oci-rec-d1-1). No new anchors (amendment 0.1.65, docs(spec): add the OpenAPM native plugin activation profile (#3919) #3929).tests/spec_conformance/test_native_activation_profile_reqs.pybinds req-na-002 (known-answer digest vector and deployment), 003 (two keys, no subprocess), 004 (all 11 oracle cases, no receipt), 005 (parked, not declared) and 007 (per-APM-home name, binding refusal). req-na-001 (disclosure after the runtime witness) and 006 ([FEATURE] Codex: retire the app-server registration route; explicit split install #3920) stay waived.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.Co-authored-by: Copilot App [email protected]