[core] QuickJS terminal hook drain drops hook_disposed when a later same-token hook is also disposed before return
Maintainers usually reply within 1 day
@akasakariko is already working on this.
Since Oct 29, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- backend, distributed-systems
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Enable the QuickJS runtime (
WORKFLOW_VM=quickjs). - Run a workflow that registers a hook with token
'shared', suspends and resumes, disposes that hook, and then in the final turn declaresusing hook2 = createHook({ token: 'shared' })(or callshook2.dispose()) before returning. - Inspect the run's persisted events: the first hook's
hook_disposedevent is skipped during the completion drain, and the second hook'shook_createdevent 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
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 401
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 201
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/workflow
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
node-module-esbuild-plugin: getImportedIdentifier only checks the first named import when locating a violationPossibly taken @div-cowboy claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vercel/workflow#5057 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
code-transform.mdx §ID Generation omits the package-shipped `name@version` ID formPossibly taken @Mohith26 claimed this 113 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
Similar issues
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
device-management-toolkit/sample-web-ui#3711 ·
Maintainers usually reply within 1 day
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
elastic/kibana#306401 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agentes-chat/agentes-chat#927 ·
Maintainers usually reply within 1 day
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabPossibly taken @seenimohamed claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ardia-browser/ardia#2769 ·
Maintainers usually reply within 1 day