Skip to content

Fix native Agent Plugin audit replay for Copilot targets - #3257

Merged
Daniel Meppiel (danielmeppiel) merged 13 commits into
microsoft:mainfrom
bodapatisaikrishna:fix/native-plugin-audit-replay-3214
Oct 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 13 commits into
microsoft:mainfrom
bodapatisaikrishna:fix/native-plugin-audit-replay-3214

Conversation

@bodapatisaikrishna

Copy link
Copy Markdown
Contributor

Fixes #3214

Reconstructs canonical package info through the native agent plugin loader during audit replay, activates the registration scope for resolved targets, and allows native plugins to omit apm.yml in MCP config consistency checks.

Added integration tests covering install, reinstall, audit lifecycle, non-mutation, and drift detection.

When auditing a project that installs a native Agent Plugin for GitHub Copilot, drift replay previously failed because package reconstruction omitted canonical IR and the replay loop ran without the native registration capability active. In addition, projects omitting apm.yml in the plugin root were flagged by the MCP config consistency check.

Reconstruct canonical PackageInfo through the native agent plugin loader during replay, activate native_registration_scope for the target set, and recognize Agent Plugins in _allows_missing_manifest.

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 target-exclusion test passes on an unsupported-option error without exercising replay.

1 open finding
What changed in this PR

Fixes native Copilot Agent Plugin audit replay for #3214 by rebuilding canonical package information through the native loader.

Changes:

  • Restores native plugin loading and target registration during replay.
  • Allows native plugins without apm.yml in MCP consistency checks.
  • Adds lifecycle, read-only, and drift regression tests.
File Description
tests/​integration/​test_native_plugin_audit_lifecycle.py Adds native plugin audit lifecycle coverage.
src/​apm_cli/​integration/​mcp_config_view.py Accepts native plugins without apm.yml.
src/​apm_cli/​install/​drift.py Reconstructs native plugin information and handles target exclusion.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…r3257-convergence-20261019

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Addresses Copilot inline 4297452221 and panel follow-ups for microsoft#3214. Exercise real target exclusion, preserve native validation failures, verify native registration and read-only lifecycle artifacts, and guard canonical replay routing. Document the remaining native cache integrity limitation rather than treating clean audit as an attestation.

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
Address the delta panel read-only regression gap with a real registry configuration gate. Bind snapshots to the actual config owner and prove read_only=False changes user state. Preserve prior exact-head evidence across faithful main integration.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Address CI recovery: unify PackageInfo assembly and remove duplicate legacy fallback construction without changing behavior or raising the install engine budget. Move the real replay target-exclusion witness under req-tg-011, whose native boundary it exercises; no waiver or new normative requirement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Record the existing req-tg-011 replay witness in the generated conformance statements. Runtime behavior and test implementation are unchanged.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
@danielmeppiel

Copy link
Copy Markdown
Collaborator

Thanks Sai krishna Bodapati (@bodapatisaikrishna). The corrective changes are published on your existing branch at 194b110a8c1d071c64b3b4196ea12e31ace13ec7; your original commit remains in the history.

Changes and validation

  • Replaced the unsupported audit --target false-positive test with real replay target exclusion, now covered by existing req-tg-011.
  • Regenerated the corresponding conformance statements; no policy waiver was used.
  • Preserved canonical native validation errors, verified real native registration, and added matching-type/cold-cache MCP and read-only configuration coverage.
  • Local validation: 368 tests passed on this head, the full lint mirror passed, and eight mutations were killed by assertion failures, including behavioral plus static witnesses for canonical routing and read-only replay.
  • Related audit reference and packaged usage guidance were updated. The focused documentation review found no additional issues.
  • CI: all current-head technical workflows passed: CI, Spec conformance, docs, CodeQL, NOTICE, and aggregation gate. The two Linux shards passed 24,560 tests; Spec conformance passed 322 tests.

Remaining scope question

The installed CLI still reports a clean audit after a native cached skill under apm_modules/_local/ is modified or deleted. Existing project-managed skill drift tests do fail meaningfully, but they do not prove native-cache integrity. Documentation disclosure is not an acceptance waiver.

The accepted scope requires meaningful managed-content failures and excludes ownership redesign. Daniel Meppiel (@danielmeppiel), that boundary needs clarification before this is treated as complete. The final advisory is ship_with_followups, not ship_now; it does not waive the acceptance gap.

The original Copilot thread is now outdated but remains unresolved; its test correction is included in the published changes. No reviewers were requested, and no merge was attempted.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@bodapatisaikrishna

Copy link
Copy Markdown
Contributor Author

Makes sense to treat native cache integrity under apm_modules/ as a followup, given that auditing dependency cache contents touches the broader ownership model outside #3214. Happy to help tackle that once this lands.

Reconcile the packaged command guide with a strict three-way merge while preserving both branches' guidance.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve native whole-unit ownership and compare local canonical scratch copies or existing remote package digests without modifying live state.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Use owned local Git remotes and isolated environments for both manifest forms. Keep the read-only guard test double faithful to the integration result contract.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve the replay module budget by moving the unchanged native verification helper beside admission, with the existing static owner guard and behavioral witnesses updated together.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve the landed flat Claude command-type repair without changing native cache verification.

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
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

Native Agent Plugin cache changes and missing files now fail audit through the existing canonical ownership and replay paths.

panel-mode=delta; personas=python-architect,test-coverage-expert,supply-chain-security-expert,doc-writer,apm-ceo

cc Sai krishna Bodapati (@bodapatisaikrishna) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- the supplemental advisory is ready for review.

All four reviewers returned no findings. The earlier native-cache integrity gap is now repaired within the accepted scope, rather than deferred or exempted. Local native packages use canonical source-to-cache comparison; remote native packages use the locked content hash and fail closed when integrity evidence is missing or mismatched. The helper relocation preserves the existing authority and behavior.

Panel summary

Persona B R N Takeaway
Python architect 0 0 0 Canonical owner routing and helper relocation remain consistent.
Test coverage expert 0 0 0 Installed-CLI integrity and replay contracts cover the repaired behavior.
Supply-chain security expert 0 0 0 Containment and integrity checks fail closed without a new execution path.
Documentation writer 0 0 0 Audit guidance describes verification, remediation and its limits accurately.

Counts describe findings, not approval authority.

Current verification

  • Exact reviewed head: 945919d9da0cd2a235090ae6c811e11979af7ff4, incorporating main a30aeb39f3c0ff5e3b849529c42c09b5c9cc515f. The contributor's original commit is retained.
  • The worker's exact-head suite passed 343 tests. A separate independent verification passed 20 selected tests, with no failures, errors or skips. These overlapping selections are not presented as 363 unique tests.
  • Four mutation guards produced 18 expected failures at production-identical 76197a4; their restored witnesses pass at the current head. Canonical-owner v2 verification binds 63 executed functional test cases.
  • Full current lint and architecture checks passed. The parent also reran the literal trusted-main YAML, portable-path and 2100-line guards.
  • All six technical workflows now succeed at this head: CI, aggregation, CodeQL, docs, NOTICE, and Spec conformance.

Review provenance: this publishes the genuine existing delta recommendation, not a newly executed panel. Architecture/security review was carried by verified byte/AST identity; the test reviewer inspected the final head while its suite was still running. Completed JUnit results were verified afterward by the convergence worker and independent verifier. CI was pending when the CEO recommendation was issued and is now separately observed successful.

Recommendation

ship_now for this bounded repair. No panel-sourced follow-ups remain. This does not claim native catalog/settings integrity or live Copilot runtime qualification. The original intended issue disposition is unchanged; this advisory itself does not close #3214.

Full per-persona findings

Python architect

No findings.

Test coverage expert

No findings.

Supply-chain security expert

No findings.

Documentation writer

No findings.

This panel is advisory; the maintainer controls publication.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 331d420 into microsoft:main Oct 20, 2026
23 checks passed
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.

[BUG] apm audit --ci drift check fails for a native Agent Plugin: "canonical IR is missing"

3 participants