workflow 5.8.0 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/api-reference/workflow/rate-limit.mdx +1 -1
- package/docs/api-reference/workflow-errors/in-band-superseded-error.mdx +5 -1
- package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +6 -4
- package/docs/api-reference/workflow-runtime/world/queue.mdx +5 -1
- package/docs/configuration/runtime-tuning.mdx +468 -168
- package/docs/cookbook/integrations/chat-sdk.mdx +1 -1
- package/docs/performance.mdx +93 -59
- package/docs/worlds/building-a-world.mdx +2 -1
- package/docs/worlds/local.mdx +6 -2
- package/docs/worlds/postgres.mdx +7 -3
- package/docs/worlds/vercel.mdx +2 -2
- package/package.json +11 -11
|
@@ -14,7 +14,7 @@ related:
|
|
|
14
14
|
Waits for a slot under a rate limit that every run of the project shares. Calls with the same `key` get slots at most `limit` per `period`, each at least `period / limit` after the one before. A call whose slot is now resolves at once; otherwise the run sleeps until its slot, like [`sleep()`](/docs/api-reference/workflow/sleep), and resolves then. A call that wakes late can go ahead a little after its slot (see [Calls that wake late](#calls-that-wake-late)), so keep handling the upstream's own rate limit errors. For when and how to use rate limits, see [Rate Limits](/docs/foundations/rate-limits).
|
|
15
15
|
|
|
16
16
|
<Callout type="warn">
|
|
17
|
-
Experimental, and available in `workflow` 5.8.0 and later on the Vercel, Local and Postgres Worlds.
|
|
17
|
+
Experimental, and available in `workflow` 5.8.0 and later on the Vercel, Local and Postgres Worlds. On a third-party World that does not declare rate limits (`capabilities.rateLimits`), or with [`WORKFLOW_SPEC_VERSION`](/docs/configuration/runtime-tuning#workflow_spec_version) set below `10`, a run that calls it fails.
|
|
18
18
|
</Callout>
|
|
19
19
|
|
|
20
20
|
```typescript lineNumbers
|
|
@@ -7,7 +7,7 @@ related:
|
|
|
7
7
|
- /docs/api-reference/workflow-errors/workflow-world-error
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
A World throws `InBandSupersededError` (HTTP 412, code `in-band-superseded`) when it refuses a write made by a run's orchestrator because another invocation of the same run's orchestrator has written in-band since this one loaded the event log.
|
|
10
|
+
A World throws `InBandSupersededError` (HTTP 412, code `in-band-superseded`) when it refuses a write made by a run's orchestrator because another invocation of the same run's orchestrator has written in-band since this one loaded the event log.
|
|
11
11
|
|
|
12
12
|
<Callout>
|
|
13
13
|
The Workflow runtime handles this error. The refused invocation stops writing, sends the queue messages its own committed writes still owe, and asks for a redelivery of its queue message instead of acknowledging it. You will only encounter it when interacting with World storage APIs directly.
|
|
@@ -28,6 +28,10 @@ try {
|
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
<Spec8Note>
|
|
32
|
+
the runtime does not fence its writes, and no World throws this error.
|
|
33
|
+
</Spec8Note>
|
|
34
|
+
|
|
31
35
|
## API signature
|
|
32
36
|
|
|
33
37
|
### Properties
|
|
@@ -14,11 +14,13 @@ No World in this repository throws it. A stale replay does not need to be refuse
|
|
|
14
14
|
|
|
15
15
|
A World rejects only on evidence and accepts the creation whenever it cannot decide. This error always means the snapshot was stale, but not receiving it does not prove the snapshot was current.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
The Workflow runtime handles this error by restarting the replay in the same invocation from a corrected event log. It re-invokes the run for a fresh replay only after spending its in-process restart budget. It never retries the rejected creation as-is because a replay working from a corrected log derives different events. You will only encounter it when interacting with World storage APIs directly.
|
|
19
|
-
</Callout>
|
|
17
|
+
A run's orchestrator writes behind the in-band fence, which has no precondition guard: the fence refuses a write only from a superseded invocation, with [`InBandSupersededError`](/docs/api-reference/workflow-errors/in-band-superseded-error).
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
<Spec8Note>
|
|
20
|
+
a World may refuse a write with this error. The Workflow runtime handles it by restarting the replay in the same invocation from a corrected event log, and re-invokes the run for a fresh replay only after spending its in-process restart budget. The runtime never retries the rejected creation as-is, because a replay working from a corrected log derives different events. You only encounter `PreconditionFailedError` when calling World storage APIs directly.
|
|
21
|
+
|
|
22
|
+
A World may attach the events the client was missing to the rejection as `details`, which lets the runtime restart without re-reading the event log. Attaching them is optional, and the runtime falls back to a full reload when the details are absent or unusable.
|
|
23
|
+
</Spec8Note>
|
|
22
24
|
|
|
23
25
|
```typescript lineNumbers
|
|
24
26
|
import { PreconditionFailedError } from "workflow/errors"
|
|
@@ -146,7 +146,11 @@ const handler = world.createQueueHandler(prefix, callback); // [!code highlight]
|
|
|
146
146
|
|
|
147
147
|
**Returns:** `(req: Request) => Promise<Response>`
|
|
148
148
|
|
|
149
|
-
`meta.messageId` should be stable across redeliveries of the same message (one ID per enqueued message, reused on every delivery attempt).
|
|
149
|
+
`meta.messageId` should be stable across redeliveries of the same message (one ID per enqueued message, reused on every delivery attempt).
|
|
150
|
+
|
|
151
|
+
<Spec8Note>
|
|
152
|
+
the runtime records `meta.messageId` on inline `step_started` events as a liveness lease, so that only a redelivery of the owning message re-executes a crashed inline step before the lease expires. A World whose queue mints a fresh ID per delivery degrades gracefully: crashed inline steps recover via the delayed backstop instead of immediately on redelivery, but never wedge or duplicate.
|
|
153
|
+
</Spec8Note>
|
|
150
154
|
|
|
151
155
|
## Related
|
|
152
156
|
|