Idempotency follow-ups: stable start Hooks, runs.list attribute filtering, resumeHook idempotency keys, hook close/drain

Đang mở
#5,424 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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
8/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

This is a tracker for four separate design changes, not one task. Start with the World contract, since ListWorkflowRunsParams and the resumeHook() dedup window both depend on it, and read the linked idempotency docs for the current experimental_hook and experimental_minRetention behaviour. Done would mean agreed designs for each item, not a single patch; a newcomer should pick one item only after a maintainer confirms its scope.

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

Mô tả

(AI) Follow-up to #2376. That issue's main proposal shipped: start({ experimental_hook }) admits a run and its start Hook atomically (#4996, #5156, #5238), and experimental_minRetention refuses duplicates that arrive after the run ends. See Run idempotency. This issue tracks the four items from #2376 that are still open.

1. Make start Hooks and retention stable

  • Drop the experimental_ prefix from start({ experimental_hook }) and experimental_minRetention (on both start() and createHook()).
  • Support experimental_hook for dynamic workflows. Today start() throws: "start({ experimental_hook }) is not supported for dynamic workflows, so no run was created."

2. Filter runs.list by attribute

ListWorkflowRunsParams filters only by workflowName and status. Runs can set attributes (experimental_setAttributes, CreateWorkflowRunParams.attributes), but nothing can look a run up by them. Retention covers a bounded window after a run ends. Attribute lookup is still needed to find runs after that window, and for richer queries. This needs a change to the World contract.

3. Idempotency keys on resumeHook()

A retried resumeHook() gets a new resumeId and can append a second hook_received. That happens, for example, when a step crashes after the resume landed and is retried. Today every consumer has to carry its own request key in the payload and deduplicate. Proposal: resumeHook(token, payload, { idempotencyKey }), deduplicated by the World within a retention window. In a step, stepId (plus a counter for steps that send more than once) is a natural key.

4. Hook close and drain

A workflow cannot stop accepting resumes and then consume the payloads already buffered. If a workflow ends right after its last await hook, a payload resumed in that window is acknowledged to the sender and then dropped. Possible shape: hook.close(), after which resumeHook() rejects and the sender can route elsewhere, and then iterating the hook yields the backlog it already accepted, until it is empty.

Not tracked here

  • Optimistic strategies (supersede, signal the owner) stay inherently racy. The documented retry loops handle this.
  • Tokens are one flat namespace across workflows. A documented prefix convention (for example order:<id>) is enough.
Ngôn ngữ chính
TypeScript
Star
2.5k
Fork
401
Merge trung bình
2 ngày 36 phút
Pull request đã merge (30 ngày)
150

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 vercel/workflow

Tất cả issue của vercel/workflow

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.