ai-harness: view.dispose() doesn't cancel snapshot, transcript or describe requests

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

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

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

2026年11月1日 から。

評価

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

説明

needs-repro waiting-on: maintainer
What happens

With @tanstack/ai-harness 0.1.1, view.dispose() aborts only the events stream. Requests the view starts on its own (the snapshot it reloads after a turn ends, and transcript() and describe()) keep running after dispose(), and the view can't cancel them.

We see this in tests that open a view against a real Fastify server, ask one question, dispose the view, then close the server. In about half the runs, the snapshot refresh that follows the turn's end is still in flight when app.close() starts. Its keep-alive connection survives the close, and app.close() waits until the keep-alive timeout runs out, so the test times out. The last request the server got before the hang is always GET .../snapshot.

Expected

dispose() cancels every request the view started. A disposed view leaves no request open.

Why
  • SessionViewSource passes a signal only to events. snapshot, transcript and describe take no options (src/view/index.ts, around line 195).
  • refreshSnapshot, reload and ready call source.snapshot() / source.transcript() without a signal (around lines 914, 987 and 1184), and refreshSnapshot runs after events that change the snapshot (line 1101).
  • dispose() sets disposed and calls reader.abort() (line 1346). The disposed checks drop the results of the other requests, but the requests themselves keep going.
  • In the client, read() (src/client.ts, line 691) has no signal to pass on either.

Checked on main at 3ce3085.

Workaround

In our test server's close, we call server.closeAllConnections() right after starting app.close().

主要言語
TypeScript
スター
3.3k
フォーク
378
平均マージ
1日 1分
マージ済み PR(30日)
208

環境構築

はじめの一歩

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

TanStack/ai のほかの issue

TanStack/ai の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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