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

Aperta
#5,065 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@akasakariko ci sta già lavorando.

Dal 29/10/2026.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
node.js, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
TypeScript
Stelle
2.5k
Fork
401
Merge medio
1g 21h
PR unite (30g)
201

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/workflow

Tutte le issue di vercel/workflow

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.