Skip to content

[BUG] The install fast path migrates a legacy approvals.yml speculatively, before its journal and under APM_INSTALL_FAST_PATH=decide #5428

Done

Description

Reporting and investigating a bug need no permission. Before implementing a
substantive fix for inclusion in APM, obtain human scope approval and a review
contact on this issue. Trivial documentation corrections have standing
preapproval. See Contributing.

For vulnerabilities, use SECURITY.md
instead of a public issue. Remove credentials and other sensitive data from logs.

Describe the bug
When the locked install fast path (install/fast_entry.py, then install/diff_apply.try_apply) evaluates a plain apm install on a project with a dependency-declared MCP server, a legacy $APM_HOME/approvals.yml gets migrated into config.json and deleted. This happens even under APM_INSTALL_FAST_PATH=decide, the test seam that should only report the decision and write nothing.

The fast path's decision is speculative. It runs before its apply journal, and a later decline cannot roll this write back. The migration of personal consent should belong to the full install. Readers that are only previewing pass migrate_user_legacy=False to McpAdmission.for_project.

#5423 already applies this rule to the frozen preflight (InstallRequest.frozen_preflight(speculative=True)). The plain fast path still migrates through another McpAdmission route; it is not yet identified, but candidates are the policy and MCP admission checks the fast path runs before its render.

To Reproduce

  1. In a project with a dependency-declared MCP server (e.g. the tree-10 perf fixture), run apm install.
  2. Write a legacy $APM_HOME/approvals.yml (e.g. perf-org/pkg-000: {hooks: true}) and remove $APM_HOME/config.json.
  3. Run APM_INSTALL_FAST_PATH=decide apm install.
  4. approvals.yml is gone, and config.json now holds the grants.

Expected behavior
A speculative fast-path decision reads legacy consent and never migrates it. Under decide nothing is written. The full install keeps migrating as today.

Environment (please complete the following information):

Logs
Found while folding a Copilot review thread on #5423, then confirmed with a local script that runs the steps above for both install and install --frozen under decide. In both cases approvals.yml was removed before #5423's fix; after it, only the frozen preflight route is fixed.

Additional context
W3d (security) rates this low: it is the same user's consent, and the migration is idempotent. Their ruling is to apply the same speculative rule here. The fix is to thread migrate_user_legacy=False (a preview request) through every McpAdmission the fast path builds before it commits, and to add a cell that runs decide with a legacy file and asserts approvals.yml and config.json are byte-identical.

Activity

  1. added
    type/bug
    on Nov 25, 2026
  2. danielmeppiel commented on Nov 25, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: Make every McpAdmission that the locked install fast path builds before it commits (src/apm_cli/install/fast_entry.py and src/apm_cli/install/diff_apply.py try_apply) a preview request, passing migrate_user_legacy=False, so a speculative fast-path decision reads a legacy $APM_HOME/approvals.yml without migrating or deleting it. This matches the rule already applied to the frozen preflight. The full install keeps migrating legacy consent as it does today.
    Done when: A red-first cell runs APM_INSTALL_FAST_PATH=decide apm install (and the --frozen variant) on a project with a dependency-declared MCP server, a legacy approvals.yml and no config.json, and asserts both files are byte-identical afterwards; a full apm install still migrates the legacy file; the existing install and approvals cells stay green.
    Out of scope: Changing the migration itself, the approvals.yml or config.json formats, consent semantics, the full-install write path, and the fast-path decision rules.
    Review contact: Daniel Meppiel (@danielmeppiel)

  3. added
    status/accepted
    status/triaged
    on Nov 25, 2026
  4. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/acceptedstatus/triagedtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions