feat(core): add experimental Hook token expiration#2865
feat(core): add experimental Hook token expiration#2865NathanColosimo wants to merge 20 commits into
Conversation
🦋 Changeset detectedLatest commit: 8b75665 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
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 |
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
|
📊 Workflow Benchmarkscommit Backend:
📜 Previous results (5)0deba85Fri, 10 Jul 2026 21:46:05 GMT · run logs
9d60f99Fri, 10 Jul 2026 21:13:57 GMT · run logs
7549626Fri, 10 Jul 2026 19:21:05 GMT · run logs
bd33c10Thu, 09 Jul 2026 23:37:25 GMT · run logs
87b6bd9Thu, 09 Jul 2026 22:13:25 GMT · run logs
Avg deltas compare against the most recent benchmark run on Metrics — TTFS: time to first step body execution · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (time outside step bodies, client start → last step body exit) · SL: stream latency (first chunk write → visible to the reader) Scenarios — stream: one step that streams chunks back to the client; no hooks, so the run stays in turbo mode · hook + stream: registers a hook before the same streaming step, which exits turbo mode · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges 🟢/🔴 mark percentiles within/above target. Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120 TTFS/WO compare client vs deployment clocks and SL compares the step runner’s clock vs the client’s (NTP-synced in CI). WO ends at the last step body exit, the closest observable proxy for the final step-completion request. |
87b6bd9 to
bd33c10
Compare
…core # Conflicts: # packages/world/src/events.test.ts
Summary
experimental_expirestocreateHook(), accepting the same duration strings, millisecond numbers, and absolute Dates assleep()tokenExpiresAttime onhook_createdand forward it ashookTokenExpiresAtthrough the Vercel event wiredispose()andusingrelease the token immediately, and exclude webhooksThis PR defines and transports the portable contract only. It does not implement expiration in a World. A stacked follow-up adds the Local World implementation and integration coverage.
Part of #2376.
Feedback requested
This is a running list of design questions I would like team feedback on:
Disposal and manual release
hook.dispose()currently disposes the Hook and releases its token immediately. Withexperimental_expires, this still seems like the expected behavior.usingcallsdispose()automatically. Users who want the token to remain unavailable after the run must therefore stop usingusingfor that Hook. Is that tradeoff acceptable, or should automatic disposal behave differently when expiration is configured?Unsupported Worlds
experimental_expireswithout erroring.Option name
experimental_expirescommunicate the behavior clearly?When expiration starts and how it relates to run retention
createHook(), not from workflow completion. This matches the usual expectation that an idempotency window starts at the intake or operation start time.sleep(). Should we explicitly discourage that, or eventually support an intentional indefinite mode?Verification
origin/mainat5de1b7a10@workflow/world,@workflow/core, andworkflow@workflow/coretests, 236@workflow/world-verceltests, and 8 combined@workflow/worldevent-schema testsDocs Preview
createHook()expiration