A handled getWritable() failure still fails the step after its body returns

Abierto
#4,414 0 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
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Start in step/writable-stream.js and flushable-stream.js to trace how stream failures reach ctx.ops, then inspect runtime/step-executor.js and its opsSettled handling. Reproduce the failure with a world whose streams.write rejects with a 503 StreamError, and compare the available handling options in the issue. Done means a caught secondary stream failure no longer fails the step or discards its returned value, while unhandled failures retain current behavior.

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

Descripción

Summary

A step that writes to getWritable() fails after its body returns whenever any write to that stream failed, even when the step body caught the write error and finished its own work. There is no way to mark a step stream as best-effort, so a transient platform fault on a secondary output turns a completed step into a failed one.

Versions

  • @workflow/core 5.0.0-beta.51
  • @workflow/world-vercel 5.0.0-beta.46

What happens

  1. The step body writes UI chunks to getWritable(). A PUT to /v2/runs/<run>/stream/<name> fails (for example Stream write failed: HTTP 503, or transport failure after 300005ms (UND_ERR_INFO)). world-vercel correctly doesn't retry the append (streamer.js, stream retry options skip 5xx because appends aren't idempotent).
  2. The step body catches the rejected writer.write(), stops writing to that stream, and finishes its real work (it persists the result elsewhere and settles billing). Then it returns normally.
  3. getWritable() pushed the flushable state's promise into ctx.ops (step/writable-stream.js: ctx.ops.push(state.promise)). The pipe failure rejects it (flushable-stream.js, flushablePipePerChunk catch → state.reject(err)).
  4. After the body returns, runtime/step-executor.js awaits Promise.all(ops) in the opsSettled race and rethrows every rejection except AbortError / ResponseAborted (isClientDisconnectError). So the step fails with the stream's error. With maxRetries: 0 the run ends failed, and anything the workflow does after the step (settling state, enqueueing analytics from the step's return value) never runs.

Result: the user-visible work is complete, but the run is recorded as failed and the step's return value is lost.

Expected

A way for a step to own the failure of a stream it wrote to. Any of these would work for us:

  • an option such as getWritable({ failStepOnError: false }) (or a best-effort mode) that keeps the stream out of the step's fatal ops;
  • an API to abandon or detach a writable after a handled failure, so its rejection no longer fails the step;
  • treating a stream failure the step body already observed (the writer's write() / close() rejected into user code) as handled.

Repro sketch

In a step: get a writer from getWritable(), write a few chunks, make a write fail at the sink (a world whose streams.write rejects with a StreamError of status 503 reproduces it), catch the rejection, release the lock, and return a value. The step fails with the stream error instead of completing with the value.

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.