Skip to content

[Async stack 0/6] Async orchestrator contract - #356

Draft
andystaples wants to merge 3 commits into
mainfrom
andystaples-async-stack-0-contract-docs
Draft

andystaples wants to merge 3 commits into
mainfrom
andystaples-async-stack-0-contract-docs

Conversation

@andystaples

@andystaples andystaples commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Neither this PR nor any other PR in this stack should be merged on its own. The whole stack will be squash-merged once every PR in it is approved.

This is the contract-documentation layer (0/6) of a review-only stack that splits the closed #293. The APIs documented here are implemented in later layers; this PR changes documentation only. Later layers extend docs/async-orchestrators.md as they implement each area, and the final version of the contract is in #364.

  • Explain the motivation (Support async/await orchestrators across the Python SDK packages #294), goals, non-goals, and alternatives considered for native coroutine orchestrators.
  • Define native coroutine authoring across the core SDK, Azure Managed, and Azure Functions, including supported asyncio composition, cold operations versus reusable eager handles, and how orchestrators are classified as async or generator at registration.
  • Specify ownership, cancellation, timeout, and dispatch-teardown behavior, including the limits of cancelling already-issued remote work.
  • Establish deterministic replay constraints, unsupported I/O/composition APIs (asyncio.wait / asyncio.as_completed are documented as unsupported), and migration and Python-runtime compatibility limits, including keeping the Python minor version fixed for in-flight instances (Document Python runtime compatibility and safe upgrade guidance for durable orchestrations #337).

Differences from #293

The stack is roughly 800 lines larger than #293, mostly from hardening:

  • A dedicated dispatch-local loop module (durabletask/internal/asyncio_loop.py).
  • Cycle detection when classifying wrapped orchestrator callables.
  • Skipping entity lock-release scheduling during async dispatch cleanup.
  • An Any-typed overload for async sub-orchestration calls without return_type.
  • Additional replay, cleanup, and typing tests.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documentation incorrectly implies synchronous commands are awaitable, which can cause a TypeError after scheduling an action; it should explicitly state that these commands must be called without await.

1 open issue
What changed in this PR

This documentation-only PR defines the async orchestrator contract for the core SDK, Azure Managed, and Azure Functions. It establishes behavior that later layers of the review-only stack will implement.

Changes:

  • Describe coroutine authoring, cold operations, reusable handles, and Functions compatibility.
  • Specify deterministic asyncio composition, cancellation, timeouts, and dispatch cleanup.
  • Document replay migration constraints and Python-runtime compatibility limits.
File Description
docs/​supported-patterns.md Connects durable patterns to async authoring and clarifies root cancellation behavior.
docs/​features.md Introduces coroutine orchestrators alongside generator orchestrators.
docs/​async-orchestrators.md Defines the cross-package async contract and replay constraints.

Review effort: Balanced

Comment thread docs/async-orchestrators.md Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@andystaples
andystaples force-pushed the andystaples-async-stack-0-contract-docs branch from b420f99 to 73cac11 Compare November 12, 2026 16:48
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@@ -0,0 +1,296 @@
# Async orchestrators

All three packages accept native `async def` orchestrators alongside existing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question (resolve before merge): should async orchestrators ship as preview?

This change adds async orchestrators without a preview or experimental label. Two things could still change after release:

Should core and durabletask.azuremanaged label async orchestrators as preview in the docs and changelogs until those settle, or ship them as generally available? Please answer and resolve this thread before the stack merges.

…rnings

Add motivation, goals, non-goals, and alternatives considered; document the
orchestrator classification rule and that operation inputs are not copied;
promote the unsupported asyncio.wait/as_completed, dispatch-teardown, and
Python minor-version replay notes to callouts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants