`ai-opencode`: `RUN_FINISHED` never arrives when an adapter teardown step does not settle
メンテナーはふだん 1 日以内に返信
@tombeckenham がすでに取り組んでいます。
2026年10月6日 から。
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- TypeScript
- スター
- 3.2k
- フォーク
- 361
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 241
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/ai のほかの issue
-
decide() drops billed usage when a call fails after the provider responded対応中かも @tombeckenham が 1 日前に担当しました。 オープンhas-pr waiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
chat(): sign the state of a suspended run so a resume without persistence cannot change it対応中かも @AlemTuzlak が 1 日前に担当しました。 オープンwaiting-on: maintainer
TanStack/ai#1740 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
@tanstack/ai-anthropic: a stream that fails after message_start loses the call's input usage対応中かも @AlemTuzlak が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
@tanstack/openai-base: Responses usage drops input_tokens_details.cache_write_tokens対応中かも @tombeckenham が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
summarize() sends temperature 0.3 to models that reject sampling parameters (e.g. claude-sonnet-5-5)対応中かも @jherr が 3 日前に担当しました。 オープンhas-pr waiting-on: maintainer
TanStack/ai#1703 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
status:approved type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
stage:4
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
ilan-pinto/roaring-lions#598 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信