Skip to content

workflow: re-land vercel-queue port, with the naming fixes it needed - #184

Merged
fantix merged 2 commits into
mainfrom
fantix/workflow-with-vercel-queue
Jul 31, 2026
Merged

workflow: re-land vercel-queue port, with the naming fixes it needed#184
fantix merged 2 commits into
mainfrom
fantix/workflow-with-vercel-queue

Conversation

@fantix

@fantix fantix commented Jul 16, 2026

Copy link
Copy Markdown
Member

Re-lands #185 (reverted in #189), plus the naming fixes it needs. Local-restart recovery, originally on this branch, moves to a follow-up PR.

Do not release before vercel/vercel#17236 is deployed, and ship this as vercel 0.8.0 — that PR gates on MIN_QUEUE_WORKFLOW_SDK_VERSION = '0.8.0'. Until it lands, the builder serves workflows through the legacy vercel-workers trampoline, which #185 removed. (The release flow already lands on 0.8.0.)

The fixes

With #17236 the builder introspects get_subscriptions() and copies our topic and consumer group into the trigger, so both have to be right:

  • Topic. sanitize_name()'s reversible encoding doubles underscores, putting __wkf_workflow_ outside the __wkf_* prefix the trigger pattern and platform-side service resolution key on. get_physical_topic() now does what @workflow/world-vercel does: replace non-[A-Za-z0-9-_] with -, nothing else.
  • Consumer group. VercelWorld passed none and fell back to the handler's qualname, which moves silently on rename. Now an explicit QUEUE_CONSUMER_GROUP = default, matching what createWorkflowQueueTrigger writes for TypeScript.

Both live in world.py and are shared by both worlds, so they can't drift.

Also: push callbacks use the world's own queue client, so acks and lease renewals inherit the proxy URL and token instead of a default QueueClient().

Testing

Contract tests for the topic mapping and consumer group in test_workflow_queue_namespace.py, with the reasoning in comments so nobody reaches for sanitize_name() again; test_workflow_step_retry_dispatch.py
updated to the real topics. Its isolated_subscriptions fixture moved to tests/unit/conftest.pycreate_queue_handler registers a subscriber as a side effect that otherwise leaks into later tests.

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Jul 28, 2026 8:44pm

Request Review

@fantix
fantix force-pushed the fantix/workflow-with-vercel-queue branch from f31846c to 962bb68 Compare July 28, 2026 19:43
@fantix
fantix force-pushed the fantix/workflow-with-vercel-queue branch from 962bb68 to c3c5b00 Compare July 28, 2026 20:44
@fantix fantix changed the title workflow: migrate from vercel-workers to vercel-queue workflow: re-land vercel-queue port, with the naming fixes it needed Jul 28, 2026
@fantix
fantix requested review from a team and msullivan July 28, 2026 20:59
@fantix
fantix marked this pull request as ready for review July 28, 2026 20:59
elprans and others added 2 commits July 31, 2026 16:47
Switch Workflow SDK from vercel-workers to vercel-queue

(cherry picked from commit 92d7b95)
The port to vercel-queue routed workflow topics through
`vqs.sanitize_name()`, whose reversible encoding doubles underscores, so
`__wkf_workflow_` went out as `____wkf__workflow__` — outside the
`__wkf_*` prefix that the builder's trigger pattern and platform service
resolution key on, and out of step with what `@workflow/world-vercel`
publishes. It also left `consumer_group` unset on `VercelWorld`, so
subscribers registered under a name derived from the handler's qualname,
which moves whenever that function is renamed. Dispatch is keyed on
`(consumer_group, topic)`, so both matter. Both worlds now share
`get_physical_topic()` and `QUEUE_CONSUMER_GROUP` in `world.py`.

The Vercel push callback hands the delivery to the world's own queue
client, so acks and lease renewals inherit the proxy URL and token
instead of falling back to an unconfigured default.
@fantix
fantix merged commit 069e1b3 into main Jul 31, 2026
13 checks passed
@fantix
fantix deleted the fantix/workflow-with-vercel-queue branch July 31, 2026 21:41
@msullivan msullivan mentioned this pull request Jul 31, 2026
msullivan added a commit that referenced this pull request Jul 31, 2026
vercel-internal-core
--------------------

0.1.1 - 2026-07-31
------------------

Bug Fixes
---------

- Bind asynchronous session clients to their running event loop to prevent failures when a shared session is used across multiple event loops or threads. (#220)

vercel-queue
------------

0.7.2 - 2026-07-31
------------------

Bug Fixes
---------

- Don't require `VERCEL_DEPLOYMENT_ID` to be set when running against a `vercel dev` queue broker. (#211)
- This will allow us to revert `vc dev` setting `VERCEL_DEPLOYMENT_ID`. (#211)

vercel-sandbox
--------------

0.3.0 - 2026-07-31
------------------

Features
--------

- Add `get_or_create_sandbox` to retrieve a named sandbox or create it when it does not exist, for both async and synchronous APIs. (#220)

vercel
------

0.8.0 - 2026-07-31
------------------

Breaking Changes
----------------

- `vercel.sandbox` is now the promoted Sandbox API that previously lived at `vercel.unstable.sandbox`. The former `vercel.sandbox` surface, including `AsyncSandbox`, `Command`, `AsyncCommand`, and `TokenProvider`, is gone, and `vercel.unstable` has been removed. Use `vercel.sandbox` for the async API and `vercel.sandbox.sync` for the synchronous API. (#195)
- The Sandbox implementation now ships in the separate `vercel-sandbox` distribution, which `vercel` depends on, so `vercel.sandbox` imports keep working without installing anything extra. (#195)
- Workflow and step identifiers now use `//` between the module and qualified name to match the TypeScript SDK format. (#220)

Features
--------

- Add `vercel.functions.wait_until()` for post-response asynchronous work that remains attached to the current Python Function invocation. (#218)
- Port from vercel-workers to vercel-queue (#184)

Internal
--------

- Move Vercel SDK tests under the package-local test suite. (#194)

vercel-celery
-------------

0.7.2 - 2026-07-31
------------------

- Update dependencies.

vercel-dramatiq
---------------

0.7.1 - 2026-07-31
------------------

- Update dependencies.
fantix added a commit that referenced this pull request Aug 14, 2026
`HTTPRequest` asked for `httpx.Headers`, which the vercel-queue port
introduced (#184) because the request object is handed straight to
`accept_and_handle` -- it satisfied that protocol and was the type at
hand. It is about to be public, and it should not make implementing an
adapter mean constructing httpx objects: vercel-queue's own push API
takes `Mapping[str, str]` and wraps it at the boundary.

So the contract is a plain mapping, and the wrapping moves to the one
place that reads headers. That is not cosmetic: a plain mapping is
case-sensitive, and only ASGI guarantees lowercase -- WSGI and
http.server do not -- so a delivery from either used to be answered
"Missing required headers".

`HTTPRequest` is also a Protocol now, so an adapter may supply the four
members on an object it already has instead of inheriting ours.
fantix added a commit that referenced this pull request Aug 15, 2026
`HTTPRequest` asked for `httpx.Headers`, which the vercel-queue port
introduced (#184) because the request object is handed straight to
`accept_and_handle` -- it satisfied that protocol and was the type at
hand. It is about to be public, and it should not make implementing an
adapter mean constructing httpx objects: vercel-queue's own push API
takes `Mapping[str, str]` and wraps it at the boundary.

So the contract is a plain mapping, and the wrapping moves to the one
place that reads headers. That is not cosmetic: a plain mapping is
case-sensitive, and only ASGI guarantees lowercase -- WSGI and
http.server do not -- so a delivery from either used to be answered
"Missing required headers".

`HTTPRequest` is also a Protocol now, so an adapter may supply the four
members on an object it already has instead of inheriting ours.
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.

3 participants