`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
- 361
- Merge medio
- 1g 13h
- PR unite (30g)
- 241
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
-
decide() drops billed usage when a call fails after the provider respondedForse già presa @tombeckenham l’ha presa 1 giorno fa. Apertahas-pr waiting-on: maintainer
TanStack/ai#1741 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
chat(): sign the state of a suspended run so a resume without persistence cannot change itForse già presa @AlemTuzlak l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1740 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
@tanstack/ai-anthropic: a stream that fails after message_start loses the call's input usageForse già presa @AlemTuzlak l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1735 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
@tanstack/openai-base: Responses usage drops input_tokens_details.cache_write_tokensForse già presa @tombeckenham l’ha presa 1 giorno fa. Apertawaiting-on: maintainer
TanStack/ai#1734 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
summarize() sends temperature 0.3 to models that reject sampling parameters (e.g. claude-sonnet-5-5)Forse già presa @jherr l’ha presa 4 giorni fa. Apertahas-pr waiting-on: maintainer
TanStack/ai#1703 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
useFragment does not require `variables` when the fragment's variables type has required fieldsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apollographql/apollo-client#13493 ·
I maintainer di solito rispondono entro 1 giorno
-
Custom hosts written as trailing-dot FQDNs (`host.local.`) aren't detected as local backendsForse già presa @roboomp l’ha presa oggi. Apertabug prio:p2 providers triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
can1357/oh-my-pi#15798 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
code-yeongyu/oh-my-openagent#10172 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
PDFCraftTool/pdfcraft#189 ·
-
Add the Yahoo chart API duplicate last-day row (yfinance#573) to incidents.md (about 1 hour)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadata docs good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
pacocartones/market-data-sanity-checker#160 ·
I maintainer di solito rispondono entro 1 giorno