Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado
#1,638 1 comentario 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@tombeckenham ya está trabajando en esto.

Desde el 6/10/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
3.2k
Forks
361
Merge medio
1 d 8 h
PR fusionados (30 d)
266

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/ai

Todos los issues de TanStack/ai

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.