try/finally around steps: replay consumes the finally step while step_created still belongs to the try step

Đang mở
#4,663 2 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/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ệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Start from the divergence error text in the replay engine — search the repo for the message fragment 'belongs to' / 'current step consumer is' to find where a step_created event is matched against the current step consumer, then trace how try/catch/finally constructs push the finally step onto the consumer stack while an awaited step inside try is still pending. Check the scheduler's suspension/resume path for steps awaiting completion, and reproduce with a workflow shaped like the one in the issue (step in try, step in finally, a step_created written for the try step). Done means replay keeps consuming the try step's events until step_completed/step_failed and only then runs the finally step, verified by a replay test that previously produced REPLAY_DIVERGENCE / CORRUPTED_EVENT_LOG.

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

Mô tả

What happened

A production workflow on Vercel ([email protected], Next.js, world-vercel) failed with CORRUPTED_EVENT_LOG after the automatic recovery budget. The divergent event is a step_created for a step inside try, consumed on replay by the step in finally.

Error: Workflow replay diverged 4 times after 3 recovery replays; latest divergent event was evnt_01M47BPBHPG5TAVN1PKD1SNVR6.
Last divergence: Replay divergence: step event step_created for step_01M47BM6V9W4JTDTY2TMM2HR92 belongs to "step//./src/cms-api/generation/durable/pipelineSteps//generateSectionImagesStep", but the current step consumer is "step//./src/cms-api/generation/durable/pipelineSteps//settleBuiltSectionStep"
errorName: CorruptedEventLogError
errorCode: CORRUPTED_EVENT_LOG

Recovery warnings immediately before that, same run, same event, divergenceCount: 3, maxRecoveryReplays: 3, errorCode: REPLAY_DIVERGENCE.

  • Corrupted run: wrun_01M47BM6HBPPBHY286J10MYGM6
  • Deployment: dpl_EbxN86u6K6HSjm5QDbQ8YxARbJki
  • When: 2026-10-06T01:01:52Z (divergence) → 2026-10-06T01:01:53Z (corrupted)
  • Package: [email protected] (latest 4.x at the time of writing is 4.8.12; 5.0.1 is current)

The parent run kept polling a status step for 3 hours and then timed out. The section run itself never reached step_completed for generateSectionImagesStep.

Workflow shape

"use workflow" with three "use step" calls. reusesShared is a workflow argument, stable across replays. On this run it was false, so the images step was reached and its step_created was written.

export async function sectionWorkflow(input: { reusesShared: boolean }) {
  "use workflow"
  try {
    await writeSectionHtmlStep(input)
    if (input.reusesShared) return
    await generateSectionImagesStep(input)
  } catch (error) {
    await recordSectionFailureStep(input)
    throw error
  } finally {
    await settleBuiltSectionStep(input)
  }
}

writeSectionHtmlStep had already completed. The next recorded event is step_created for generateSectionImagesStep. Replay then tried to run settleBuiltSectionStep from finally instead of consuming that images step.

Expected

try / catch / finally around steps is documented as normal orchestration (including the child-workflow cookbook, which resumes a hook from finally). Suspending inside try on an in-flight step should not run finally until that step settles. Replay should keep consuming generateSectionImagesStep until step_completed or step_failed, and only then run settleBuiltSectionStep.

Actual

One invocation writes step_created for the images step. The next invocation's step consumer is the finally step. Three recovery replays hit the same event, then the run is marked corrupted. The divergence is not catchable inside the workflow, so the catch step never records the failure either.

https://useworkflow.dev/err/replay-divergence asks for the run id when recovery does not clear CORRUPTED_EVENT_LOG. Happy to pull more of the event log if that helps.

Ngôn ngữ chính
TypeScript
Star
2.5k
Fork
401
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
201

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.