You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runs.subscribeToRun().withStreams() aborts active stream pipes as soon as the run status stream closes #5076
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
Trigger a task that writes several chunks to a realtime stream and immediately returns.
Subscribe to the run using for await (const part of runs.subscribeToRun(runId).withStreams()).
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!
Activity