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

Abierto
#1,960 2 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@AlemTuzlak ya está trabajando en esto.

Desde el 1/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
3.3k
Forks
378
Merge medio
1 d 1 min
PR fusionados (30 d)
208

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/ai

Todos los issues de TanStack/ai

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.