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

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

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
67/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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!

Ngôn ngữ chính
TypeScript
Star
16.5k
Fork
1.5k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
17

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 triggerdotdev/trigger.dev

Tất cả issue của triggerdotdev/trigger.dev

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.