[BUG] typescript-lsp pushes stale diagnostics on 2.1.158 (post-#17979) in TS project-references/composite workspaces
Summary
On Claude Code 2.1.158 — i.e. after the stale-diagnostics fix that
shipped in 2.1.111 (#17979, CLOSED/completed) — the typescript-lsp plugin
(typescript-language-server, --stdio) still pushes stale diagnostics to the
agent. Errors already fixed in the file keep arriving via <new-diagnostics>,
and errors from a transient intermediate edit state persist after the file is
correct. The agent then "fixes" already-correct code or chases phantom errors.
This re-files the TypeScript case as a regression/incomplete-fix, mirroring
how #57840 re-filed the Swift case (the #17979 fix was only verified for TS, yet
appears not to hold in large TS project-references workspaces).
Project setup (where this reproduces)
- Large Nx monorepo (pnpm workspaces), many projects.
- TypeScript project references + composite projects throughout
(references, composite: true, .tsbuildinfo).
- Cross-project types resolved through the reference graph + emitted
.d.ts. - Mixed emit (
tsdown→dist/,tsgo→out/), so declarations the LSP
consumes can lag a source edit.
Behavior
- After an edit fixes an error, the previously-reported diagnostic keeps being
injected for some time (server serves cached/lagged diagnostics for the open
doc and dependent projects).
tsc -b/nx typecheckare correct; the LSP push is the stale source.- Net effect: wasted turns, phantom-error reasoning, occasional reversions of
correct code.
Likely-still-open root cause
#30622 (CLOSED/duplicate) reported that the LSP client sends a constantversion on every textDocument/didChange (never increments), which breaks
the version-correlation that servers use to discard stale diagnostics. That was
closed as a duplicate of #17979, but is a distinct client-side correctness bug
and a plausible reason the fix doesn't hold here. #24443 (CLOSED/duplicate) has a
clean TS race-condition repro.
Expected
Diagnostics pushed to the agent should reflect current file state — or be
withheld until the server has caught up — in project-references + composite
workspaces, not just simple single-project cases.
Environment
- Claude Code: 2.1.158
- Platform: Windows 11, Git Bash (MSYS2) shell
- Plugin:
typescript-lsp@claude-plugins-officialv1.0.0 - typescript-language-server
--stdio
Related
- #17979 (CLOSED/completed) — original fix, 2.1.111; verified TS only.
- #57840 (OPEN) — same symptom re-filed for Swift after the fix.
- #30622 (CLOSED/dup) — constant
didChangeversion (candidate root cause). - #24443 (CLOSED/dup) — TS race-condition repro.
- #41637, #21297 (CLOSED) — earlier TS staleness reports.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗