Skip to content

[BUG] apm init re-init rewrites target: agents to an invalid targets: [agents] #3857

Closed

Description

Describe the bug
Re-running apm init --yes on a project whose apm.yml has target: agents rewrites the manifest to targets: [agents]. APM then rejects that manifest, because agents is not accepted under targets:. The OpenAPM spec (sec. 4.2.1) says a rewrite MUST normalise agents to copilot.

To Reproduce

  1. apm.yml with target: agents.
  2. apm init --yes (re-init prefill).
  3. apm install fails with an unknown-target error.

Expected behavior
Every manifest rewrite path, including the init re-init prefill, uses the same alias map as apm manifest migrate (agents -> copilot, vscode preserved). The rewritten manifest also parses before it is written.

Additional context
Found by the apm-spec-guardian panel on #3801 (finding oci-rec-r1-2): #3801 (comment)

Activity

  1. added
    area/multi-target
    type/bug
    on Nov 18, 2026
  2. danielmeppiel commented on Nov 18, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: Route every apm.yml target rewrite path, including the apm init re-init prefill, through the single manifest-target rewrite mapping used by apm manifest migrate (agents to copilot, vscode preserved, agy to antigravity, unmappable tokens refused), and validate the rewritten manifest parses before writing it.
    Done when: apm init --yes over target: agents writes targets: [copilot] and the project installs; no rewrite path can write a manifest that APM then rejects; a static guard keeps target rewrites in the one owner; unit and real-binary lifecycle tests fail before and pass after; CHANGELOG updated.
    Out of scope: Changing the migrate mapping itself; the deferred spec items in #3859.
    Review contact: Daniel Meppiel (@danielmeppiel)

  3. danielmeppiel commented on Nov 18, 2026

    @danielmeppiel
    CollaboratorAuthor

    Context: Daniel Meppiel (@danielmeppiel) asked for this 0.37 defect to be fixed in 0.37 rather than carried (follow-up of the #3801 spec-guardian review, #3851/#3864).

  4. added
    status/accepted
    on Nov 18, 2026
  5. added a commit that references this issue on Nov 19, 2026
    f94445c
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

    area/multi-targetstatus/acceptedtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions