anomalyco / anomalyco/opencode

requestDiagnostics in LSP client hangs if a diagnostic request promise rejects

Open
#47,452 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 5, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

In packages/opencode/src/lsp/client.ts, requestDiagnostics only attaches a fulfillment handler to each request promise:

for (const request of requests) {
  request.then((result) => {
    results.push(result)
    pending -= 1
    ...
  })
}

The only caller passes promises from requestDiagnosticReport, whose internal .catch(() => null) guards the textDocument/diagnostic request itself but not the report processing that runs after it. If that processing ever throws (e.g. a server returns a malformed report), the promise rejects and:

  1. pending never reaches 0, so if done(results) is never satisfied the returned promise never resolves — the diagnostics flow hangs
  2. the rejection is unhandled

Proposed fix: attach a .catch that decrements pending and force-finishes once all requests have settled, treating the failed request as contributing no results.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.