Repository navigation
[Async stack 4/6] Add cold async orchestration context - #361
Draft
andystaples wants to merge 14 commits into
Draft
andystaples wants to merge 14 commits into
andystaples wants to merge 14 commits into
Conversation
andystaples
marked this pull request as draft
November 12, 2026 16:30
andystaples
force-pushed
the
andystaples-async-stack-4-async-context
branch
from
November 12, 2026 16:48
7c3a7d9 to
ffe3599
Compare
andystaples
force-pushed
the
andystaples-async-stack-4-async-context
branch
from
November 12, 2026 18:40
ffe3599 to
60f02ab
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Expose Any when no reconstruction type is supplied, preserving existing decoding behavior and explicit return_type inference. Cover typed and raw results through replay and public typing fixtures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adapt the new parent classifier tests to the async context introduced by this layer, preserving their callable-chain coverage and asserting runtime context selection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
andystaples
force-pushed
the
andystaples-async-stack-4-async-context
branch
from
November 12, 2026 20:46
60f02ab to
f8347b8
Compare
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Guard AsyncOrchestrationContext against public API and metadata drift from OrchestrationContext with an explicit allowlist, reject non-finite create_timer delays like event timeouts, and cover the race-winner, completion-check, and result idioms. Document them along with un-awaited operations. Remove the changelog entry for unreleased behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 12, 2026
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> # Conflicts: # tests/durabletask/test_coroutine_orchestrators.py
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nc-stack-4-async-context Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
AsyncOrchestrationContext weakly tracks the operation coroutines it creates. Dispatch teardown closes any that never started, so an operation created before other awaits and awaited in a later dispatch no longer reports a never-awaited RuntimeWarning. Closing an unstarted coroutine schedules nothing and does not change the response. Remove the unreachable non-finite timedelta checks and their tests, and annotate remaining async test orchestrators with AsyncOrchestrationContext. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
| tags: dict[str, str] | None = ..., | ||
| return_type: None = ..., | ||
| ) -> Any: | ||
| ... |
| version: str | None = ..., | ||
| return_type: None = ..., | ||
| ) -> Any: | ||
| ... |
| self, entity: EntityInstanceId, operation: str, input: Any = ..., *, | ||
| return_type: None = ..., | ||
| ) -> Any: | ||
| ... |
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.
Warning
This PR is part of a review-only stack and must not be merged individually. The whole stack will be squash-merged after every PR is approved.
Layer 4/6. Async orchestrators receive a cold, await-only
AsyncOrchestrationContext. Durable operations return native, single-use coroutines: validation, serialization, scheduling, and relative deadline evaluation occur when execution starts, not when the coroutine is constructed. Inputs are not copied. Timers and event receives own their local registrations and withdraw them when the waiter exits; cancelling remote-work waiters does not cancel the underlying work. An operation can be created before other awaits and awaited later, even in a later dispatch; it is scheduled at its first await. The context weakly tracks the operation coroutines it creates, and dispatch teardown closes any that never started. That schedules nothing, leaves the response unchanged, and avoids a never-awaitedRuntimeWarning. Operations that have already started are left to the normal loop teardown.as_task_context()is the explicit escape hatch to eager scheduling and reusable durable task handles, including independent borrowed waiters throughTask.wait(),task.when_anywinner identification, and completion checks.The synchronous
OrchestrationContextand generator orchestration behavior remain unchanged. Async sub-orchestration calls withoutreturn_typeare typed asAny.Tests
tests/durabletask/test_async_context.py, covering context selection for supported async callable shapes, replay/action parity, cancellation ownership, timeout ordering, operations awaited in a later dispatch without never-awaited warnings, public result-type inference, and the race-winner, completion-check, and result idioms.AsyncOrchestrationContextwithOrchestrationContextagainst an explicit allowlist of intentional differences (as_task_context, async-onlytimeout, and which members are coroutines), plus a metadata parity test forinstance_id,parent_instance_id,version,current_utc_datetime, andis_replaying.task.AsyncOrchestrationContext, usingctx.as_task_context()where they need eager handles.tests/durabletask/typing/async_context.pyfor static typing checks.Docs and CI
docs/async-orchestrators.mddocuments sub-orchestration result typing, un-awaited operations, operations created before other awaits (withasyncio.create_taskto start one immediately), and an example of the winner, completion-check, and result idioms.async-runtime-windowsCI job from [Async stack 3/6] Dispatch cleanup for coroutine orchestrators #360 to runtest_async_context.py.Builds on #360. Functions integration (#363) and final documentation and release notes (#364) follow. The stack splits the closed #293.