anomalyco / anomalyco/opencode
requestDiagnostics in LSP client hangs if a diagnostic request promise rejects
@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:
pendingnever reaches 0, so ifdone(results)is never satisfied the returned promise never resolves — the diagnostics flow hangs- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.