fix false-positive unconsumed event in hook loop replay#1778
fix false-positive unconsumed event in hook loop replay#1778TooTallNate merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: a71b1ed The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 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 |
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) 10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (98 failed)mongodb (15 failed):
redis (15 failed):
turso (68 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
There was a problem hiding this comment.
Pull request overview
Fixes a false-positive “unconsumed event” report during workflow replay when a for await hook loop schedules follow-up async work after the initial promise-queue drain.
Changes:
- Updates
EventsConsumer’s deferred unconsumed-event check to yield once, then re-read the promise queue before reporting an orphaned event. - Adds a
runWorkflowregression test covering delayed hook payload hydration in afor awaitloop (ensuring the secondstep_createdisn’t incorrectly flagged). - Adds a patch changeset for
@workflow/core.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/workflow.test.ts | Adds a targeted regression test reproducing the hook loop replay timing scenario. |
| packages/core/src/events-consumer.ts | Adjusts the deferred orphan-event check to avoid racing with newly appended async work. |
| .changeset/fix-hook-loop-unconsumed-event.md | Publishes the fix as a patch release note for @workflow/core. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const processPayload = globalThis[Symbol.for("WORKFLOW_USE_STEP")]("processPayload"); | ||
| async function workflow() { | ||
| const hook = createHook({ token: 'test-token' }); | ||
| void sleep('1d'); |
There was a problem hiding this comment.
void sleep('1d') creates a wait invocation that is never completed in the provided event log (only wait_created exists). This will leave a pending wait in invocationsQueue and triggers warnPendingQueueItems() on workflow completion, making the test noisy and potentially flaky if warnings are treated as failures. Consider removing the un-awaited sleep, or add a matching wait_completed event (and/or await the sleep) so the queue is clean at the end of the run.
| void sleep('1d'); |
VaguelySerious
left a comment
There was a problem hiding this comment.
LGTM best I can tell from testing it. I need a longer session to really dig into the event consumer
Signed-off-by: Nathan Rajlich <n@n8.io>
Summary
runWorkflowregression forfor awaithook loops where the next payload hydration is appended after a prior step resolves@workflow/coreTesting