[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook - #2405

Merged
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook
Jun 13, 2026
Merged

[core] Fix stable e2e: hookGetConflict test references undefined waitForHook#2405
VaguelySerious merged 1 commit into
stablefrom
peter/fix-stable-waitforhook

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Problem

stable's e2e suite has been red on every push since 2026-06-12 (and on every stable-targeted PR, e.g. the backports #2401/#2402/#2404), failing with:

ReferenceError: waitForHook is not defined
❯ packages/core/e2e/e2e.test.ts:1586
FAIL e2e > hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered

Root cause

The hookGetConflict test was brought onto stable by backports #2372 ("Add hook.hasConflict") and #2382 ("Replace hook.hasConflict with hook.getConflict()"). It calls waitForHook(token, { runId }) — a helper that only exists on main. On stable the hook-polling helper is waitForHookState(token, predicate) (different signature), so the call references an undefined function and the whole e2e.test.ts file aborts.

This is not an implementation problem: hook.getConflict() works on stable — the sibling getConflict tests in the same file pass. It's purely a missing/renamed test helper that wasn't carried with the backport (the waitForHook helper was added on main by a separate, never-backported PR).

Fix

Switch the single offending call to the predicate form already used by 8 other call sites in this file (and an identical pattern at line ~1442):

consthook=awaitwaitForHookState(token,(candidate)=>candidate?.runId===run1.runId);assert(hook,'Expected hook to belong to run1');

Semantics are identical to main's waitForHook(token, {runId}): resolve once a hook for the token exists whose runId matches run1.

This greens stable's own push CI and unblocks the in-flight backport PRs on re-run.

Test-only change → empty changeset.

🤖 Generated with Claude Code

The `hookGetConflictWorkflow ... resolves with the conflicting run` e2e
test was backported (#2372/#2382) calling `waitForHook(token, {runId})`,
a helper that only exists on `main`. On `stable` the equivalent helper is
`waitForHookState(token, predicate)`, so the call threw
`ReferenceError: waitForHook is not defined`, failing the whole e2e suite
on every stable push and stable-targeted PR. hook.getConflict() itself
works on stable (sibling tests pass) — this is purely a missing test
helper. Switch the call to the predicate form already used by 8 other
sites in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerJune 13, 2026 18:23
@vercel

vercelBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de647b6

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions

github-actionsBot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production9780671045
✅ 💻 Local Development10540861140
✅ 📦 Local Production10540861140
✅ 🐘 Local Postgres10540861140
✅ 🪟 Windows950095
❌ 🌍 Community Worlds1351026243
✅ 📋 Other534036570
Total49041023675373

❌ Failed Tests

🌍 Community Worlds (102 failed)

mongodb (17 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

redis (12 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

turso (73 failed):

  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • addTenWorkflow | wrun_01KV13NW7T8MCVXET32TXWX7JR
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV13QJMZ22TTAC1YCWYBV88R
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV13P3WJ3QH804MH0H008PY1
  • promiseRaceWorkflow | wrun_01KV13PAT2WWRWQWR34BV6AK4V
  • promiseAnyWorkflow | wrun_01KV13PCWVYV12ZA8YSTPAH7PC
  • importedStepOnlyWorkflow | wrun_01KV13QXNXB4HC619R4E67H4T0
  • readableStreamWorkflow | wrun_01KV13PG80WADWC6WWM8CJ9ZVR
  • hookWorkflow | wrun_01KV13PX9K5HKWTD0GDXP7Y9HK
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV13Q3TB2WVXCAP0H58XX4N6
  • webhookWorkflow | wrun_01KV13Q8SXS8E971CGT8KF7T06
  • sleepingWorkflow | wrun_01KV13QFENQ6WZKNSW3PAG49WV
  • parallelSleepWorkflow | wrun_01KV13QZKCC5QHGMEZPPMJP2JN
  • nullByteWorkflow | wrun_01KV13R4B4095FWRXEVJAE56Y4
  • workflowAndStepMetadataWorkflow | wrun_01KV13R69YCE3P181ZHHTDC911
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV13TMV5XGTGK6AK4RBF3S7Q
  • writableForwardedFromWorkflowWorkflow | wrun_01KV13V2NEAJNKAXD39AJBMVHD
  • writableForwardedFromStepWorkflow | wrun_01KV13V6QCR3KNVZ951NC82VFV
  • fetchWorkflow | wrun_01KV13VADZD6Q5J60ZXKCTCCTN
  • promiseRaceStressTestWorkflow | wrun_01KV13VDNDA4TC2DXV4QJMNKGH
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV13YPCJ72E4MCCY982Z8K9A
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV13Z2N2HTZJEBTXGT7ZTKTS
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV13ZDPDWX2YSGGKPXRMJ8CE
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV13ZG2P5W7KE5XDW43SSKAB
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV13ZJDR585F8QFWJKW9NDVY
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV13ZMY444GY1VWRFYNVRNB8
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1402PJ82J2H37J6V8KQS4X
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV140F09KW9D04CHBV3SEVDC
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV140XQT31CNET47NDAG8J40
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1416201MAB7CYP1SK0STRW
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV141B69K6B2NYAQWKQ1RYFX
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV141D7NYK0KGJNNZYV7MVE8
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV141TVRVFD1XTPKQ1KWZTPH
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1420107DECF0W26FHCSQ6S
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1426FY4QDXH06D89YADVHD
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV142CYRG949E8VY5RK69JX7
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV142KFSAVDSSESS490T0XSS
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV142STRA30QKTAZZC2MAN5H
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1431DVQGMHN4DD9MHVV8DF
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV143DG7SJQW1D76NS2SVR0X
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV143P3K2K47TSQP4FSPWYDD
  • cancelRun - cancelling a running workflow | wrun_01KV143WEP0SSW9FG431WHX3BX
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1445HGT5Q5V5DNRD6E7WSM
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV144HFAAD0ANRANVG85EY84
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV145225YD01Y3JNB71J6476
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV145DWJ1DNGXC1CN7V36SYS
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV145N87G3BR0FFZWPW9KRYC
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV145Q7YFMVV7FYQDKE524B0
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV145SEFEVXZ31234N0QBRP2

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro8807
✅ example8807
✅ express8807
✅ fastify8807
✅ hono8807
✅ nextjs-turbopack9302
✅ nextjs-webpack9302
✅ nitro8807
✅ nuxt8807
✅ sveltekit8807
✅ vite8807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable8906
✅ express-stable8906
✅ fastify-stable8906
✅ hono-stable8906
✅ nextjs-turbopack-canary76019
✅ nextjs-turbopack-stable9500
✅ nextjs-webpack-canary76019
✅ nextjs-webpack-stable9500
✅ nitro-stable8906
✅ nuxt-stable8906
✅ sveltekit-stable8906
✅ vite-stable8906
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack9500
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb59170
✅ redis-dev302
❌ redis64120
✅ turso-dev302
❌ turso3730
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable8906
✅ e2e-local-dev-tanstack-start-stable8906
✅ e2e-local-postgres-nest-stable8906
✅ e2e-local-postgres-tanstack-start-stable8906
✅ e2e-local-prod-nest-stable8906
✅ e2e-local-prod-tanstack-start-stable8906

📋 View full workflow run

@VaguelySerious
VaguelySerious enabled auto-merge (squash) June 13, 2026 18:57
@VaguelySerious
VaguelySerious merged commit 5702933 into stableJun 13, 2026
94 of 97 checks passed
@VaguelySerious
VaguelySerious deleted the peter/fix-stable-waitforhook branch June 13, 2026 20:50
pranaygp added a commit that referenced this pull request Jun 13, 2026
…-stable
* origin/stable:
[test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
Update queue client to 0.3.1 (#2399) (#2401)
fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
pranaygp added a commit that referenced this pull request Jun 13, 2026
…getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranaygp added a commit that referenced this pull request Jun 14, 2026
…ing strategies (#2402)
* test: e2e coverage for run-idempotency conflict-handling strategies (#2387)
* test: e2e coverage for run-idempotency conflict-handling strategies
Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: fix adopt-owner-result race — gate owner completion on observed conflict
On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* review: assert superseded owner's returnValue rejection; empty changeset
- Await run1.returnValue and assert WorkflowRunCancelledError so the
cancellation is verified end-to-end and no rejection leaks from the
supersede test.
- Test-only PR: use an empty changeset.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ci: bust poisoned turbo cache entry for nextjs-turbopack build
The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
* fix(backport): adapt conflict-handling tests to stable's getConflict/getRun API
The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:
- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
`conflict.returnValue`/`conflict.cancel()`, but on `stable`
`getConflict()` resolves with `{ runId }`. Resolve the owning run via
`getRun(conflict.runId)` inside a step (the documented stable pattern)
to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
`forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
`waitForHookState(token, predicate)`; `waitForHook` does not exist on
`stable` (#2405 standardized on `waitForHookState`).
Both workbench builds and `biome check` pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backport): import HookNotFoundError in e2e test
The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).
Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Sign up for freeto 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.

2 participants

@VaguelySerious@pranaygp