Temporal Knowledge Patch
Use this skill when designing, reviewing, debugging, deploying, or operating
Temporal Workflows, Activities, Workers, Worker Deployments, CLI automation, or
Temporal Cloud connectivity.
How to apply this skill
- Identify whether the change touches deterministic Workflow code, Activity
side effects, Worker routing, deployment state, CLI configuration, or Cloud
access.
- For Workflow edits, classify the change before implementation. Replay-safe
changes can ship directly; Command-producing changes need Worker Versioning
or patching.
- For Worker rollouts, choose Pinned or Auto-Upgrade from execution lifetime
and replay requirements, then verify the new code against representative
histories.
- For CLI and Cloud work, inspect the target address, Namespace, profile,
authentication, TLS server name, and replacement semantics before changing
state.
- Prefer project manifests, deployed Server and CLI versions, code, tests, and
observed behavior when they differ from this guidance.
Reference index
| Reference |
Topics |
| workflows-activities-and-replay.md |
Replay compatibility, Command-producing edits, Activity retries and Heartbeats, replay-safe SDK APIs, pre-deployment replay |
| workers-and-deployments.md |
SDK support, Worker topology and identity, Worker Versioning requirements, routing, overrides, drainage, and version collection |
| cli-and-self-hosted-operations.md |
Cloud routing, Schedules, remote Clusters, replicated Namespaces, Nexus Endpoints, configuration, TLS, and output |
| cloud-security-connectivity-and-migration.md |
API keys, Namespace authentication, private connectivity, rule replacement, DNS/SNI, control plane, and migration |
Breaking-change triage
Workflow compatibility is about emitted Commands and recorded events, not only
source-level API compatibility.
Usually replay-compatible
- Change Activity or Child Workflow inputs, return values, or execution
timeouts without changing their types or IDs.
- Change external Signal inputs.
- Change a Timer duration, except between
0 and nonzero in Java, Python, and
Go, or between -1 (infinite) and another value in .NET.
- Call Workflow APIs that do not emit Commands.
- Add a Signal Handler only if no Signal of that type has already been
received in histories that will replay.
Version or patch these changes
- Add, remove, or reorder scheduling or cancellation of Timers, Activities, or
Child Workflows.
- Add, remove, or reorder external Signals or Nexus operations.
- Change termination, patch/version, Search Attribute, Memo, Side Effect, or
Mutable Side Effect calls.
- Change an Activity Type, Child Workflow Type, or their IDs.
Use the current Worker Versioning model as the primary rollout mechanism.
Patching remains useful by itself or with Worker Versioning. Do not build new
rollouts around the pre-2025 experimental Worker Versioning method; it was
scheduled for removal from Temporal Server in March 2026.
Never branch business logic on replay state
Replay-state guards are observability tools. In Python,
workflow.unsafe.is_replaying(), and in TypeScript,
workflowInfo().unsafe.isReplaying, may suppress custom metrics or
notifications. Branching Workflow business logic on these values violates
determinism.
For behavior matching built-in logging and tracing, use Python
workflow.unsafe.is_replaying_history_events() or TypeScript
workflowInfo().unsafe.isReplayingHistoryEvents. Both are false for read-only
Queries and Update validators.
Activity correctness under retries
Activity completion is observed exactly once, but Activity code is not executed
exactly once. A Worker can perform an external side effect, crash before
reporting completion, and execute the code again under the Retry Policy.
- Make side effects idempotent.
- For an external key stable across attempts, combine Workflow Run ID with
Activity ID.
- Configure at least one Activity timeout, normally Start-to-Close.
- Operations lasting more than a few minutes should Heartbeat or poll.
- A retry restarts from initial state unless Heartbeats established recoverable
progress.
- A running Activity must permit Heartbeating for cancellation to be delivered.
Choose a Worker routing behavior
Pinned
Use Pinned when a Workflow should finish before its build is retired. A
long-lived Workflow that Continue-as-New can remain Pinned during each run and
upgrade at the run boundary.
Auto-Upgrade
Use Auto-Upgrade with replay-safe patching for executions spanning builds.
During migration, making Auto-Upgrade the Worker default most closely preserves
legacy routing until every Workflow Type has an explicit annotation.
Child Workflows of an Auto-Upgrade parent or predecessor default to Auto-Upgrade
rather than Unspecified. If Current or Ramping Workers are missing or
undersized, their traffic share can block instead of spilling to the other
version.
Deployment shapes
- Rolling deployments are incompatible with Worker Versioning.
- Blue-green deployments can use controlled routing, but should use
Auto-Upgrade instead of pinning.
- Rainbow deployments keep more than two versions so pinned executions can
drain on their original builds.
Worker Versioning readiness
The current model requires at least:
| Component |
Minimum |
| Go SDK |
1.35.0 |
| Python SDK |
1.11 |
| Java SDK |
1.29 |
| TypeScript SDK |
1.12 |
| .NET SDK |
1.7.0 |
| Ruby SDK |
0.5.0 |
| Self-hosted CLI |
1.4.1 |
| Self-hosted Server |
1.29.1 |
| Self-hosted UI |
2.38.0 |
A versioned Worker opts in with deployment name, Build ID, and optionally a
default behavior. Without a default, every Workflow Type must declare its
behavior. In serverless environments, point versions at qualified, versioned
function ARNs; an unqualified target can change beneath a pinned execution.
Safe rollout sequence
- Start the candidate Worker in verification mode without polling the
production Task Queue.
- Query representative recent executions, convert the result iterator with
map_histories(), and run Replayer.replay_workflows().
- Fail the deployment on any replay error.
- Start versioned Workers and wait until they poll their Task Queues.
- Set the deployment's Current Version.
- Optionally set a Ramping Version and a small percentage.
- Inspect execution behavior, assigned version, and overrides with
temporal workflow describe.
- Retire a version only after drainage status reaches Drained and required
closed-Workflow Query support is accounted for.
Do not place encrypted Payload histories into a replay environment that cannot
decrypt them. Scrub PII or keep those histories out of pre-deployment and CI
replay paths.
Routing invariants
A Worker Deployment Version is deployment name plus Build ID. One version may
contain Workers polling several Task Queues, and a Task Queue joins when one of
those Workers polls it. Each deployment has one Current Version and optionally
one Ramping Version. New Pinned and Auto-Upgrade Workflows start only on one of
those two versions.
Move pinned executions only after establishing replay compatibility with the
target code. An incompatible rollback needs
reset with-workflow-update-options so reset and reassignment are atomic.
Changing a mistakenly long-lived execution to Auto-Upgrade resumes it on its
Target Version; patch that target if it differs from the history-producing
build.
SDK determinism quick reference
Python
- Decorate
__init__ with @workflow.init when handlers need initialized
input state. Its parameters and annotations must match @workflow.run.
- Use
workflow.logger, workflow.random(), workflow.uuid4(), and
workflow.now() inside Workflows.
- Avoid standard logging, randomness, UUID, and wall-clock APIs in Workflow
code.
TypeScript
- Workflow bundles may import packages only when they do not reference Node.js
or DOM APIs.
- Put provably unused forbidden modules in
BundleOptions.ignoreModules.
- Import Activity types into Workflow code, never Activity implementations.
WeakRef, FinalizationRegistry, and crypto.randomUUID() are unavailable.
- Sandboxed
Math.random(), Date, and setTimeout() are deterministic.
UUID libraries backed by Math.random() are safe.
Date.now() and new Date() return the last Workflow Task completion time,
which advances only after an await.
CLI safety checks
temporal cloud login authenticates the CLI but does not implicitly route
service commands. Set the Cloud gRPC address and fully qualified Namespace.
- Use the Cloud extension's
temporal cloud namespace commands for Cloud
Namespace administration, not temporal operator namespace.
- Distinguish TOML
--config-file/--profile from YAML
--env-file/--env.
--api-key or any TLS option enables TLS automatically. Use --tls=false
only for an intentional plaintext override.
- Remember that archival state and URI are separate for History and
Visibility, and an enabled archival URI is immutable.
- Nexus Endpoint updates patch only the supplied fields.
Cloud connectivity safety checks
Connectivity Rules select allowed paths, not individual connections. No rules
means public traffic and configured private paths are accepted; attaching any
rule immediately rejects every unmatched path. The Web UI is outside this
enforcement.
Rule attachments are complete-set replacements. Stage a public rule alongside
private rules before removing public access. --remove-all returns the
Namespace to public access. Because rules cannot be edited, replace and
reattach them when requirements change.
Private connectivity does not configure client DNS. Set private DNS or use the
private endpoint address and the correct TLS server name for the authentication
mode and active region. A wrong SNI value can reset TLS even when port 7233 is
reachable.
Final review checklist
- Workflow changes are classified against recorded Commands.
- Replay-state APIs affect observability only.
- Activity side effects have stable idempotency keys and Heartbeats where
needed.
- Candidate code replays representative, decryptable, privacy-safe histories.
- Current and Ramping assignments happen after Workers begin polling.
- Overrides and rollbacks include replay compatibility and atomic reset needs.
- CLI address, Namespace, configuration selector, TLS, and output mode are
explicit.
- Cloud rule replacement, DNS, SNI, RBAC, and API-key limits are checked before
access changes.
1---2name: temporal-knowledge-patch3description: Temporal4license: MIT5---678# Temporal Knowledge Patch910Use this skill when designing, reviewing, debugging, deploying, or operating11Temporal Workflows, Activities, Workers, Worker Deployments, CLI automation, or12Temporal Cloud connectivity.1314## How to apply this skill15161. Identify whether the change touches deterministic Workflow code, Activity17 side effects, Worker routing, deployment state, CLI configuration, or Cloud18 access.192. For Workflow edits, classify the change before implementation. Replay-safe20 changes can ship directly; Command-producing changes need Worker Versioning21 or patching.223. For Worker rollouts, choose Pinned or Auto-Upgrade from execution lifetime23 and replay requirements, then verify the new code against representative24 histories.254. For CLI and Cloud work, inspect the target address, Namespace, profile,26 authentication, TLS server name, and replacement semantics before changing27 state.285. Prefer project manifests, deployed Server and CLI versions, code, tests, and29 observed behavior when they differ from this guidance.3031## Reference index3233| Reference | Topics |34| --- | --- |35| [workflows-activities-and-replay.md](references/workflows-activities-and-replay.md) | Replay compatibility, Command-producing edits, Activity retries and Heartbeats, replay-safe SDK APIs, pre-deployment replay |36| [workers-and-deployments.md](references/workers-and-deployments.md) | SDK support, Worker topology and identity, Worker Versioning requirements, routing, overrides, drainage, and version collection |37| [cli-and-self-hosted-operations.md](references/cli-and-self-hosted-operations.md) | Cloud routing, Schedules, remote Clusters, replicated Namespaces, Nexus Endpoints, configuration, TLS, and output |38| [cloud-security-connectivity-and-migration.md](references/cloud-security-connectivity-and-migration.md) | API keys, Namespace authentication, private connectivity, rule replacement, DNS/SNI, control plane, and migration |3940## Breaking-change triage4142Workflow compatibility is about emitted Commands and recorded events, not only43source-level API compatibility.4445### Usually replay-compatible4647- Change Activity or Child Workflow inputs, return values, or execution48 timeouts without changing their types or IDs.49- Change external Signal inputs.50- Change a Timer duration, except between `0` and nonzero in Java, Python, and51 Go, or between `-1` (infinite) and another value in .NET.52- Call Workflow APIs that do not emit Commands.53- Add a Signal Handler only if no Signal of that type has already been54 received in histories that will replay.5556### Version or patch these changes5758- Add, remove, or reorder scheduling or cancellation of Timers, Activities, or59 Child Workflows.60- Add, remove, or reorder external Signals or Nexus operations.61- Change termination, patch/version, Search Attribute, Memo, Side Effect, or62 Mutable Side Effect calls.63- Change an Activity Type, Child Workflow Type, or their IDs.6465Use the current Worker Versioning model as the primary rollout mechanism.66Patching remains useful by itself or with Worker Versioning. Do not build new67rollouts around the pre-2025 experimental Worker Versioning method; it was68scheduled for removal from Temporal Server in March 2026.6970## Never branch business logic on replay state7172Replay-state guards are observability tools. In Python,73`workflow.unsafe.is_replaying()`, and in TypeScript,74`workflowInfo().unsafe.isReplaying`, may suppress custom metrics or75notifications. Branching Workflow business logic on these values violates76determinism.7778For behavior matching built-in logging and tracing, use Python79`workflow.unsafe.is_replaying_history_events()` or TypeScript80`workflowInfo().unsafe.isReplayingHistoryEvents`. Both are false for read-only81Queries and Update validators.8283## Activity correctness under retries8485Activity completion is observed exactly once, but Activity code is not executed86exactly once. A Worker can perform an external side effect, crash before87reporting completion, and execute the code again under the Retry Policy.8889- Make side effects idempotent.90- For an external key stable across attempts, combine Workflow Run ID with91 Activity ID.92- Configure at least one Activity timeout, normally Start-to-Close.93- Operations lasting more than a few minutes should Heartbeat or poll.94- A retry restarts from initial state unless Heartbeats established recoverable95 progress.96- A running Activity must permit Heartbeating for cancellation to be delivered.9798## Choose a Worker routing behavior99100### Pinned101102Use Pinned when a Workflow should finish before its build is retired. A103long-lived Workflow that Continue-as-New can remain Pinned during each run and104upgrade at the run boundary.105106### Auto-Upgrade107108Use Auto-Upgrade with replay-safe patching for executions spanning builds.109During migration, making Auto-Upgrade the Worker default most closely preserves110legacy routing until every Workflow Type has an explicit annotation.111112Child Workflows of an Auto-Upgrade parent or predecessor default to Auto-Upgrade113rather than Unspecified. If Current or Ramping Workers are missing or114undersized, their traffic share can block instead of spilling to the other115version.116117### Deployment shapes118119- Rolling deployments are incompatible with Worker Versioning.120- Blue-green deployments can use controlled routing, but should use121 Auto-Upgrade instead of pinning.122- Rainbow deployments keep more than two versions so pinned executions can123 drain on their original builds.124125## Worker Versioning readiness126127The current model requires at least:128129| Component | Minimum |130| --- | --- |131| Go SDK | 1.35.0 |132| Python SDK | 1.11 |133| Java SDK | 1.29 |134| TypeScript SDK | 1.12 |135| .NET SDK | 1.7.0 |136| Ruby SDK | 0.5.0 |137| Self-hosted CLI | 1.4.1 |138| Self-hosted Server | 1.29.1 |139| Self-hosted UI | 2.38.0 |140141A versioned Worker opts in with deployment name, Build ID, and optionally a142default behavior. Without a default, every Workflow Type must declare its143behavior. In serverless environments, point versions at qualified, versioned144function ARNs; an unqualified target can change beneath a pinned execution.145146## Safe rollout sequence1471481. Start the candidate Worker in verification mode without polling the149 production Task Queue.1502. Query representative recent executions, convert the result iterator with151 `map_histories()`, and run `Replayer.replay_workflows()`.1523. Fail the deployment on any replay error.1534. Start versioned Workers and wait until they poll their Task Queues.1545. Set the deployment's Current Version.1556. Optionally set a Ramping Version and a small percentage.1567. Inspect execution behavior, assigned version, and overrides with157 `temporal workflow describe`.1588. Retire a version only after drainage status reaches Drained and required159 closed-Workflow Query support is accounted for.160161Do not place encrypted Payload histories into a replay environment that cannot162decrypt them. Scrub PII or keep those histories out of pre-deployment and CI163replay paths.164165## Routing invariants166167A Worker Deployment Version is deployment name plus Build ID. One version may168contain Workers polling several Task Queues, and a Task Queue joins when one of169those Workers polls it. Each deployment has one Current Version and optionally170one Ramping Version. New Pinned and Auto-Upgrade Workflows start only on one of171those two versions.172173Move pinned executions only after establishing replay compatibility with the174target code. An incompatible rollback needs175`reset with-workflow-update-options` so reset and reassignment are atomic.176Changing a mistakenly long-lived execution to Auto-Upgrade resumes it on its177Target Version; patch that target if it differs from the history-producing178build.179180## SDK determinism quick reference181182### Python183184- Decorate `__init__` with `@workflow.init` when handlers need initialized185 input state. Its parameters and annotations must match `@workflow.run`.186- Use `workflow.logger`, `workflow.random()`, `workflow.uuid4()`, and187 `workflow.now()` inside Workflows.188- Avoid standard logging, randomness, UUID, and wall-clock APIs in Workflow189 code.190191### TypeScript192193- Workflow bundles may import packages only when they do not reference Node.js194 or DOM APIs.195- Put provably unused forbidden modules in `BundleOptions.ignoreModules`.196- Import Activity types into Workflow code, never Activity implementations.197- `WeakRef`, `FinalizationRegistry`, and `crypto.randomUUID()` are unavailable.198- Sandboxed `Math.random()`, `Date`, and `setTimeout()` are deterministic.199 UUID libraries backed by `Math.random()` are safe.200- `Date.now()` and `new Date()` return the last Workflow Task completion time,201 which advances only after an `await`.202203## CLI safety checks204205- `temporal cloud login` authenticates the CLI but does not implicitly route206 service commands. Set the Cloud gRPC address and fully qualified Namespace.207- Use the Cloud extension's `temporal cloud namespace` commands for Cloud208 Namespace administration, not `temporal operator namespace`.209- Distinguish TOML `--config-file`/`--profile` from YAML210 `--env-file`/`--env`.211- `--api-key` or any TLS option enables TLS automatically. Use `--tls=false`212 only for an intentional plaintext override.213- Remember that archival state and URI are separate for History and214 Visibility, and an enabled archival URI is immutable.215- Nexus Endpoint updates patch only the supplied fields.216217## Cloud connectivity safety checks218219Connectivity Rules select allowed paths, not individual connections. No rules220means public traffic and configured private paths are accepted; attaching any221rule immediately rejects every unmatched path. The Web UI is outside this222enforcement.223224Rule attachments are complete-set replacements. Stage a public rule alongside225private rules before removing public access. `--remove-all` returns the226Namespace to public access. Because rules cannot be edited, replace and227reattach them when requirements change.228229Private connectivity does not configure client DNS. Set private DNS or use the230private endpoint address and the correct TLS server name for the authentication231mode and active region. A wrong SNI value can reset TLS even when port 7233 is232reachable.233234## Final review checklist235236- Workflow changes are classified against recorded Commands.237- Replay-state APIs affect observability only.238- Activity side effects have stable idempotency keys and Heartbeats where239 needed.240- Candidate code replays representative, decryptable, privacy-safe histories.241- Current and Ramping assignments happen after Workers begin polling.242- Overrides and rollbacks include replay compatibility and atomic reset needs.243- CLI address, Namespace, configuration selector, TLS, and output mode are244 explicit.245- Cloud rule replacement, DNS, SNI, RBAC, and API-key limits are checked before246 access changes.