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

オープン
#4,663 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
2.5k
フォーク
401
平均マージ
1日 21時間
マージ済み PR(30日)
201

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel/workflow のほかの issue

vercel/workflow の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。