Skip to content

fix(world): namespace startup re-enqueue queue names#2885

Closed
asdiamond wants to merge 1 commit into
vercel:mainfrom
asdiamond:fix/namespace-startup-reenqueue
Closed

fix(world): namespace startup re-enqueue queue names#2885
asdiamond wants to merge 1 commit into
vercel:mainfrom
asdiamond:fix/namespace-startup-reenqueue

Conversation

@asdiamond

Copy link
Copy Markdown

Problem

reenqueueActiveRuns (startup recovery in @workflow/world, used by world-local and world-postgres) hardcodes the un-namespaced queue prefix:

const queueName: ValidQueueName = `__wkf_workflow_${run.workflowName}`;

When the runtime operates under a queue namespace (WORKFLOW_QUEUE_NAMESPACE), the workflow handler is registered with the namespaced prefix __{namespace}_wkf_workflow_ and rejects anything else with HTTP 400 Unhandled queue. Live enqueues honor the namespace, so normal operation works — but every run recovered at startup is enqueued onto a name that can never match, and since rejected deliveries are retried without a cap, each recovered run becomes a permanent ~5s retry loop after every restart.

This is very visible downstream in eve, which installs an agent-scoped namespace on boot: any parked session produces endless log spam on every dev-server restart. Reported there as vercel/eve#715 (root-cause analysis in this comment):

[world-local] Re-enqueued 1 active run(s) on startup
[world-local] Queue message failed (attempt 1, HTTP 400) {
  queueName: '__wkf_workflow_workflow//eve//workflowEntry',
  handlerError: '{"error":"Unhandled queue"}'
}

Fix

Build the recovery queue name with the same namespace-aware helpers live enqueues use (getQueueTopicPrefix + resolveQueueNamespace), and accept an optional explicit namespace argument for worlds configured without the env var. Behavior without a namespace is unchanged (__wkf_workflow_…).

Testing

  • New recovery.test.ts covers the default (un-namespaced), env-var, and explicit-argument cases.
  • Full @workflow/world suite passes (74 tests) and tsc builds clean.
  • Verified end-to-end against the eve reproduction: with a namespaced handler, a parked run recovered on restart previously spammed Unhandled queue indefinitely; session continuation itself was unaffected (it goes through the namespaced live path), confirming the mismatch is isolated to recovery.

reenqueueActiveRuns hardcoded the un-namespaced __wkf_workflow_ prefix,
so on worlds running under a queue namespace (WORKFLOW_QUEUE_NAMESPACE,
e.g. eve agents) every recovered run was re-enqueued onto a queue name
the handler rejects with "Unhandled queue", producing an endless retry
loop after every restart.

Build the queue name with getQueueTopicPrefix + resolveQueueNamespace so
recovery targets the same queues as live enqueues, and accept an optional
explicit namespace argument for worlds configured without the env var.

Surfaced downstream in vercel/eve#715.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Aleksandr Diamond <diamondaleksandr@gmail.com>
@asdiamond asdiamond requested review from a team and ijjk as code owners July 12, 2026 04:33
@changeset-bot

changeset-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 42745f3

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

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

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

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

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

@asdiamond is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@VaguelySerious

VaguelySerious commented Jul 12, 2026

Copy link
Copy Markdown
Member

Thanks for making the PR! We separately found and addressed this in #2888. A release with the fix will go out soon

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants