Add patch activation callback#782
Merged
Merged
Conversation
Sushisource
force-pushed
the
patch-activation-callback
branch
3 times, most recently
from
July 15, 2026 17:21
81323b6 to
8399fc4
Compare
Sushisource
marked this pull request as ready for review
July 15, 2026 17:44
Sushisource
force-pushed
the
patch-activation-callback
branch
from
July 17, 2026 18:48
8399fc4 to
5292791
Compare
jmaeagle99
approved these changes
Jul 17, 2026
jmaeagle99
left a comment
Contributor
There was a problem hiding this comment.
Few minor comments but looks good overall.
| connections now compress outbound requests and accept gzip-compressed responses by default. If the remote | ||
| service does not support gzip compression, the connection is downgraded to uncompressed requests. Set it | ||
| to `GrpcCompression.None` to opt out. | ||
| - Added AWS Lambda worker support packages, including OpenTelemetry helpers for Lambda workers. |
Contributor
There was a problem hiding this comment.
Looks to be accidentally duplicated. Please remove.
| service does not support gzip compression, the connection is downgraded to uncompressed requests. Set it | ||
| to `GrpcCompression.None` to opt out. | ||
| - Added AWS Lambda worker support packages, including OpenTelemetry helpers for Lambda workers. | ||
| - Added the experimental `TemporalWorkerOptions.PatchActivationCallback`, allowing workers to |
Contributor
There was a problem hiding this comment.
Please move to Unreleased section.
| /// <inheritdoc/> | ||
| public void AssertNotReadOnly(string operation) | ||
| { | ||
| if (contextFrozen || inQueryOrValidator) |
Contributor
There was a problem hiding this comment.
I think the hardening is fine to add, but maybe add something in the changelog to raise that this is intentionally being checked, especially for queries and validators.
Sushisource
force-pushed
the
patch-activation-callback
branch
from
July 17, 2026 23:05
5292791 to
811a664
Compare
Sushisource
enabled auto-merge (squash)
July 17, 2026 23:05
Sushisource
force-pushed
the
patch-activation-callback
branch
from
July 18, 2026 00:44
811a664 to
ea7e71a
Compare
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.
What was changed
Added an experimental
TemporalWorkerOptions.PatchActivationCallbackthat lets a worker decide whether the first newly encountered, non-replayWorkflow.Patchedcall activates a patch.The callback receives workflow information and the patch ID. Its boolean decision is memoized for the workflow run. Declined patches return
falsewithout recording a marker, while replay, existing history markers, and deprecated patches retain their existing behavior.This ports the behavior introduced by temporalio/sdk-ruby#481.
The work is intentionally split into two commits:
Add patch activation callbackcontains only the callback API, plumbing, activation semantics, and rollout tests.Harden read-only workflow contextsmakes the callback read-only and completes the workflow context's read-only enforcement. This includes guarding nested patches, workflow metadata and handler mutation, continue-as-new, and patch calls from queries and update validators.Note
We can drop the second commit if it feels like too much to put in the PR, but, it's done and I think adds some nice safety.
Why?
This allows workflow changes using
Workflow.Patchedto roll out gradually without every new-code worker immediately recording a marker that older workers cannot replay.Keeping the read-only hardening in a subsequent commit separates the callback's intended behavior from the broader workflow-context consistency fixes discovered during review.
Testing