Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`ai-opencode`: `RUN_FINISHED` never arrives when an adapter teardown step does not settle

Aperta
#1,638 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@tombeckenham ci sta già lavorando.

Dal 6/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

waiting-on: maintainer

chat() holds RUN_FINISHED until the adapter's chatStream generator returns. In @tanstack/ai-opencode 0.4.14, the finally block of OpencodeTextAdapter.chatStream awaits handle.dispose(), server.dispose(), and bridge.close() in sequence. If one of them does not settle, the text streams but the run never ends, and the HTTP response stays open.

Repro

  1. Run chat() with opencodeText(...), withSandbox(...), and at least one tool, so that a tool bridge opens.
  2. Wrap the sandbox provider so that process.kill() on a spawned process returns a promise that never settles (as a sandbox API call that never returns does). Or use an opencode on PATH that ignores SIGTERM and keeps a request open on the tool bridge.
  3. Observe: TEXT_MESSAGE_END arrives, but RUN_FINISHED does not.

Proposed fix

Give each teardown step a time limit, and log a step that fails:

const bounded = (step) => Promise.race([
  Promise.resolve().then(step).catch((error) => logger.errors("opencode teardown failed", { error, source: "opencode.chatStream" })),
  new Promise((resolve) => setTimeout(resolve, 1000).unref()),
])
await bounded(() => handle?.dispose())
await bounded(() => server?.dispose())
await bounded(() => bridge?.close())

Suggestion (separate, @tanstack/ai-sandbox-local-process)

spawn uses detached: true, so a spawned process group gets no signal when its owner process dies, and the server continues to run with parent 1. One option: start one watchdog per owner with a stdin pipe that only the owner holds, register each spawned group with it, and kill the registered groups when the pipe closes.

Lingua principale
TypeScript
Stelle
3.2k
Fork
361
Merge medio
1g 13h
PR unite (30g)
241

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/ai

Tutte le issue di TanStack/ai

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.