Skip to content

fix(install): configure Cursor and OpenCode MCP servers at user scope - #3100

Merged
Daniel Meppiel (danielmeppiel) merged 27 commits into
microsoft:mainfrom
alvedder:feat/user-scope-cursor-opencode-mcp
Oct 15, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 27 commits into
microsoft:mainfrom
alvedder:feat/user-scope-cursor-opencode-mcp

Conversation

@alvedder

@alvedder Alexei Vedernikov (alvedder) commented Sep 29, 2026 •

Copy link
Copy Markdown

Description

apm install -g treats Cursor and OpenCode as workspace-only MCP runtimes, so global installs skip them (Skipped workspace-only runtimes at user scope: cursor, opencode). Both harnesses do read a user-level MCP config: Cursor loads ~/.cursor/mcp.json and OpenCode loads ~/.config/opencode/opencode.json. APM already deploys other primitives to these user roots, for example OpenCode skills to ~/.config/opencode/skills/. Only MCP was refused.

This PR makes both adapters user-scope capable:

  • Adapters: CursorClientAdapter and OpenCodeClientAdapter set supports_user_scope = True, resolve their user-scope config paths, and create the user-level directory when needed. Project scope keeps the existing opt-in: APM still writes only when .cursor/ or .opencode/ exists.
  • Cleanup: MCPIntegrator.remove_stale finds the scope-resolved file through static config_path_for helpers. apm uninstall -g and stale cleanup therefore remove the entries without constructing an adapter or registry client.
  • Discovery: user-scope runtime discovery takes OpenCode's presence signal from its target profile's user root (~/.config/opencode).
  • Permissions: writes are atomic and files are owner-only (0600), as in the Gemini and Kiro adapters. Cursor retains native runtime environment references and authored static/source-relative values; this does not restore eager environment substitution.
  • No data loss: APM skips the write, warns, and reports the target as failed whenever rewriting would lose data. This includes unparseable/non-object configs (such as OpenCode JSONC comments), invalid server maps, unreadable user configs, and symlinked user paths. The symlink rule matches the stale-cleanup guard from fix: harden global lifecycle state handling #2655; legitimate HOME aliases remain supported.
  • Docs: the MCP target table, user-scope config locations, --global reference, apm-guide commands.md, user-scope warning text, and CHANGELOG entry.

Behaviour changes at project scope, for reviewers:

  • An existing .cursor/mcp.json or opencode.json that APM cannot parse is no longer replaced. The write is skipped and reported as failed.
  • opencode.json is now written atomically with 0600, matching .cursor/mcp.json.

The bounded review follow-through preserves alvedder's commits and original branch. Cleanup intersects each target's recorded ownership; skipped foreign entries are not claimed. Direct retargeting checkpoints prior ownership plus actual successful writes before retiring the old target. If cleanup fails, repairing permissions and retrying retains management of both deployments until cleanup succeeds. Existing native JSON-type and config-safety owners remain authoritative.

Issue and approved scope

Issue: #3104

Human scope-approval comment: #3104 (comment)

This implements the bounded user-scope Cursor/OpenCode MCP lifecycle, including install -g --mcp, arbitrary working directories, owned-only cleanup, preservation of authored configuration, safe refusal, and owner-only new files. VS Code user MCP, in-place JSONC editing, project opt-in redesign, and the separate issue 3054 are excluded (not additional scope references). The current maintainer dispatch authorizes bounded mergeability work, not merge or scope expansion.

Type of change

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

Testing

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

Current local evidence: head e76a04f2f42fff0f8ce24098ca4ff0ddcb891b2d, faithfully composed with main 250986fca87a115ccfe9d0b69aa79f784b9e0c90. The all-existing-tests checkbox is not inferred from a bounded selection. Actual remote checks must qualify this head; prior-head CI is not reused.

The unchanged bounded selection below passed again on this successor: 1,893 passed, 1 skipped, 31 subtests passed, 298.42 seconds. The skip is the Windows-only IntelliJ path test on macOS. E was the session evidence directory; raw logs and JUnit are retained there.

APM_BINARY_PATH="$PWD/.venv/bin/apm" APM_E2E_TESTS=1 uv run --no-sync pytest -q \
  tests/unit/*mcp*.py tests/unit/install/*mcp*.py tests/unit/integration/*mcp*.py \
  tests/integration/test_global_cursor_opencode_mcp_lifecycle.py \
  tests/integration/test_mcp_env_var_copilot_e2e.py \
  tests/integration/test_opencode_enabled_lifecycle.py \
  tests/integration/test_noncontainer_mcp_lifecycle_contract.py \
  tests/integration/test_oci_mcp_lifecycle_contract.py \
  tests/integration/test_install_mcp_lockfile_determinism.py \
  tests/integration/test_architecture_owner_rule_mutations.py \
  -o junit_logging=all --junitxml="$E/successor-bounded-suite.xml"

All seven canonical lint gates plus architecture passed on this same head; every command exited 0:

uv run --frozen --extra dev ruff check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/
uv run --frozen --extra dev ruff format --check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/
.venv/bin/python "$E/lint_portable_guards.py"
uv run --frozen --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/
bash scripts/lint-auth-signals.sh
bash scripts/lint-architecture-boundaries.sh

The retained portable helper executes the exact CI YAML-I/O, 2100-line, and str(relative_to) guard predicates on macOS; no exemptions or thresholds changed. Additional current-head results:

  • uv run --no-sync pytest -q tests/quality --junitxml="$E/successor-quality.xml": 64 passed.
  • uv run --no-sync python scripts/check_test_assertions.py: passed, strict ratchet unchanged.
  • uv run --no-sync python scripts/check_exact_test_duplicates.py: passed, 1,268 files, zero allowed duplicate groups.
  • Canonical owner gate: six detected decisions covered by eleven executed final-head functional IDs; v2 verification required terminal evidence and passed.

The 25 installed-CLI scenarios use ApmLifecycleRunner subprocesses and isolated HOME/CWDs for both targets: global install, direct --mcp, reinstall, package update, prune, uninstall and retargeting. They verify native environment/source-relative preservation, foreign servers and top-level keys, legacy JSON-type adoption, HOME aliases, JSONC/unreadable/invalid-map/symlink refusal, 0600, and project isolation.

Eight serial physical source-guard controls executed at 98de7138f4eee1c3c6aef32b265b3cb2eaf442d8: baseline pass, assertion failure after removal, byte-restored pass. Every corresponding guard and test remains byte-identical at the successor; that composition is explicit, not a relabelled historical execution. Two additional physical controls executed at e76a04f2, independently disabling Cursor and OpenCode user-scope capability: the new conformance assertion fails, then passes after byte-exact restoration. No source readers ran concurrently with these mutations.

Earlier validation retained for provenance, not current-head qualification

At 64d15db1, the same broad selection passed 1,893 tests plus 31 subtests, with the same Windows-only skip; original contributor/help/conflict/target-registry scenarios also passed 131 tests. Actual remote CI, CodeQL, NOTICE, docs build and Merge Gate passed, but Spec Mode B failed on 96 substantive critical-path additions without an executable conformance citation. The successor adds the genuine existing-requirement test described below; it does not waive the gate or change runtime behavior.

Contributor-reported CPython 3.12 validation before the bounded follow-through: lint and test-quality ratchets clean; tests/unit tests/test_console.py tests/red_team reported 23,049 passed; tests/integration reported 9,353 passed with 17 macOS failures reported to reproduce on main. These historical claims are not substituted for current-result CI. Original tests cover global package/bundle installation from unrelated directories, preservation, refusal, permissions, discovery, and VS Code remaining workspace-only.

Spec conformance (OpenAPM v0.1)

If this PR changes behaviour that an OpenAPM v0.1 req-XXX covers,
confirm the three-step ritual in the
development guide:

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

No normative requirement or manifest amendment: existing req-tg-014 defines capability-driven user-scope MCP selection, and section 8.6 permits additive harness support without a spec revision. The new test_declared_user_mcp_targets_install_without_project_signals asserts supported Cursor/OpenCode versus unsupported VS Code, then invokes the existing real-filesystem global CLI install/uninstall contract. This conformance binding is process-local CliRunner/component coverage, distinct from the installed-binary E2E scenarios above. CONFORMANCE records its test count changing from one to two.

Exact successor-head conformance commands and results:

uv run --frozen --extra dev python -m tests.spec_conformance.orphan_check
BASE_REF=250986fca87a115ccfe9d0b69aa79f784b9e0c90 bash tests/spec_conformance/mode_b_detector.sh
uv run --frozen --extra dev pytest tests/spec_conformance -p no:randomly --no-header -q -o junit_logging=all --junitxml="$E/successor-conformance.xml"
uv run --frozen --extra dev python -m tests.spec_conformance.gen_statement
git diff --exit-code CONFORMANCE.json CONFORMANCE.md

All passed: 125 requirements aligned; Mode B recognizes the executable existing-requirement citation; 292 tests passed with two preexisting skips; regenerated artifacts have no diff. The existing skips concern publish-timestamp registry coverage and absolute-path schema coverage. No new waiver, threshold change, marker-only test, or requirement exemption was introduced.

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.

Copilot review overview

🟡 Changes recommended

OpenCode's incorrect schema key can cause an existing user-owned MCP entry to be overwritten.

Review effort: Balanced
Findings: 1 High severity · 3 Low severity

Open (4)
What changed in this PR

Enables user-scoped Cursor and OpenCode MCP configuration during global installs.

Changes:

  • Adds scope-aware config paths, atomic writes, permissions, and safe parsing.
  • Extends runtime discovery, stale cleanup, CLI help, and documentation.
  • Adds global lifecycle, discovery, safety, and packaging tests.
File Description
src/​apm_cli/​adapters/​client/​base.py Adds safe JSON read/write helpers.
src/​apm_cli/​adapters/​client/​cursor.py Enables user-scoped Cursor MCP configuration.
src/​apm_cli/​adapters/​client/​opencode.py Enables user-scoped OpenCode MCP configuration.
src/​apm_cli/​integration/​mcp_integrator.py Resolves scoped paths during cleanup.
src/​apm_cli/​integration/​mcp_integrator_install.py Updates discovery and supported-runtime messaging.
src/​apm_cli/​commands/​install.py Updates global-install help text.
tests/​unit/​test_global_mcp_scope.py Tests scope, paths, safety, and cleanup.
tests/​unit/​install/​test_no_policy_flag.py Updates help-text expectations.
tests/​integration/​test_global_cursor_opencode_mcp.py Tests global install and uninstall flows.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Updates global MCP guidance.
docs/​src/​content/​docs/​reference/​cli/​install.md Documents supported global targets.
docs/​src/​content/​docs/​consumer/​install-mcp-servers.md Documents config paths and safeguards.
docs/​src/​content/​docs/​consumer/​deploy-a-bundle.md Adds a global bundle example.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/apm_cli/adapters/client/opencode.py Resolved
Comment thread src/apm_cli/adapters/client/opencode.py Resolved
@alvedder Alexei Vedernikov (alvedder) changed the title feat(install): configure Cursor and OpenCode MCP servers at user scope fix(install): configure Cursor and OpenCode MCP servers at user scope Sep 29, 2026
@alvedder

Copy link
Copy Markdown
Author

Alexei Vedernikov (Alexei Vedernikov (@alvedder)) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added the status/accepted Human scope approval; verify the issue's approval record and review contact before work. label Sep 29, 2026
@alvedder
Alexei Vedernikov (alvedder) force-pushed the feat/user-scope-cursor-opencode-mcp branch from 0e6fc9f to 5eabce0 Compare September 30, 2026 20:58
Aleksei Vedernikov and others added 6 commits October 1, 2026 14:20
OpenCode stores MCP servers under `mcp`, but the adapter declared
`mcpServers`, so conflict detection never saw servers already in
opencode.json. `apm install -g` could then overwrite a same-name server
the user configured, and in Cursor too when both targets were selected.

- Declare `mcp` as OpenCode's `mcp_servers_key` and add it to the
  recognized keys in the registry-completeness test.
- Render OpenCode's own entry format in `render_server_config`, so
  legacy ownership adoption still matches the entries APM wrote.
- Align the apm-guide `-g --mcp` row with the other rows and the CLI help.
- Replace an em dash in the adapter docstring with `--`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`is_semantically_equivalent` compared `mcp_configs` with Python
equality, which treats `1` and `true` as equal. A reinstall that only
changed OpenCode's `enabled` from `true` to `1` therefore skipped the
lockfile write, so the next change back to `true` found no drift,
reported the server as already configured and left `opencode.json` at
`1`. Compare the configs as JSON instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
OpenCode now supports user-scope MCP, so the global block no longer
expects `apm install -g --runtime opencode` to fail. It checks that the
install writes `~/.config/opencode/opencode.json`, keeps `enabled: false`
and the user's other settings, repeats without changes and leaves the
project config alone, and that moving the global target to Codex removes
the entry again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cursor now supports user-scope MCP, so `apm install --global --target
cursor` writes `~/.cursor/mcp.json` instead of failing as workspace-only.
The test still checks that a global install leaves the project's
`.cursor/mcp.json` untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve contributor commits and current main behavior while qualifying user-scope Cursor and OpenCode MCP support for microsoft#3104.

Co-authored-by: Copilot App <[email protected]>
Keep foreign entries unowned across drift and pruning, fail unsafe user configs before no-op and retarget writes, and preserve JSON-exact native adoption. Qualify Cursor and OpenCode through installed lifecycle and canonical boundary regression tests.

Co-authored-by: Copilot App <[email protected]>
Persist previous and actually written target ownership before retiring a target. Verify real permission failure, repair, retry and pruning in both global target directions.

Co-authored-by: Copilot App <[email protected]>
Preserve current main behavior while qualifying the contributor global MCP change and scoped ownership corrections.

Co-authored-by: Copilot App <[email protected]>
Assert retained names before indexing so mutation evidence reports assertion failures rather than incidental missing-key exceptions.

Co-authored-by: Copilot App <[email protected]>
Addresses the Mode B conformance failure by exercising the existing declared-user-capability requirement through real CLI config writes and cleanup. Reuse the contributor lifecycle contract and regenerate its conformance statement; do not waive the gate or amend normative scope.

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

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

Cursor and OpenCode user-scope MCP support now has a genuine conformance binding, with exact-successor local validation and no remaining product findings.

panel-mode=delta; personas=test-coverage-expert,doc-writer,apm-ceo

cc Alexei Vedernikov (@alvedder) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Current execution status: e76a04f2f42f is published on the original contributor branch. All six result-head workflows passed against main 250986fca87a; their actual jobs completed successfully or were intentionally skipped. GitHub reports no conflicts. Human code-owner and last-push approval requirements remain separate; nothing was merged, approved, queued or waived.

CEO arbitration, recorded before publication and remote CI:

Outer iteration 4, CI recovery 1; neither count resets. Both actual delta reviewers report no findings. This preserves delta3's technical recommendation within approved issue 3104. The only successor changes are a test binding existing req-tg-014 and regenerated CONFORMANCE count 1->2, not runtime source or normative specification changes. All 125 requirements remain unchanged. tests/spec_conformance/test_manifest_reqs.py::test_declared_user_mcp_targets_install_without_project_signals asserts the capability partition, then executes the existing real-filesystem global install/uninstall contract, including native projections and foreign preservation. This is substantive component/process-local CliRunner coverage, not installed-binary E2E or a dummy citation.

Fresh completion evidence supersedes the brief's and test reviewer's pending-validation caveats. On e76a04f against frozen base 250986f, successor-conformance.log records orphan alignment, Mode B, regeneration and 292 passing tests with two preexisting skips: publish-timestamp registry SHOULD and absolute-path schema affordance. No waiver was added or used for this repair. successor-bounded-suite.log records 1893 passed, one Windows-only skip and 31 passed subtests in 298.42 seconds, including 25 installed-ApmLifecycle scenarios with real subprocesses, filesystem, permissions and symlinks. All seven lint checks plus architecture exit zero; 64 quality tests and strict ratchets pass. Two independent capability-removal controls physically executed on e76 fail with AssertionError and pass after byte restoration. The eight historical controls remain attributed to 98de, with byte-composition evidence into e76; they are not newly executed successor controls.

Published 64d's technical CI passed except Spec Mode B, which identified 96 critical-path added lines without conformance citation. This bounded repair addresses that failure without weakening requirements or reopening resolved product findings. The successor is not pushed, so its remote CI remains unobserved. The parent must publish and observe actual successor checks, never borrow 64d results. This recommendation grants no waiver, label or merge authority.

Aligned with: Conformance connects declared capabilities to native global configuration lifecycle behavior. Lifecycle assertions retain foreign configuration preservation. The repair satisfies existing conformance obligations without normative expansion or a new waiver. Cursor and OpenCode capabilities have independent removal controls and separate installed lifecycle evidence.

Panel summary

Persona B R N Takeaway
test-coverage-expert 0 0 0 Genuine req-tg-014 partition, unmarked-CWD projection and preservation assertions, not a dummy marker. CliRunner fixture tier; e76 installed-E2E reruns and capability-removal controls remain pending.
doc-writer 0 0 0 Static review: 1->2 truthfully counts req-tg-014 tests covering capability partition and filesystem lifecycle. Section 8.6 permits additive adapters; no normative extension or installed-binary E2E claim.

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

The two final specialists reviewed only the conformance recovery. The preceding six-persona runtime delta had no findings; production source did not change afterward. Pending-local-validation caveats in the review snapshots were superseded by the executions below.

Recommendation

Recorded CEO recommendation: The reviewed technical scope warrants shipping; no further product rework is supported. Proceed with publication and actual successor remote CI observation. This advisory recommendation is neither a remote CI success claim nor merge authorization.

The genuine current-head CEO recommendation is ship_now, with no remaining product follow-ups. The publication and successor-CI steps named above are now complete. Preserve normal human review and repository policy.

Lint contract

The exact-head canonical ruff check/format pair, YAML-I/O, 2100-line, portable-relative-path, pylint R0801 and auth-signal gates all passed. Architecture boundaries, 64 quality tests and strict assertion/duplicate ratchets also passed.

CI

  • Exact-head unchanged broad selection: 1,893 passed, 1 Windows-only skip, 31 subtests passed; 25 installed-CLI lifecycle scenarios.
  • Conformance: 292 passed, 2 existing skips; all 125 requirements align, unwaived Mode B passes, regenerated CONFORMANCE is clean. The new existing-req-tg-014 binding is process-local CliRunner with real filesystem; installed-binary evidence is separate.
  • Immutable v2 owner gate: terminal evidence required, 6 owners / 11 executed current-head functional IDs. Semantic verification enforced terminal evidence; no owner exemption or schema change.
Workflow Observed result
CI success; 11 actual jobs inspected
Spec conformance success; 1 actual jobs inspected
CodeQL success; 2 actual jobs inspected
NOTICE Drift Check success; 1 actual jobs inspected
Deploy Docs success; 2 actual jobs inspected
Merge Gate success; 1 actual jobs inspected

One CI recovery repaired the real prior-head Mode B failure; no previous CI run was rebound to this head.

Mergeability status

PR Head CEO Iterations Tracked folds Deferrals Copilot rounds CI Mergeability Merge state Notes
#3100 e76a04f ship_now 4 13 0 2 green MERGEABLE BLOCKED normal human review/policy remains

Convergence

4 outer iterations; 2 Copilot rounds; 1 CI recovery. Final panel recommendation: ship_now. No remaining foldable items or deferrals. Ready for maintainer review. Two normal fast-forward pushes preserve alvedder's original commits and branch.

Folded in this run, contributor fixes, and per-persona findings

Folded in this run

  • (panel) Remove the remaining OpenCode project-only claim. (5e1b6a8b5df7).
  • (panel) Preserve global scope in the failed-target retry instruction (5e1b6a8b5df7).
  • (panel) Pruning can delete a same-name user-owned server. (5e1b6a8b5df7).
  • (panel) Existing-server detection bypasses unsafe-path failure. (5e1b6a8b5df7).
  • (panel) Legacy OpenCode adoption is not JSON-type exact. (5e1b6a8b5df7).
  • (panel) Extend installed-CLI coverage through the global package ownership lifecycle (5e1b6a8b5df7).
  • (panel) Exercise direct install -g --mcp for Cursor and OpenCode through the installed entrypoint (5e1b6a8b5df7).
  • (panel) Add an installed failed-target preservation contract for unsafe user configurations (5e1b6a8b5df7).
  • (panel) Intersect stale names with each runtime's ownership before cleaning global configs (5e1b6a8b5df7).
  • (panel) Do not forget previous runtime ownership during direct global retargeting (5e1b6a8b5df7).
  • (panel) Persist conservative ownership before retired-target cleanup. (37f247dedf5a).
  • (panel) Prove late cleanup failure, repair, retry, and prune in both directions. (37f247dedf5a).
  • (panel) Add new-guard removal proof and finish exact-head validation. (37f247dedf5a).
  • CI recovery: bind the actual global capability lifecycle to existing req-tg-014 and regenerate CONFORMANCE (e76a04f2f42f), without a normative amendment or waiver.

Copilot signals reviewed

  • src/apm_cli/adapters/client/opencode.py: LEGIT -- Correct original schema-key ownership defect. Contributor already corrected key and rendering; current installed foreign-preservation coverage extends the regression. Contributor fix 5d984f69dbdd; not claimed as worker authorship.
  • docs/src/content/docs/consumer/deploy-a-bundle.md:14: LEGIT -- Valid historical documentation mismatch. Contributor added the promised CHANGELOG entry; the GitHub thread is resolved. Contributor fix d667bb5702b1; not claimed as worker authorship.
  • packages/apm-guide/.apm/skills/apm-usage/commands.md: LEGIT -- Valid original guide contradiction. Contributor aligned the global --mcp row; current worker adds scoped retry and ownership-recovery guidance. Contributor fix 5d984f69dbdd; not claimed as worker authorship.
  • src/apm_cli/adapters/client/opencode.py: LEGIT -- Valid repository encoding issue. Contributor replaced the docstring character before this worker; no duplicate worker fix claimed. Contributor fix 5d984f69dbdd; not claimed as worker authorship.

Regression-trap evidence (mutation-break gate)

The first 8 guard-removal cycles physically ran at 98de7138, with explicit unchanged-byte composition into the result head. The final 2 capability-removal cycles physically ran at e76a04f2. Each baseline passed, guard removal caused AssertionError, exact bytes were restored, and the restored test passed. No concurrent source readers during mutations.

  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_prune_preserves_skipped_foreign_name[cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_prune_preserves_skipped_foreign_name[opencode],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_package_update_prune_and_uninstall[cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_package_update_prune_and_uninstall[opencode] -- removed src/apm_cli/install/mcp/integration.py: scoped_stale = stale_servers.intersection(owned_servers); failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_prune_intersects_each_targets_ownership -- removed src/apm_cli/integration/mcp_integrator.py: elif result.get("installed") and installed_servers is not None:; failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_direct_global_mcp_bootstrap_retarget_and_prune[cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_direct_global_mcp_bootstrap_retarget_and_prune[opencode] -- removed src/apm_cli/install/mcp/command.py: for previous_target, retired in retired_targets.items():; failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_mcp_refusal_preserves_owned_state[file-symlink-cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_mcp_refusal_preserves_owned_state[file-symlink-opencode],tests.integration.test_architecture_owner_rule_mutations::test_global_mcp_consumer_guards[src/apm_cli/integration/mcp_integrator_install.py-mutation_writes.mcp_target_selection-_raise_strict_config_failures(unsafe_runtimes, console=console, logger=logger)-_raise_strict_config_failures([], console=console, logger=logger)] -- removed src/apm_cli/integration/mcp_integrator_install.py: _raise_strict_config_failures(unsafe_runtimes, console=console, logger=logger); failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_legacy_global_opencode_adoption_preserves_json_types[1],tests.unit.install.test_mcp_ownership::test_legacy_adoption_compares_native_opencode_entries[command2-1-expected2],tests.integration.test_architecture_owner_rule_mutations::test_global_mcp_consumer_guards[src/apm_cli/install/mcp/ownership.py-mutation_writes.opencode_enabled_intent-opencode_enabled_matches(existing[name], expected)-True] -- removed src/apm_cli/install/mcp/ownership.py: opencode_enabled_matches(existing[name], expected); failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_direct_retarget_failure_retains_old_ownership[cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_direct_retarget_failure_retains_old_ownership[opencode] -- removed src/apm_cli/install/mcp/command.py: list(requested_target_servers),; failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_prune_preserves_skipped_foreign_name[cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_installed_global_prune_preserves_skipped_foreign_name[opencode] -- removed src/apm_cli/integration/mcp_integrator_install.py: replace_existing=is_update and ( managed_target_servers is None or dep.name in managed_target_servers.get(rt, set()) ),; failed as expected; byte-restored pass.
  • tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_direct_retarget_cleanup_write_failure_can_be_repaired[cursor],tests.integration.test_global_cursor_opencode_mcp_lifecycle::test_direct_retarget_cleanup_write_failure_can_be_repaired[opencode] -- removed src/apm_cli/install/mcp/command.py: mcp_target_servers=merged_target_servers, mcp_config_provenance=merged_provenance,; failed as expected; byte-restored pass.
  • tests/spec_conformance/test_manifest_reqs.py::test_declared_user_mcp_targets_install_without_project_signals -- removed src/apm_cli/adapters/client/cursor.py: supports_user_scope: bool = True; failed as expected; byte-restored pass.
  • tests/spec_conformance/test_manifest_reqs.py::test_declared_user_mcp_targets_install_without_project_signals -- removed src/apm_cli/adapters/client/opencode.py: supports_user_scope: bool = True; failed as expected; byte-restored pass.

Full per-persona findings

test-coverage-expert

No findings.

doc-writer

No findings.

This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.


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

Aleksei Vedernikov and others added 3 commits October 7, 2026 16:38
Resolve the conflicts with the v0.33.0 release (microsoft#3152) and the Cursor
hook and Codex agent fixes (microsoft#3149, microsoft#3150):

- CHANGELOG.md: take main's file, which moved the earlier Unreleased
  entries under 0.33.0, and keep this PR's single entry at the top of the
  new Unreleased "Fixed" section.
- CONFORMANCE.md: take main's file, which adds req-tg-015 to req-tg-017,
  and keep req-tg-014 at two tests for the global MCP lifecycle binding.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An unchanged `apm install --runtime vscode --target copilot` lost the
VS Code deployment record. The legacy migration moved ownership recorded
under `vscode` to the `copilot` key the target decision names, and
run_mcp_install then pruned that key because the explicit runtime is the
only active one. The unconditional re-record of skipped servers hid this
until the conflict detector began skipping resolved names and ownership
stopped being claimed for skipped entries.

Migrate against the explicit runtime, the same selection run_mcp_install
makes, so the ownership stays under `vscode`.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Scoping stale-server cleanup to recorded per-target ownership stopped
`apm install` from removing a dropped server when the lockfile predates
ownership tracking and holds only `mcp_servers`. Nothing is recorded to
intersect with, so test_stale_mcp_removed_on_update left the entry in
`.github/mcp.json`, and the full integration run in the merge queue would
have rejected the PR.

Restore the earlier cleanup of the targeted runtimes for that case in
project scope. User scope stays ownership-only, so user-level entries
APM never wrote are kept, and lockfiles that record ownership are
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Resolve the conflict with the grok-bot install target (microsoft#3106) in the
apm-usage commands.md. Keep main's install and targets rows, and re-apply
this PR's edits to them: Cursor and OpenCode in the global MCP runtime
list, and the `apm install -g --mcp` clause.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Oct 13, 2026
@github-actions

Copy link
Copy Markdown

APM Review Panel: ship_with_followups

Delta clean: legacy-cleanup hardening landed with tests and green CI; one narrow test-gap follow-up remains.

panel-mode=delta; personas=test-coverage-expert,doc-writer,apm-ceo

cc Alexei Vedernikov (@alvedder) @danielmeppiel @sergio-sisternes-epam -- a fresh advisory pass is ready for your review.

The two contributor commits since the prior ship_now advisory (head e76a04f) strengthen the feature. 74e18cc fixes an explicit --runtime edge in legacy ownership migration. 0fbac68 adds _legacy_cleanup_runtimes so pre-ownership lockfiles again clean stale MCP servers from targeted runtimes in project scope (user scope stays ownership-only). Both carry their own tests. The observed checks on the current head (Lint, Build & Test shards, Windows gates, spec conformance, CodeQL, NOTICE, merge gate) are green. Scope stays within approved issue #3104.

The one finding is legitimate but narrow: no test covers the explicit-runtime branch of _legacy_cleanup_runtimes with an ownerless lockfile in project scope.

Aligned with: Secure by default (user scope stays ownership-only), multi-harness support, pragmatic backward compatibility for older lockfiles.

Panel summary

Persona B R N Takeaway
Test Coverage Expert 0 1 0 Two of three _legacy_cleanup_runtimes branches are trapped; explicit-runtime + ownerless lockfile is not.
Doc Writer 0 0 0 No doc or CHANGELOG update needed; commands.md conflict resolution is consistent.

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

Top 1 follow-up

  1. [Test Coverage Expert] Add a sibling of test_ownerless_lockfile_cleans_stale_servers_from_targeted_runtimes with runtime="vscode", old_mcp_target_servers_present=False, user_scope=False, target_decision=copilot, asserting remove_stale runs for vscode (not copilot) -- guards the explicit-runtime branch against a silent regression in a realistic upgrade path.

Recommendation

Ship pending code-owner review of the latest push; this delta is additive hardening with green CI. The test-gap follow-up is a nice-to-have regression trap that can be folded in now or picked up as a fast-follow. Normal human review and repository policy remain in effect.


Full per-persona findings

Test Coverage Expert

  • [recommended] _legacy_cleanup_runtimes explicit-runtime branch has no unit test exercising stale cleanup through it at tests/unit/install/test_mcp_integration_extraction.py
    The existing ownerless test uses target_decision with runtime=None; the explicit-runtime test uses an owned lockfile and never enters the ownerless path.
    Suggested: parametrized sibling asserting remove_stale is called once with runtime vscode.

Doc Writer

No findings.

This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.

Generated by PR Review Panel for #3100 · copilot · auto · 130.2 AIC · ⌖ 0.537 AIC · ⊞ 10.1K · ◷

@github-actions github-actions Bot removed the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Oct 13, 2026
Aleksei Vedernikov and others added 4 commits October 13, 2026 20:07
`_legacy_cleanup_runtimes` picks the runtimes a pre-ownership lockfile's
stale servers are pruned from. Only its target-decision branch had a
test, so the explicit --runtime branch and the no-target fallback could
regress without any test failing.

- an ownerless lockfile with --runtime vscode and a copilot target
  decision prunes vscode, not copilot
- an ownerless lockfile with auto-detected targets and no --runtime
  prunes every runtime, as versions before per-target ownership did

Addresses the test-coverage follow-up from the PR review panel.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Preserve the contributor lifecycle changes while qualifying against current main.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
The contributor independently merged the same main revision; preserve their new commit rather than overwrite it.

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

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

Daniel Meppiel (danielmeppiel) commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

All eight final delta reviewers report zero findings on cf3888b; the three prior in-scope follow-ups are folded.

panel-mode=delta; personas=cli-logging-expert,devx-ux-expert,doc-writer,oss-growth-hacker,performance-expert,python-architect,supply-chain-security-expert,test-coverage-expert,apm-ceo

cc Alexei Vedernikov (@alvedder) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The final panel found no remaining warning-text, documentation, or regression-coverage issue in this delta. Contributor commits addressed the same surfaces as the prior panel recommendations. Reconciliation preserves the contributor's wording and six-subcase unit test alongside the worker's installed-CLI assertions and packaged-guide synchronization.

Physical mutation on cf3888b confirms the tests are load-bearing: removing contributor warning suffixes causes four installed e2e cases and four unit subcases to fail; restoring to byte-identical HEAD recovers all five baseline tests plus six subtests. All seven canonical lint predicates and the full architecture check pass. The 41 owner/consumer selection tests plus six subtests pass in 164.78s. Legacy safety and type controls physically ran on c789b4b with unchanged guard bytes through the final head; behavioral and static assertions were rerun on cf3888b. No runtime algorithm, cache, transport, hot-path, lockfile-integrity, auth-chokepoint, or fail-closed control-flow surface is touched in this delta.

The CEO recorded this recommendation before publication, conditional on observing remote CI. The latest execution evidence is reported separately below. This stance does not grant merge authority.

Aligned with: Fail-closed control flow, path guards, and auth boundaries remain unchanged in the delta. Warnings offer concrete repair steps without weakening defaults. Contributor commits and authorship are preserved.

Panel summary

Persona B R N Takeaway
cli-logging-expert 0 0 0 Contributor warning rewrites are equivalent; both still name the file, include actionable fix, and use correct symbol. New unit test codifies Rule 4 as a regression trap. Ship.
devx-ux-expert 0 0 0 Contributor warning wording and consumer recovery prose are cleaner, consistent, and tested; no UX regressions.
doc-writer 0 0 0 Contributor prose preserves scope-specific Cursor credential repair and global MCP preservation/retarget guidance; no substantive documentation regression in the supplied delta.
oss-growth-hacker 0 0 0 Consumer docs prose is clearer and warning messages offer escape hatches; no conversion surface regressions.
performance-expert 0 0 0 Warning-only string changes in error-handling cold paths and docs prose; no runtime algorithm, cache, transport, or hot-path surface touched. Ship.
python-architect 0 0 0 Delta is warning-text and docs only; no logic, authority, or pattern changes. Ship.
supply-chain-security-expert 0 0 0 Warning-only text and docs rewording; fail-closed control flow, path guards, auth chokepoints, and lockfile integrity are untouched. No supply-chain surface in delta.
test-coverage-expert 0 0 0 Contributor warning-text delta adds complementary 6-subcase unit contract test and reconciles 4 installed integration expected strings; both tier floors met. Ship.

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

Recommendation

Ship on cf3888b after remote CI confirms the local evidence. All eight panelists return zero findings; mutation testing confirms installed tests are load-bearing; contributor and worker intents are fully reconciled. No deferred in-scope items remain. The parent session must independently verify remote CI green before merging; this recommendation does not grant merge authority.

Folded in this run

  • Scope-correct Cursor credential repair and user-facing retarget/retry prose, with matching packaged-guide guidance.
  • Standalone unreadable/invalid-map repair guidance, protected by installed-CLI assertions and the contributor's six-subcase unit test.
  • Preserved contributor commits 2c5b103 and 297fb411 and their equivalent wording in reconciliation commit cf3888b1; no contributor history was rewritten.

Lint contract

All seven current CI lint gates plus architecture passed on exact head cf3888b155cf78925e19dc98b5444ebd26397968: ruff check/format, YAML I/O, 2100-line guard, portable relative paths, pylint R0801, auth signals, and registered architecture boundaries. Current CI script surfaces, including the Windows native helper, were covered.

CI

Published cf3888b155cf78925e19dc98b5444ebd26397968 includes current main 98cd812afc9600746ef160d056138aa2274886ea. The fresh delta panel is genuinely ship_now; neither the older e76a04f recommendation nor the later historical ship_with_followups is reused.

Exact-head local consumer selection: 41 passed, 6 subtests passed in 164.78 seconds, including all 25 installed global lifecycle scenarios, launcher contracts, lockfile convergence, conformance capability binding, and both architecture consumer assertions. Six deterministic canonical-owner touches are covered by six executed final-head functional IDs. The broader runs remain attributed to their actual preceding heads: 246 passed at 5b7b95ac; 1,916 passed, 1 Windows-only skip, 31 subtests at 89781701.

All six exact-head standard technical workflows are now successful after authorized execution: CI, CodeQL, NOTICE, Merge Gate, docs, and Spec conformance. Linux shards, lifecycle smoke, Windows compatibility, native Windows symlinks, and architecture jobs passed. The 23-check rollup is conclusive success/neutral/skipped; normal PR deployment is skipped. No CI recovery was needed.

The final completion is schema-valid, and the exact-head canonical-owner semantic verifier returned verified: true, terminal_evidence_required: true, and six covered owners.

Regression-trap evidence (mutation-break gate)

  • On cf3888b1, physically removing both warning suffixes caused four installed-CLI failures and four unit-subcase failures; byte-restoration passed five warning tests plus six subtests.
  • On c789b4b8, removing the explicit/default legacy cleanup returns caused both requested contributor regression tests to fail.
  • On c789b4b8, bypassing selected-target safety and native JSON-type delegation caused three behavioral and two architecture failures. The protected guard/test bytes remain unchanged at cf3888b1; current-head functional and architecture assertions pass after restoration.

Copilot signals reviewed

All four historical inline findings are LEGIT and resolved by contributor commits: native OpenCode map key, global command-guide consistency, and ASCII correction in 5d984f69dbdd; promised CHANGELOG entry in d667bb5702b1. All four threads are resolved. The latest panel's explicit-runtime legacy-cleanup test request is implemented in a47195ae6871 and passed in the fresh selection.

Convergence

Three outer iterations, two Copilot classification rounds, one full panel and bounded delta passes. All eight final panelists report zero findings. No in-scope follow-up or deferral remains. Existing reviewer requests for @danielmeppiel and @sergio-sisternes-epam remain unchanged. No human review approval, bypass, or merge is performed.

Mergeability status

Captured from the live exact-head PR after all technical checks completed:

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#3100 cf3888b155cf78925e19dc98b5444ebd26397968 ship_now 3 3 0 2 green MERGEABLE BLOCKED Technical readiness verified; GitHub still reports BLOCKED. Protected-branch decisions remain with the maintainer.

Full per-persona findings

cli-logging-expert

No findings.

devx-ux-expert

No findings.

doc-writer

No findings.

oss-growth-hacker

No findings.

performance-expert

No findings.

python-architect

No findings.

supply-chain-security-expert

No findings.

test-coverage-expert

No findings.

This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.


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

Address current panel follow-ups for scope-correct Cursor credential repair, user-facing retarget recovery, and actionable unreadable or invalid-map diagnostics. Installed CLI regression assertions fail without the warning guidance and pass after repair.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve current main guidance while qualifying the scoped MCP repair.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve upstream URL corrections without changing the scoped MCP implementation.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Addresses two review-panel follow-ups on the consumer MCP guide.

- The Cursor token-injection and credential-repair paragraphs named only
  the project-local `.cursor/mcp.json`, so a `-g` install would send
  readers to the wrong file. Both now name the config for the install
  scope and point at the existing path table.
- The global Cursor/OpenCode paragraph described ownership records and
  retiring them. It now says what users see: personal servers are
  preserved, only entries APM wrote are changed, a retarget removes the
  old entry after writing the new one, and a failed removal is retried
  by rerunning the install. The unsafe-config safety guarantees are
  unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
`_read_json_config_for_update` has four warnings that skip a config
write. The symlink and JSONC ones end with what to do about it; the
unreadable-file and invalid-server-map ones did not, so read on their
own they left the user without an action.

Both now end the same way as the others: fix the file (permissions or
encoding for an unreadable one) or add the server manually. A new test
covers the unreadable, JSONC and invalid-map cases for the Cursor and
OpenCode user configs and checks that each warning names the file and
offers the manual fallback.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Preserve the contributor docs and warning wording, their new unit guard, and the independent installed-CLI assertions. Both implementations address the same reviewed scope; adapt assertions to the contributor wording without altering runtime safety.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 9fb5ce8 into microsoft:main Oct 15, 2026
23 checks passed
Daniel Meppiel (danielmeppiel) added a commit to sergio-sisternes-epam/apm that referenced this pull request Oct 15, 2026
Preserve accepted microsoft#3100 changes alongside reviewed manifest extensions; refresh the GitHub mergeability state without rewriting contributor history.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Daniel Meppiel (danielmeppiel) added a commit to nefayran/apm that referenced this pull request Oct 15, 2026
Refresh microsoft#3161 for independently landed microsoft#3222 and earlier microsoft#3100 before final exact-head lint and functional validation.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Oct 15, 2026
Retain the scoped prune correction alongside the #3100 and #3222 changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: be82c181-49dd-4b8f-9e95-fca488acafe1
Daniel Meppiel (danielmeppiel) added a commit to adityaanikam/apm that referenced this pull request Oct 15, 2026
Preserve microsoft#3237's docs-only clarification and earlier microsoft#3222/microsoft#3100 changes without altering microsoft#3151 scope.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Daniel Meppiel (danielmeppiel) added a commit to nefayran/apm that referenced this pull request Oct 15, 2026
Preserve microsoft#3237 linked-resource lifetime clarification alongside microsoft#3222 and microsoft#3100. No implementation or scope change to microsoft#3161.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/accepted Human scope approval; verify the issue's approval record and review contact before work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants