workflow: set a run's attributes from a workflow or a step - #303
Merged
Conversation
fantix
marked this pull request as draft
August 15, 2026 17:48
fantix
force-pushed
the
fantix/set-attributes
branch
from
August 20, 2026 03:45
d7a8ce6 to
a6e3005
Compare
fantix
force-pushed
the
fantix/set-attributes
branch
from
August 24, 2026 16:24
a6e3005 to
1b96fc9
Compare
fantix
force-pushed
the
fantix/set-attributes
branch
from
August 25, 2026 16:17
1b96fc9 to
85a6325
Compare
fantix
marked this pull request as ready for review
August 25, 2026 16:17
fantix
commented
Aug 25, 2026
| if not context.suspensions and events_created: | ||
| # We captured a _SuspendException but there is no suspension - this is likely caused | ||
| # by a disposed hook that cleared its suspensions. Just retry if event log changed. | ||
| if attributes_written or (not context.suspensions and events_created): |
Member
Author
There was a problem hiding this comment.
attributes_written is future-insufficient; AttrSetEvent is not the only event that - once written - is immediately eligible for another in-process replay. HookConflictEvent, StepFailedEvent are examples (each leading to a separate bug) of this branch. I shall promote attributes_written into a replay_ready flag or even a FlushResult class in a following PR.
msullivan
approved these changes
Aug 25, 2026
Comment on lines
+11
to
+12
| ATTRIBUTE_KEY_MAX_LENGTH = 256 | ||
| """Max length of an attribute key, in UTF-16 code units.""" |
scotttrinh
added a commit
that referenced
this pull request
Aug 26, 2026
vercel-internal-core -------------------- 0.1.3 - 2026-08-26 ------------------ Internal -------- - Support disabling HTTP timeouts for selected SDK operations while preserving the client default elsewhere. (#307) vercel-connect -------------- 0.1.1 - 2026-08-26 ------------------ - Update dependencies. vercel-queue ------------ 0.8.1 - 2026-08-26 ------------------ Documentation ------------- - Remove documentation and examples for `asgi_app` in preparation for its removal. (#309) vercel-sandbox -------------- 0.5.0 - 2026-08-26 ------------------ Features -------- - Add sync and async `fork_sandbox(...)` support for creating a sandbox from an existing named sandbox with optional configuration overrides. (#257) - Add `region` and `failover_regions` configuration for sandbox creation, forks, and updates, plus multi-region snapshot availability reporting. (#308) Bug Fixes --------- - Allow Sandbox process waits and log streams to remain idle longer than the session HTTP timeout. (#307) vercel-workflow --------------- 0.10.0 - 2026-08-26 ------------------- Breaking Changes ---------------- - Use type annotations on workflows and step to allow passing Pydantic models and dataclasses. (#317) - This is a breaking change, because type annotations will now be enforced. Passing a `dict` when the declaration expects a `list` will fail. (#317) - Pydantic models and dataclasses can no longer be passed to `@serializable` or `register_serializable()`. Annotate the workflow or step parameter or return value with their type instead. (#317) Features -------- - `get_workflow_metadata()` returns the current run's `WorkflowInfo` (run id, workflow name, start time, deployment URL, and feature flags), callable from a workflow body or a step body — mirroring the JS SDK's `getWorkflowMetadata()`. (#320) - One current limitation is that `started_at` is `None` from inside a step. (#320) - `BaseHook.wait()` accepts `metadata` to record on the hook, and `get_hook_by_token()` reads it back for a resumer. (#301) - A step can raise `RetryableError` to control when its next attempt runs. (#302) - Accept `specVersion` 7 sealed noop event logs. (#319) - A workflow or step can attach plaintext metadata to its run with `set_attributes()`. (#303) - Add a `share_sandboxes` parameter to `SandboxPolicy` to enable reusing already created sandboxes instead of creating a new one on each invocation. This speeds up workflows but means that modifications to global state may persist between invocations. (#310) - Expose unstable API to serve workflow HTTP endpoint from your own web framework. (#294) - Added semi-internal manifest API for TS tools and e2e test. (#296) Bug Fixes --------- - Fix failing or even crashing cipher calls inside the workflow sandbox. (#305) - Support resuming hooks with payload in the queue message. (#300) - Fixed nulls rejected by server, requiring Pydantic 2.12 or newer. (#321) - Fixed workflow and step calls with both positional-or-keyword parameters and `*args` failing during replay because their arguments were recorded in an unbindable shape. (#312) Internal -------- - Construct the protocol models by Python field name. (#322) vercel ------ 0.11.0 - 2026-08-26 ------------------- Features -------- - Expose `get_deadline()` for reading the current Function invocation deadline. (#306) - Answer workflow health checks for both queue-based transport and HTTP. (#292) - Add support to read the sealed (`encp`) workflow payloads (X25519 + AES-GCM) an outside writer addresses to a run, under the `encryption` extra. (#297) Bug Fixes --------- - Remove upper bounds on aggregate Sandbox and Workflow dependencies so sibling releases cannot make the `vercel` package un-installable. (#334) - Start a workflow run even when its queue message arrives before the `run_created` event has landed. (#284) Internal -------- - The Workflows implementation now ships in the separate `vercel-workflow` distribution, which `vercel` depends on, so `vercel.workflow` imports keep working without installing anything extra. (#299) vercel-apscheduler ------------------ 0.3.0 - 2026-08-26 ------------------ Breaking Changes ---------------- - The managed Redis backend was removed. The integration now always runs on its managed job store (Vercel Runtime Cache); a configured default `RedisJobStore` is rejected at import, `VERCEL_APSCHEDULER_BACKEND` accepts only `cache`, and the `redis` dependency is gone. The scheduler's durable identity now always derives from the builder-assigned subscriber id (previously the Redis `jobs_key`); the `scheduler_id` option still pins an identity explicitly. (#286) vercel-celery ------------- 0.7.5 - 2026-08-26 ------------------ - Update dependencies. vercel-django-tasks ------------------- 0.7.0 - 2026-08-26 ------------------ Features -------- - Add a Vercel Queues backend for Django Tasks and use it by default when no task backends are configured. (#291) vercel-dramatiq --------------- 0.7.4 - 2026-08-26 ------------------ - Update dependencies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds 3 new public APIs:
vercel.workflow.set_attributes()writes plaintext user key/value attributes onto the runvercel.workflow.remove_attributes()drops attributes by keysvercel.workflow.Run.attributes()fetches the current attributes of the run1 and 2 can only be called within a workflow run or a step, while 3 is only available on the client-side. In other words, workflows and steps themselves can only write attributes, for the caller to read.
For example, a workflow (or a step):
And the caller: