Skip to content

feat(world-local): event-first start-hook admission#2763

Draft
NathanColosimo wants to merge 1 commit into
nathan/start-hooks-01-corefrom
nathan/start-hooks-02-world-local
Draft

feat(world-local): event-first start-hook admission#2763
NathanColosimo wants to merge 1 commit into
nathan/start-hooks-01-corefrom
nathan/start-hooks-02-world-local

Conversation

@NathanColosimo

@NathanColosimo NathanColosimo commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Stack 2/4 · #2762 → this PR → #2764#2765

Implements event-first start-hook admission for @workflow/world-local (filesystem dev world), on top of the core API PR.

  • run_created atomically claims the token via an exclusive constraint-file write; duplicate deliveries of the same run converge on one canonical run_created event ID recorded in the claim, so the exclusive event publish dedups instead of appending twice.
  • createHook({ token }) inside the workflow materializes the reserved claim; a lost concurrent materialize converges instead of emitting a spurious self-hook_conflict.
  • Disposal and run completion/failure retain TTL-carrying claims (expiresAt = max(hookCreatedAt + ttl, prior window, now)); cancellation releases claims the workflow never materialized, so cancel-then-retry (including start()'s own queue-failure cleanup) can reuse the token immediately.
  • Expired claims whose run is terminal/missing are lazily reclaimable, and terminal-run cleanup opportunistically GCs expired claim debris so the tokens directory doesn't grow forever.
  • Cross-process claim writes go through a single per-token lock with atomic (rename-based) stale-lock breaking.
  • e2e: duplicate-start conflict test (skipped on the postgres CI lane until the next PR in the stack adds support there).

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7c963c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@workflow/world-local Minor
@workflow/cli Patch
@workflow/core Patch
@workflow/vitest Patch
@workflow/world-postgres Patch
workflow Patch
@workflow/world-testing Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/web-shared Patch
@workflow/web Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jul 3, 2026 2:47am
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jul 3, 2026 2:47am
example-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-astro-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-express-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-fastify-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-hono-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-nitro-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-nuxt-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-sveltekit-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-tanstack-start-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workbench-vite-workflow Ready Ready Preview, Comment Jul 3, 2026 2:47am
workflow-docs Ready Ready Preview, Comment, Open in v0 Jul 3, 2026 2:47am
workflow-swc-playground Ready Ready Preview, Comment Jul 3, 2026 2:47am
workflow-tarballs Ready Ready Preview, Comment Jul 3, 2026 2:47am
workflow-web Ready Ready Preview, Comment Jul 3, 2026 2:47am

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
❌ ▲ Vercel Production 1441 1 241 1683
✅ 💻 Local Development 1617 0 219 1836
✅ 📦 Local Production 1617 0 219 1836
✅ 🐘 Local Postgres 1605 0 231 1836
✅ 🪟 Windows 153 0 0 153
✅ 📋 Other 891 0 180 1071
Total 7324 1 1090 8415

❌ Failed Tests

▲ Vercel Production (1 failed)

hono (1 failed):

Details by Category

❌ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 125 0 28
✅ example 125 0 28
✅ express 125 0 28
✅ fastify 125 0 28
❌ hono 124 1 28
✅ nextjs-turbopack 149 0 4
✅ nextjs-webpack 149 0 4
✅ nitro 125 0 28
✅ nuxt 125 0 28
✅ sveltekit 144 0 9
✅ vite 125 0 28
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 128 0 25
✅ express-stable 128 0 25
✅ fastify-stable 128 0 25
✅ hono-stable 128 0 25
✅ nextjs-turbopack-canary 134 0 19
✅ nextjs-turbopack-stable 153 0 0
✅ nextjs-webpack-canary 134 0 19
✅ nextjs-webpack-stable 153 0 0
✅ nitro-stable 128 0 25
✅ nuxt-stable 128 0 25
✅ sveltekit-stable 147 0 6
✅ vite-stable 128 0 25
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 128 0 25
✅ express-stable 128 0 25
✅ fastify-stable 128 0 25
✅ hono-stable 128 0 25
✅ nextjs-turbopack-canary 134 0 19
✅ nextjs-turbopack-stable 153 0 0
✅ nextjs-webpack-canary 134 0 19
✅ nextjs-webpack-stable 153 0 0
✅ nitro-stable 128 0 25
✅ nuxt-stable 128 0 25
✅ sveltekit-stable 147 0 6
✅ vite-stable 128 0 25
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 127 0 26
✅ express-stable 127 0 26
✅ fastify-stable 127 0 26
✅ hono-stable 127 0 26
✅ nextjs-turbopack-canary 133 0 20
✅ nextjs-turbopack-stable 152 0 1
✅ nextjs-webpack-canary 133 0 20
✅ nextjs-webpack-stable 152 0 1
✅ nitro-stable 127 0 26
✅ nuxt-stable 127 0 26
✅ sveltekit-stable 146 0 7
✅ vite-stable 127 0 26
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 153 0 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 128 0 25
✅ e2e-local-dev-tanstack-start- 128 0 25
✅ e2e-local-postgres-nest-stable 127 0 26
✅ e2e-local-postgres-tanstack-start- 127 0 26
✅ e2e-local-prod-nest-stable 128 0 25
✅ e2e-local-prod-tanstack-start- 128 0 25
✅ e2e-vercel-prod-tanstack-start 125 0 28

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@NathanColosimo NathanColosimo force-pushed the nathan/start-hooks-02-world-local branch from 01a094a to baaa0b3 Compare July 2, 2026 23:45
@NathanColosimo NathanColosimo force-pushed the nathan/start-hooks-01-core branch from 79beb9d to 41bdb5a Compare July 2, 2026 23:45
@NathanColosimo NathanColosimo force-pushed the nathan/start-hooks-02-world-local branch from 78e0202 to 23c48fc Compare July 3, 2026 00:06
@NathanColosimo NathanColosimo force-pushed the nathan/start-hooks-02-world-local branch from 23c48fc to f31c202 Compare July 3, 2026 00:19
run_created atomically claims the start-hook token (converging
duplicate deliveries on one canonical event), createHook materializes
the claim, disposal and run completion retain TTL-carrying claims, and
cancellation releases unmaterialized claims so cancel-then-retry can
reuse the token. Terminal-run cleanup opportunistically GCs expired
claim debris. Includes the e2e coverage for start-hook conflicts
(skipped on the postgres lane until the next PR in the stack).
tag,
hookData.token,
existingClaim,
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expired-claim reclaim in the hook_created branch writes a durable token guard without the tag field, so a cross-tag GC sweep can delete a live hook's token guard and break the single-owner token guarantee.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant