`ai-opencode`: `RUN_FINISHED` never arrives when an adapter teardown step does not settle
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
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
- Run
chat()withopencodeText(...),withSandbox(...), and at least one tool, so that a tool bridge opens. - 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 anopencodeonPATHthat ignoresSIGTERMand keeps a request open on the tool bridge. - Observe:
TEXT_MESSAGE_ENDarrives, butRUN_FINISHEDdoes 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
- 365
- Merge medio
- 1g 8h
- PR unite (30g)
- 261
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/ai
-
withPersistence does not save activity rows when a run is stopped or failsForse già presa @tombeckenham l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1804 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Activity events that a chat middleware emits are streamed but never recorded or persistedForse già presa @AlemTuzlak l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1803 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
withPersistence stores the durability batch hint on a stopped or failed assistant messageForse già presa @tombeckenham l’ha presa 1 giorno fa. Apertahas-pr waiting-on: maintainer
TanStack/ai#1802 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Activity events that a chat middleware emits are streamed but never recorded or persistedForse già presa @AlemTuzlak l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1801 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
withPersistence stores the durability batch hint on a stopped or failed assistant messageForse già presa @tombeckenham l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1800 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Chocobozzz/PeerTube#7832 ·
I maintainer di solito rispondono entro 3 giorni
-
Pay to use?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
darkreader/darkreader#16108 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Add: Dak Nong TV SDApertacheck:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug engine
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
frostney/GocciaScript#1746 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
agilepathway/label-checker#739 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno