Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#1,638 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@tombeckenham がすでに取り組んでいます。

2026年10月6日 から。

評価

この issue はまだ評価されていません。

説明

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.

主要言語
TypeScript
スター
3.2k
フォーク
361
平均マージ
1日 13時間
マージ済み PR(30日)
241

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/ai のほかの issue

TanStack/ai の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。