René's URL Explorer Experiment


Title: [Async stack 1/6] Coroutine dispatch by andystaples · Pull Request #357 · microsoft/durabletask-python · GitHub

Open Graph Title: [Async stack 1/6] Coroutine dispatch by andystaples · Pull Request #357 · microsoft/durabletask-python

X Title: [Async stack 1/6] Coroutine dispatch by andystaples · Pull Request #357 · microsoft/durabletask-python

Description: WarningDo not merge this PR, or any other PR in the stack, on its own. The whole stack will be squash-merged once every PR in it is approved. Layer 1/6 of the async orchestrator stack, which splits the closed #293 for review. It is based on #356. Scope shared.is_async_callable classifies orchestrator callables. Each callable is checked directly first: coroutine functions are async and generator functions are synchronous, even when they carry functools.wraps metadata from a function of the other kind. Partials and callable objects resolve through func and __call__; only a callable that is neither falls back to the function it wraps. Cyclic __wrapped__ chains are reported as errors. The worker registry classifies each orchestrator once, at registration, so wrapper cycles fail when the orchestrator is registered rather than on every dispatch. Validation at the point where the worker calls the orchestrator: A sync callable that returns a coroutine is rejected, and the coroutine is closed. An async-classified callable that returns something other than a coroutine is rejected with guidance about functools.wraps. If it returned a generator, that generator is closed. Async generators are rejected. Generators that yield anything other than a Task are rejected with TypeError ("The orchestrator generator yielded a non-Task object", plus a hint to use async def). This now includes the first yield, so a bare first yield or yield [task] fails on the first dispatch. Previously a bare first yield left the instance pending indefinitely, and a non-Task first yield scheduled its work and then failed later with AttributeError. The worker runs coroutine orchestrators and resumes them during replay through a minimal deterministic DurableEventLoop (durabletask/internal/asyncio_loop.py). This loop is enough to: drive the root coroutine suspend it on durable tasks deliver completions fail when the orchestrator is blocked on work that isn't durable loop.time() is derived from the replay-safe orchestration clock (naive or timezone-aware). Loop timers, including asyncio.sleep() with a positive delay, fail with an error that points to ctx.create_timer(...) until #358 adds durable loop timers. The module docstring of asyncio_loop.py lists each private asyncio API the loop depends on and why. Task.__await__ and Task.wait() are now concrete. Inside the durable loop, awaiting suspends on the durable task. Awaiting with no running loop or under a different event loop raises RuntimeError. Adds the SyncOrchestrator, AsyncOrchestrator, and Orchestrator aliases. Generator orchestrators that yield durable tasks behave as before, and a new test replays a generator history in the form earlier releases record it. The only generator change is the first-yield check above. Teardown now always closes the orchestrator, whether it is a generator or a coroutine. Temporary differences (resolved in later layers) Context: async orchestrators receive the existing OrchestrationContext, and AsyncOrchestrator is typed against it. Layer 4/6 (#361) adds the cold AsyncOrchestrationContext, its tests, and the context API and metadata parity tests. Event loop: general asyncio composition (durable timers and asyncio.sleep with a positive delay, TaskGroup ordering) and the executor and thread guards come in layer 2/6 (#358). Teardown: the cleanup and quiesce policy and async-generator hooks come in layer 3/6 (#360). Changelog: layers 0-5 do not touch changelogs. The release entries are added only in layer 6/6 (#364).

Open Graph Description: WarningDo not merge this PR, or any other PR in the stack, on its own. The whole stack will be squash-merged once every PR in it is approved. Layer 1/6 of the async orchestrator stack, which split...

X Description: WarningDo not merge this PR, or any other PR in the stack, on its own. The whole stack will be squash-merged once every PR in it is approved. Layer 1/6 of the async orchestrator stack, which split...

Opengraph URL: https://github.com/microsoft/durabletask-python/pull/357

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:faa4bcbf-28ce-f533-3a9a-9b9f55061495
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDFF0:2C6222:49E1E:6265B:6AFE2E91
html-safe-nonce0ba9d204240594fb03175d13b9c8ca7eb4ba8a9294a506b85824c5b8d3ad3735
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkYwOjJDNjIyMjo0OUUxRTo2MjY1Qjo2QUZFMkU5MSIsInZpc2l0b3JfaWQiOiIzMTI0NjgzNDAwNzc5MDE3ODczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca6a43065225519b9a93ef740fd2cf5262ddd48a138e552c98edf5bf08bb6f4bb
hovercard-subject-tagpull_request:5265656762
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/durabletask-python/pull/357/files
twitter:imagehttps://avatars.githubusercontent.com/u/77818326?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/77818326?s=400&v=4
og:image:altWarningDo not merge this PR, or any other PR in the stack, on its own. The whole stack will be squash-merged once every PR in it is approved. Layer 1/6 of the async orchestrator stack, which split...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id627664515
octolytics-dimension-repository_nwomicrosoft/durabletask-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627664515
octolytics-dimension-repository_network_root_nwomicrosoft/durabletask-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseccb88d9c92abe69245b429398c8a57ae87070c7c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/pull/357/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F357%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F357%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2Fdurabletask-python
Reloadhttps://github.com/microsoft/durabletask-python/pull/357/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/357/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/357/files
microsofthttps://github.com/microsoft
durabletask-pythonhttps://github.com/microsoft/durabletask-python
Codehttps://github.com/microsoft/durabletask-python
Issues15 (15)https://github.com/microsoft/durabletask-python/issues
Pull requests12 (12)https://github.com/microsoft/durabletask-python/pulls
Actionshttps://github.com/microsoft/durabletask-python/actions
Projectshttps://github.com/microsoft/durabletask-python/projects
Security and qualityhttps://github.com/microsoft/durabletask-python/security
Insightshttps://github.com/microsoft/durabletask-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
andystapleshttps://github.com/andystaples
andystaples-async-stack-0-contract-docshttps://github.com/microsoft/durabletask-python/tree/andystaples-async-stack-0-contract-docs
andystaples-async-stack-1-coroutine-dispatchhttps://github.com/microsoft/durabletask-python/tree/andystaples-async-stack-1-coroutine-dispatch
Conversation 4 https://github.com/microsoft/durabletask-python/pull/357
Commits 6 https://github.com/microsoft/durabletask-python/pull/357/commits
Checks 25 https://github.com/microsoft/durabletask-python/pull/357/checks
Files changed https://github.com/microsoft/durabletask-python/pull/357/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/357/files
[Async stack 1/6] Coroutine dispatch https://github.com/microsoft/durabletask-python/pull/357/files#top
Show all changes 6 commits https://github.com/microsoft/durabletask-python/pull/357/files
7d5f31d Add coroutine orchestrator dispatch andystaples Nov 11, 2026 https://github.com/microsoft/durabletask-python/pull/357/commits/7d5f31dff5947ba7a04e794d670854a143aba8b9
e73a705 Fix async callable wrapper traversal andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/357/commits/e73a705eee9e59156ce4b94b30435935aa6b8d1e
8195cb3 Merge andystaples-async-stack-0-contract-docs into andystaples-async-… andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/357/commits/8195cb3ed4139e3a48f54d86cc1269a2b17dd64f
1acb276 Classify orchestrators at registration and harden the coroutine loop andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/357/commits/1acb27651fe27af1c37989999ff27c35744cf2d6
16a0dc5 Merge andystaples-async-stack-0-contract-docs into andystaples-async-… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/357/commits/16a0dc5af1dfaa43638b728ca49ae2a71beab6d4
92de85f Fail invalid generator yields on first dispatch and require the durab… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/357/commits/92de85f1f5400719ef12a7b0dac32ab3e2c6d6aa
Clear filters https://github.com/microsoft/durabletask-python/pull/357/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/357/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/357/files
asyncio_loop.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
shared.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-909ed2a2f07921372261104525beabd098da3de3b64379ba37d6a88d80259dd2
task.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
worker.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-821cca3b6d2d4c27b83bc2ea2c1dfbce058c46419967498ae26dc12693418899
test_coroutine_orchestrators.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-b0f87c14cdff5ff60109ff89e27ae6fcf0a30c4b0e555249eb6fcb88435abb3c
test_generator_replay_compat.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-ae7bfc436b22dfe76f121aa0a80cde7c598697b6574dc722f4d0aca45d63ba14
test_orchestration_generator_cleanup.py https://github.com/microsoft/durabletask-python/pull/357/files#diff-48ceae17758794c0f6c90139050b158a8e02d04d9fa521b5fbe379d6d701f355
durabletask/internal/asyncio_loop.pyhttps://github.com/microsoft/durabletask-python/pull/357/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
View file https://github.com/microsoft/durabletask-python/blob/92de85f1f5400719ef12a7b0dac32ab3e2c6d6aa/durabletask/internal/asyncio_loop.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/357/{{ revealButtonHref }}
durabletask/internal/shared.pyhttps://github.com/microsoft/durabletask-python/pull/357/files#diff-909ed2a2f07921372261104525beabd098da3de3b64379ba37d6a88d80259dd2
View file https://github.com/microsoft/durabletask-python/blob/92de85f1f5400719ef12a7b0dac32ab3e2c6d6aa/durabletask/internal/shared.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/357/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/357/files#diff-909ed2a2f07921372261104525beabd098da3de3b64379ba37d6a88d80259dd2
https://github.com/microsoft/durabletask-python/pull/357/files#diff-909ed2a2f07921372261104525beabd098da3de3b64379ba37d6a88d80259dd2
https://github.com/microsoft/durabletask-python/pull/357/files#diff-909ed2a2f07921372261104525beabd098da3de3b64379ba37d6a88d80259dd2
https://github.com/microsoft/durabletask-python/pull/357/files#diff-909ed2a2f07921372261104525beabd098da3de3b64379ba37d6a88d80259dd2
durabletask/task.pyhttps://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
View file https://github.com/microsoft/durabletask-python/blob/92de85f1f5400719ef12a7b0dac32ab3e2c6d6aa/durabletask/task.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/357/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
https://github.com/microsoft/durabletask-python/pull/357/files#diff-36492640add0941ee3934088b514e433cd929fa6120e74f93e37e5484bfe7981
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/357/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/357/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.