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

Abierto
#5,424 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
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
8/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

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.

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

Descripción

(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.
Lenguaje dominante
TypeScript
Estrellas
2.5k
Forks
401
Merge medio
2 d 36 min
PR fusionados (30 d)
150

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.