opencode/packages
Kit Langton 69f7182f05 fix: bound LSP diagnostic enrichment in write/edit/apply_patch (#22872)
Issue #22872 reports the write tool hanging indefinitely after a file
is written. Two underlying causes, both in the post-write LSP
enrichment path:

1. LSPClient.create wraps the `initialize` request in a 45s
   withTimeout. If the spawned LSP process is wedged (happens with
   pyright under certain conditions), every write that matches that
   LSP blocks the tool for up to 45s even though the file is on disk.

2. Server.spawn for npm-distributed LSPs (pyright, tsserver,
   biome, ...) calls Npm.which, which internally uses arborist.reify
   with no timeout. In sandboxed containers with no network access
   this promise never resolves — the write tool hangs forever.

Fix applied at three layers of defense:

- write.ts / edit.ts / apply_patch.ts: wrap the touchFile +
  diagnostics tail in a 5s Effect.timeout with catch-to-empty.
  Diagnostics are a best-effort enrichment; they must not block the
  tool's return after the file is already written.
- lsp.ts schedule(): bound server.spawn with a 10s Promise.race
  timeout. On timeout the server is added to s.broken so subsequent
  touches short-circuit instantly instead of re-racing.
- client.ts: lower the `initialize` withTimeout from 45_000 to
  10_000. If a server hasn't responded to initialize in 10s it's
  wedged; 45s was punishing for no benefit.

Reproducer tests (added in earlier commits on this branch) now pass:
- write-lsp-hang.test.ts  (branch A, 45s initialize timeout)
- write-lsp-spawn-hang.test.ts  (branch B, forever Npm.which)
Both complete in ~5s.

Full opencode test suite: 1934 pass, 0 fail.
2026-04-16 17:36:04 -04:00
..
app app: start migrating bootstrap data fetching to TanStack Query (#22756) 2026-04-16 06:10:23 +00:00
console Fix desktop download asset names for beta channel (#22766) 2026-04-16 06:10:03 +00:00
containers chore: bump Bun to 1.3.11 (#18144) 2026-03-23 10:19:21 +10:00
desktop feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741) 2026-04-15 23:27:32 -04:00
desktop-electron beta badge for desktop app (#14471) 2026-04-16 06:03:41 +00:00
docs
enterprise feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741) 2026-04-15 23:27:32 -04:00
extensions/zed release: v1.4.6 2026-04-15 07:26:23 +00:00
function feat: enable oxlint suspicious category, fix 24 violations (#22727) 2026-04-16 02:53:10 +00:00
identity
opencode fix: bound LSP diagnostic enrichment in write/edit/apply_patch (#22872) 2026-04-16 17:36:04 -04:00
plugin fix: remove 10 unused type-only imports and declarations (#22696) 2026-04-16 02:17:59 +00:00
script refactor: replace bun semver with npm semver package 2026-03-09 15:29:55 -04:00
sdk chore: generate 2026-04-16 07:15:05 +00:00
shared fix: add missing glob dependency (#22851) 2026-04-16 13:21:04 -05:00
slack feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741) 2026-04-15 23:27:32 -04:00
storybook feat: enable type-aware no-base-to-string rule, fix 56 violations (#22750) 2026-04-16 03:50:47 +00:00
ui fix: clean up final 16 no-unused-vars warnings (#22751) 2026-04-16 03:54:21 +00:00
web zen: opus 4.7 2026-04-16 11:32:56 -04:00