[BUG] --project-config-root makes plugin LSP servers run in the config root instead of the session cwd (desktop worktree sessions)
What's wrong
When a session is started with --project-config-root <dir>, plugin LSP servers run with their working directory (and CLAUDE_PROJECT_DIR) set to <dir>. The LSP initialize request still gives the session's own directory as the root. The server therefore runs in one project while analysing another.
The Claude desktop app has passed --project-config-root <main checkout> to worktree sessions since today's update. So every desktop worktree session now starts its LSP servers in the main checkout.
Why it matters
Servers resolve relative paths against their working directory. clojure-lsp hands clj-kondo an empty lint path in some configurations, and clj-kondo lints "" as the working directory. In the main checkout that is every worktree plus their build outputs. Three servers ran at about 85% CPU for hours and never answered a request. Worktree sessions started without the flag ran their servers in the worktree, and those servers answered.
Reproduction (Claude Code 2.1.286, macOS, clojure-lsp@claude-code-lsps plugin)
- Create two directories,
mainandwt, each a git repo withdeps.edn({:paths ["src"]}) andsrc/demo/core.cljcontaining adefn. - In
wt, runclaude -p --project-config-root <path>/main --allowedTools LSP,Bashwith this prompt: use the LSP tool (findReferences on thedefn), then runlsof -a -p <clojure-lsp pid> -d cwd. - The clojure-lsp process's cwd is
<path>/main. - Run the same in
wtwithout--project-config-root. The cwd is<path>/wt.
Expected
Plugin LSP servers run in the session's working directory, the same directory sent as the LSP root. --project-config-root should only change where project config is read from.
_Written by Opus 5.5_