[core] QuickJS terminal hook drain drops hook_disposed when a later same-token hook is also disposed before return

Abierto
#5,065 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@akasakariko ya está trabajando en esto.

Desde el 29/10/2026.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
node.js, typescript

Línea de trabajo

Start by tracing the QuickJS completion drain and the hook event persistence path; the issue does not name files or tests. Reproduce with WORKFLOW_VM=quickjs using two disposed hooks with the same token in the final turn, then compare the persisted event order with the default Node VM. Done means the earlier hook_disposed is persisted before the later hook_created and the token conflict is avoided.

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

Descripción

Describe the Bug

When running on the QuickJS engine (WORKFLOW_VM=quickjs), if a workflow disposes a hook and then creates and disposes another hook with the same token in the final turn before returning (for example, using block-scoped or function-scoped using hook = createHook({ token })), the runtime omits the hook_disposed event for the earlier hook while still writing hook_created for the second hook. As a result, the second hook's creation conflicts with the first hook on the same token at workflow completion instead of succeeding like on the default Node VM engine.

Steps to Reproduce
  1. Enable the QuickJS runtime (WORKFLOW_VM=quickjs).
  2. Run a workflow that registers a hook with token 'shared', suspends and resumes, disposes that hook, and then in the final turn declares using hook2 = createHook({ token: 'shared' }) (or calls hook2.dispose()) before returning.
  3. Inspect the run's persisted events: the first hook's hook_disposed event is skipped during the completion drain, and the second hook's hook_created event conflicts with the still-active token.
Expected Behavior

The first hook's hook_disposed event should still be persisted before the second hook's hook_created event whenever a later uncommitted hook with the same token is drained at workflow completion, even if that second hook was also disposed before the workflow returned.

Environment
  • @workflow/core: 5.2.3 (main commit 9d0f748)
  • Runtime: QuickJS (WORKFLOW_VM=quickjs)
  • Node.js: v24.22.1
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.