Skip to content

apm uninstall -g of an LSP package fails without a project manifest and leaves the server configured #4045

Closed

Description

At user scope with APM_HOME outside HOME, apm uninstall -g <lsp package> exits 1 with 'LSP cleanup failed ... without a valid project manifest', and the LSP server stays in the user's Copilot LSP config until a later install or update. User-scope uninstall must not require a project manifest and must remove the server it configured. Found by the lifecycle GATE state machine (#4031).

Activity

  1. added
    bug
    on Nov 20, 2026
  2. danielmeppiel commented on Nov 20, 2026

    @danielmeppiel
    CollaboratorAuthor

    Update: the LSP cleanup failure on uninstall also reproduces at project scope, not only at user scope with APM_HOME outside HOME.

  3. danielmeppiel commented on Nov 20, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: apm uninstall (project scope and -g) obtains the post-removal scope manifest through APMPackage.from_apm_yml(manifest_path), whether or not MCP cleanup runs, and supplies it to the existing LSP reconciler (reconcile_lsp_after_uninstall, install/lsp/integration.py, lsp-lifecycle owner). LSP entries APM wrote for a removed package then leave every target config and the lockfile; a surviving package's entries stay; the uninstall exits 0. The reconciler's rejection of a missing manifest and its fail-closed handling of target-write failures stay as they are. This also fixes #3768.
    Done when: an installed-CLI lifecycle test that fails on main, at project scope and at user scope with APM_HOME outside HOME, with no MCP state anywhere in the scope. Install a local package that declares only an LSP server (copilot target), then uninstall it: exit 0, and the server is gone from .github/lsp.json / ~/.copilot/lsp-config.json and from all four lockfile LSP views (servers, configs, target ownership, provenance). Controls: a surviving package's LSP server remains; a package with both MCP and LSP servers still uninstalls cleanly; a genuine target-write refusal still exits nonzero, preserves foreign config, and never reports "without a valid project manifest". Remove the now-obsolete strict xfail in tests/integration/test_opencode_lsp_lifecycle.py so that test passes normally. One CHANGELOG line. No docs change: the docs already promise this cleanup.
    Out of scope: LSP install and update; MCP cleanup; LSP target formats; target-selection or ownership-rule changes; bypasses or HOME/CWD fallbacks for a missing or invalid scope manifest; transactional rollback redesign; error wording for genuine target-write failures.
    Review contact: Daniel Meppiel (@danielmeppiel)

  4. added
    status/accepted
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugstatus/accepted

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions