runs.subscribeToRun().withStreams() aborts active stream pipes as soon as the run status stream closes

Aperta
#5,076 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript

Direzione di ricerca

Start at the implementation of runs.subscribeToRun().withStreams() and trace how completion of the run status stream aborts the shared signal and child stream subscriptions. Reproduce with a task that emits several realtime chunks before returning, then check that buffered chunks are yielded after the terminal run update. Done when stream completion drains queued chunks and caller cancellation still aborts subscriptions.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What version of Trigger.dev are you using?

main (commit dd5eec1)

What Node.js version are you using?

20.18.0

What operating system are you using?

Linux

What build tool are you using?

tsup

Describe the Bug

When consuming runs.subscribeToRun(runId).withStreams(), the subscription aborts its shared abort signal as soon as the upstream run status stream finishes. If a task emits realtime stream chunks right before completing, the outer stream and its child stream subscriptions get aborted before buffered or in-flight stream events finish draining, so trailing stream chunks are dropped.

Reproduction Steps
  1. Trigger a task that writes several chunks to a realtime stream and immediately returns.
  2. Subscribe to the run using for await (const part of runs.subscribeToRun(runId).withStreams()).
  3. Observe that once the terminal run snapshot is read from the upstream run stream, the shared abort signal fires right away and cancels the outer stream reader and active realtime stream pipes before all queued stream chunks are yielded.
Expected Behavior

withStreams() should allow buffered run updates and active child stream subscriptions to finish draining naturally when the run completes, and only abort everything when the caller explicitly unsubscribes or cancels the outer stream.

Additional Context

Happy to open a PR with a test for this if you would like to vouch it!

Lingua principale
TypeScript
Stelle
16.5k
Fork
1.5k
Merge medio
1g 15h
PR unite (30g)
17

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di triggerdotdev/trigger.dev

Tutte le issue di triggerdotdev/trigger.dev

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.