Skip to content

LSP clients and subprocesses persist after a worktree root is deleted #50361

Closed as not planned

Description

@akmad

Description

Deleting a workspace or worktree root while OpenCode is running leaves its cached LSP client alive. The language-server wrapper and ordinary subprocess descendants can also remain alive without another LSP request.

Reproduced against clean upstream dev at d870e22 (1.18.31) on macOS.

Plugins

None.

OpenCode version

d870e22 (dev, 1.18.31)

Steps to reproduce

  1. Start OpenCode for a worktree containing a TypeScript file.
  2. Trigger LSP use for that file.
  3. Delete the worktree root externally while OpenCode remains running.
  4. Do not make another LSP request.
  5. Observe that the client remains cached and the server wrapper or an ordinary child process remains alive.

Expected behavior

Once the root is confirmed missing or replaced, OpenCode should retire only that root's LSP client and its owned process tree within a bounded period. A live sibling root should retain its existing cached client.

Screenshot and/or share link

Not applicable; this is a lifecycle issue.

Operating System

macOS

Terminal

Not applicable; reproduced through the LSP test harness.

Activity

  1. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    V2 does not run language servers: it accepts and keeps lsp configuration, but it never starts or caches LSP clients or their subprocesses, so nothing is left running when a worktree root is deleted. To get v2: npm i -g @opencode/cli@latest or curl -fsSL https://opencode.ai/v2/install | bash (desktop: update the app). If you still see this on v2, please open a new issue with the details.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions