Repository navigation
fix(install): lockless MCP evidence follow-ups (#4801) - #4818
Merged
Daniel Meppiel (danielmeppiel) merged 8 commits intoNov 23, 2026
Merged
Daniel Meppiel (danielmeppiel) merged 8 commits into
Daniel Meppiel (danielmeppiel) merged 8 commits into
Conversation
… entries on every install MCP write evidence is now keyed by (runtime, config file, native key), so each COPILOT_HOME profile keeps its own record; retirement and audit only examine records of the selected config. Local bundle installs record the MCP entries they write. With a lockfile, install announces each entry it kept earlier until it is removed or declared again. Unusable evidence met by an install without apm.lock.yaml is noted next to the evidence file, so apm audit --ci keeps reporting it after the lockfile is rewritten, until that file is removed. Lifecycle cells cover the four cases; bug-ledger row 4801. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 22, 2026 21:04
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Receipt handling still produces incorrect or missing kept-entry warnings and stale audit failures, while the fallback sidecar writer can follow symlinked ancestors into an external directory.
4 open issues
What changed in this PR
This PR extends APM's lockless MCP cleanup to preserve evidence across runtime profiles, record local-bundle writes, and keep unresolved entries visible after lockfile regeneration.
Changes:
- Keys write evidence by runtime, config file and native key, and journals local-bundle MCP writes.
- Persists unusable-evidence notes and adds kept-entry announcements to later installs.
- Adds regression coverage, updates lifecycle obligations, and documents the behavior.
| File | Description |
|---|---|
tests/unit/install/test_mcp_write_receipts.py |
Tests profile isolation, persistent evidence notes and repeated notices. |
tests/quality/lifecycle_obligations.json |
Updates regression witnesses and requires user-scope profile coverage. |
tests/lifecycle/scenarios/test_mcp_write_receipts.py |
Adds lifecycle scenarios for lock regeneration, profiles and bundles. |
tests/fixtures/lifecycle_bug_ledger/bugs/4801.json |
Records the failure modes and regression tests. |
src/apm_cli/policy/ci_checks.py |
Reports noted unusable evidence after lockfile regeneration. |
src/apm_cli/install/mcp/write_receipts.py |
Adds per-config identities, persistent notes and announce-only reporting. |
src/apm_cli/install/mcp/integration.py |
Invokes receipt reporting when a lockfile governs cleanup. |
src/apm_cli/install/local_bundle_handler.py |
Journals local-bundle MCP writes. |
packages/apm-guide/.apm/skills/apm-usage/governance.md |
Updates audit behavior and remediation guidance. |
docs/src/content/docs/reference/cli/install.md |
Documents evidence isolation and persistent reporting. |
docs/src/content/docs/reference/baseline-checks.md |
Clarifies kept-entry audit conditions and remediation. |
changelog.d/4818.fixed.md |
Summarizes the user-visible fixes. |
Review effort: Balanced
…ckless-mcp-followups
…4818) apm-spec-waiver: MCP write evidence notes, per-config keying and kept-entry reporting are local client state; no manifest, lockfile or resolver contract changes Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The unusable-evidence fallback can write outside the metadata root through symlinked ancestors, and warning and kept-entry announcement gaps remain across install paths.
6 open issues
Announce kept entries after named MCP installs · New Warn on all recognized unusable-evidence errors · New Validate sidecar path containment before writing Stop announce-only warnings when a server is redeclared Replace stale keyless receipts after a usable rewrite Report kept entries during bundle installs
Review effort: Balanced
…ckless-mcp-followups
…ckless-mcp-followups
This was referenced Nov 22, 2026
… directory The note next to unusable MCP write evidence is written only when no component between the evidence owner's anchor (above APM_HOME) and the note is a link, matching the check that refused the evidence itself. Co-authored-by: Copilot App <[email protected]>
…ckless-mcp-followups
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-4801-lockless-mcp-followups
branch
November 23, 2026 01:11
This was referenced Nov 23, 2026
Antonin Rouxel (Antonin-Rouxel-LaPoste-BGPN)
pushed a commit
to anrouxel/apm
that referenced
this pull request
Nov 23, 2026
The microsoft#4802 revert (microsoft#4855) and microsoft#4818 landed together and took the file to 2101 lines. The restored _encode call takes one formatted line, as it did before the revert; no behavior change. Co-authored-by: Copilot App <[email protected]>
Antonin Rouxel (Antonin-Rouxel-LaPoste-BGPN)
pushed a commit
to anrouxel/apm
that referenced
this pull request
Nov 23, 2026
…ept reporting Reporting accuracy for kept entries from lockless MCP write evidence (microsoft#4861, deferred from microsoft#4818). Nothing is removed differently: - apm install <bundle>, apm install --mcp NAME and apm mcp install NAME announce kept entries (announce-only) against the lockfile's complete managed-server set, through one helper, announce_kept_mcp_writes; - a located rewrite supersedes the key-less record of the same runtime, config and name, so a retired entry leaves no stale notice or audit finding; - announce-only skips a server redeclared on the same native key, as retirement already does; - every recognized unusable-evidence reason (OSError, path traversal) is announced on a lockless install, not only a parse error. Six red-first cells. Fixes microsoft#4861 Co-authored-by: Copilot App <[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
Follow-ups to #4760 (lockless MCP write evidence) covering the four open cases in #4801:
apm.lock.yamlfinds unusable evidence (an edited entry or a missing record), it writes a<key>.json.unusablenote next to the evidence file.apm audit --ci(kept-mcp-entries) reads that note, so the report survives a regenerated lockfile until the file is removed.COPILOT_HOMEprofile keeps its own evidence. Records are keyed by (runtime, config file, native key). Retirement and audit only look at records for the selected config file, so one profile never changes another.local_bundle_handler/mcp/integrationnow record the MCP entries a local bundle writes, so an install without a lockfile can retire them like any other entry.retire_undeclared_mcp_writesstill runs in announce-only mode and prints "Kept MCP server ..." until the entry is removed or declared again.Docs:
reference/cli/install.md,reference/baseline-checks.md, apm-guidegovernance.md.Issue and approved scope
Issue: Fixes #4801
Human scope-approval comment: #4801 (comment)
This PR completes the issue.
Type of change
Testing
These lifecycle cells in
tests/lifecycle/scenarios/test_mcp_write_receipts.pyfail on base 32c476d (the #4760 head) and pass at this head:test_a_kept_entry_stays_reported_after_the_lockfile_is_rewritten[unusable-evidence]test_a_kept_entry_stays_reported_after_the_lockfile_is_rewritten[edited]test_each_copilot_home_profile_keeps_its_own_evidencetest_a_local_bundle_mcp_entry_is_retired_without_the_lockfileThere are also unit tests in
tests/unit/install/test_mcp_write_receipts.py, covering per-config keying and the unusable note. At user scope, the lifecycle driver rejectsaudit --ci, so a unit test covers the audit path for the profile case. Bug-ledger row:tests/fixtures/lifecycle_bug_ledger/bugs/4801.json. Lifecycle obligations regenerated:pair|SCOPE=user|MCPOWN=copilotis now required.Lint mirror ran clean: ruff 0.15.12 check and format, pylint R0801,
lint-auth-signals.sh, architecture boundaries, complexity ratchet,tests.quality.taxonomy --changed,check_test_assertions.py, andtests.lifecycle.generator --check.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regenerated