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

Đang mở
#1,960 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@AlemTuzlak đang làm issue này rồi.

Từ ngày 1/11/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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().

Ngôn ngữ chính
TypeScript
Star
3.3k
Fork
378
Merge trung bình
1 ngày 1 phút
Pull request đã merge (30 ngày)
208

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/ai

Tất cả issue của TanStack/ai

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.