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

Abierto
#4,663 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
2.5k
Forks
401
Merge medio
1 d 21 h
PR fusionados (30 d)
201

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel/workflow

Todos los issues de vercel/workflow

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.