馃挜 Preserve non-cancellable timed promise waits during cancellation - #3029
Open
Quinn-With-Two-Ns wants to merge 2 commits into
Open
Quinn-With-Two-Ns wants to merge 2 commits into
Quinn-With-Two-Ns wants to merge 2 commits into
Conversation
Quinn-With-Two-Ns
marked this pull request as ready for review
August 27, 2026 21:00
Quinn-With-Two-Ns
force-pushed
the
issue-3026
branch
from
August 27, 2026 21:00
e9a6774 to
05d1a03
Compare
maciejdudko
requested changes
Sep 15, 2026
Contributor
There was a problem hiding this comment.
Can we put resource files in a subdirectory?
Contributor
Author
There was a problem hiding this comment.
I put them in the folder all the existing json histories are
Quinn-With-Two-Ns
force-pushed
the
issue-3026
branch
from
September 15, 2026 20:52
05d1a03 to
b0b0a89
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
This change adds the
DETACH_NON_CANCELLABLE_PROMISE_GET_TIMERSDK flag and updates timed, non-cancellablePromise.get(timeout, unit)calls to run their timeout timer in a detached cancellation scope. The timer is canceled after the promise completes. Regression and replay tests cover promise completion, timeouts, activity cancellation, child workflow cancellation, and combinations withCANCEL_AWAIT_TIMER_ON_CONDITION. The activity tests use per-test latches for deterministic synchronization.Why?
Promise.get(timeout, unit)is non-cancellable, but cancellation of its enclosing scope previously canceled its timeout timer. This ended the wait early and incorrectly surfaced aTimeoutException, potentially hiding the actual activity or child workflow cancellation. The new SDK flag preserves replay compatibility for existing workflow histories while allowing new workflows to use the corrected behaviour.馃挜 Breaking changes
This change can affect workflow behaviour because timed, non-cancellable
Promise.get(timeout, unit)calls will no longer return early with aTimeoutExceptionwhen their enclosing cancellation scope is canceled. Instead, they will continue waiting until the promise completes, fails, or reaches its actual timeout. Workflows that currently catch the prematureTimeoutExceptionand use it to select a control flow path may therefore produce different results. The behaviour is protected by an SDK flag so existing workflow histories retain their original behaviour during replay, while new workflows can adopt the corrected semantics without causing nondeterminism.Checklist
Closes Promise.get(timeout, unit) throws a misleading TimeoutException when the workflow is canceled聽#3026
How was this tested:
Note
High Risk
Changes core workflow cancellation and timed-wait semantics on replay-sensitive promise paths; workflows that relied on premature timeouts after scope cancel may behave differently once the flag is enabled.
Overview
Fixes incorrect
TimeoutExceptionfrom non-cancellablePromise.get(timeout, unit)when a parentCancellationScopeis canceled: the scope was canceling the internal await timer and ending the wait early instead of letting the promise finish or fail.Adds SDK flag
DETACH_NON_CANCELLABLE_PROMISE_GET_TIMER(pending enable). When it is on in history,CompletablePromiseImplruns the timed await inside a detached cancellation scope and cancels that scope when the wait ends.WorkflowInternal.checkSdkFlagexposes flag checks to sync code. Legacy behavior is unchanged when the flag is off.Regression coverage includes parameterized integration tests (with
CANCEL_AWAIT_TIMER_ON_CONDITIONcombinations) and 12 replay history fixtures for promise, activity, child, and completion scenarios.Reviewed by Cursor Bugbot for commit b0b0a89. Bugbot is set up for automated code reviews on this repo. Configure here.