Repository navigation
mcp: judge registry overlays against each target's row - #5821
Open
Daniel Meppiel (danielmeppiel) wants to merge 9 commits into
Open
Daniel Meppiel (danielmeppiel) wants to merge 9 commits into
Daniel Meppiel (danielmeppiel) wants to merge 9 commits into
Conversation
Registry remote headers are stored in the list form at the overlay step, so every writer and the env-reference owner read one shape; the owner also reads both forms directly. --frozen now counts a registry server whose dependency overlay the install refused, matching the install. apm-spec-waiver: MCP owner hardening covered by the #5773 scope record; no OpenAPM requirement changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…of the same name An overlay header now replaces a registry header with the same name (case-insensitive) instead of sitting beside it, so the refusal owner and every writer see the overriding value. An empty override keeps the published header, as before. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A registry dependency's header overlay applies only to a remote, so its refusal is excused from --frozen claims when the declared transport is remote, never for stdio, and is deferred to the payload check when no transport is declared. An env overlay still decides alone. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The overlay pairs that need the fetched payload are excused from the claim filter and the unclaimed ones seed the existing --frozen deferral; the owner applies each server's targets selection and native runtimes, as the claim filter does. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A registry server without a dependency overlay reaches the writers only through _overlaid_server_infos; this pins that its mapping-form headers are stored as list entries and render and judge like the list form. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A registry server's overlay is now checked against each installed target's env-reference row, not only the dependency rule, so --frozen excuses or defers the same pairs the install skips. Targets follow the server's targets selection minus native runtimes. apm-spec-waiver: MCP owner refinement covered by the #5773 scope record; no OpenAPM requirement changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
changed the base branch from
mcp-exec-refusal-headers
to
main
December 3, 2026 02:16
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Header-only refusal logic mishandles HTTP and stdio payload fallbacks, allowing installs to bypass frozen ownership checks or fail frozen replay.
1 open issue
What changed in this PR
Builds on #5814 to align registry-overlay refusal checks with each target’s environment-reference rules and frozen-install ownership checks.
Changes:
- Evaluates overlays per target and scope, respecting target selection and native runtimes.
- Normalizes registry headers and adds deferred payload confirmation.
- Adds regression coverage and updates header-shape assertions.
| File | Description |
|---|---|
tests/unit/test_mcp_integrator_overlay.py |
Expects normalized header entries. |
tests/unit/test_mcp_env_reference_headers.py |
Covers header forms, target rows, and refusal classification. |
tests/unit/test_github_mcp_auth_policy.py |
Checks value types in normalized headers. |
tests/unit/test_github_mcp_auth_policy_logic.py |
Updates overlay provenance assertions. |
tests/integration/test_mcp_integrator_install_flow.py |
Updates merged-header expectations. |
tests/integration/test_mcp_dependency_overlay_refusal_lifecycle.py |
Exercises refusal and frozen replay through the CLI. |
tests/fixtures/lifecycle_bug_ledger/bugs/5773.json |
Registers new lifecycle regressions. |
src/apm_cli/mcp_env_reference.py |
Adds per-target overlay refusal classification. |
src/apm_cli/integration/mcp_integrator.py |
Normalizes headers and merges case-insensitive overrides. |
src/apm_cli/integration/mcp_integrator_install.py |
Normalizes fetched registry headers before use. |
src/apm_cli/install/service.py |
Connects deferred overlay checks to frozen ownership enforcement. |
changelog.d/5814.fixed.md |
Documents header normalization and frozen-install behavior. |
Review effort: Balanced
This was referenced Dec 3, 2026
A declared transport does not show whether the fetched payload keeps a remote, so a header-sourced overlay refusal is always deferred to the existing payload confirmation under --frozen; an env overlay still decides alone. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 3, 2026
This branch has not been deployed
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-up to #5814, in the same owner (
apm_cli.mcp_env_reference). It builds on #5814 and lands after it; until #5814 merges, this diff also shows #5814's commits (its own change is the last commit).refused_pairsandoverlay_refusal_pairs_to_confirmjudged a registry server's overlay only by the dependency rule. Install, meanwhile, judges it against each target's env-reference row (_exec_refusal). For a row with anexec_prefix,--frozencould therefore report a missing claim for a server the install skipped. Now:_overlay_refusalsbuilds the overlay stubs once per server (through_apply_overlay, with no payload) and judges each installed target with_exec_refusal(env_reference(target, user_scope), stub). That covers both the dependency rule and the target row.stdio, and with no declared transport it is deferred to the existing payload confirmation.targets:selection minus native runtimes, for both functions.overlay_refusal_pairs_to_confirmgainsuser_scope; the one call site ininstall/service.pystays on one line (the file stays at 1000 lines).No row on
mainsetsexec_prefix, so behaviour on existing targets is unchanged.Issue and approved scope
Issue: Refs #5773
Human scope-approval comment: the #5773 apm-scope record v3 (comment 7349125162).
Does this PR complete the issue, or what remains? #5773 was completed by #5777; this refines the shared owner.
Type of change
Testing
tests/unit/test_mcp_env_reference_headers.py)test_a_target_row_exec_prefix_judges_a_root_registry_overlay[env-value](refused)...[remote-header](refused)...[undeclared-header](deferred to confirm)...[stdio-header](not excused)user_scopeargument)test_a_target_without_an_exec_prefix_leaves_a_root_overlay_alone[*]native_runtimesexclusion in_overlay_refusalsmakestest_a_native_runtime_target_yields_no_overlay_pairfail (Extra items in the left set: ('env', 'cursor')). With the exclusion restored, 22 passed.monkeypatch.setitem(ENV_REFERENCES, ...)); no owner function is patched.pirow gives remote header refused, undeclared deferred, env refused, stdio not excused, with cursor unaffected; 31 owner cells pass.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.There is no user-visible change on released targets: no shipped row sets
exec_prefix, and #5814's Fixed line already covers--frozen.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedAgent assessment
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com