[core] Fix spurious "Event cursor missing after initial load" warning#2056
Merged
Conversation
A World may legitimately return `{ data: [], cursor: null, hasMore: false }`
on a trailing empty page — e.g. when the previous page's DynamoDB query hit
`Limit` exactly and returned a `LastEvaluatedKey` "just in case". Overwriting
the cursor with null on that trailing page caused the V2 runtime to fall into
the "Event cursor missing after initial load" branch and do a full event
reload on every replay iteration.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Contributor
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
workflow with 1 step💻 Local Development
▲ Production (Vercel)
workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
❌ Some benchmark jobs failed:
Check the workflow run for details. |
Contributor
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
|
VaguelySerious
commented
May 21, 2026
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
🦋 Changeset detectedLatest commit: 96a9fc8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 |
pranaygp
approved these changes
May 22, 2026
github-actions Bot
added a commit
that referenced
this pull request
May 22, 2026
…adation due to clobbered cursor (#2056) Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Contributor
|
Backport PR opened against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The V2 runtime's
loadWorkflowRunEventshelper paginates throughworld.events.listand overwrites itscursorvariable on every page. When the final page is empty (data: [], cursor: null, hasMore: false), the helper returnscursor: nulldespite having loaded events — which trips thecachedEvents≠ null +eventsCursor= null branch inruntime.ts, logsEvent cursor missing after initial load — falling back to full reload. This indicates a bug in the World implementation., and forces a full event reload on every subsequent replay iteration.The trailing empty page is a normal, contract-compliant response, not a World bug. workflow-server can produce it whenever an underlying DynamoDB
Queryhits itsLimitexactly — DynamoDB returnsLastEvaluatedKey"just in case", the server passes that through ashasMore: true, and the next call returns an empty page. This is observable in production (38 distinct runs in 24h onagents-vade-reviewalone, each logging the warning multiple times per invocation).Fix is one line: preserve the last non-null cursor across pages.
This mirrors how
runtime.ts:665andruntime.ts:811already treat incremental loads.Test plan
packages/core/src/runtime/helpers.test.ts— added regression tests covering the trailing-empty-page case, multi-page traversal, and incremental loads that return zero new events. Verified the new tests fail againstmain(cursor isnullinstead of the expected last cursor) and pass with the one-line fix.