René's URL Explorer Experiment


Title: [Async stack 3/6] Dispatch cleanup for coroutine orchestrators by andystaples · Pull Request #360 · microsoft/durabletask-python · GitHub

Open Graph Title: [Async stack 3/6] Dispatch cleanup for coroutine orchestrators by andystaples · Pull Request #360 · microsoft/durabletask-python

X Title: [Async stack 3/6] Dispatch cleanup for coroutine orchestrators by andystaples · Pull Request #360 · microsoft/durabletask-python

Description: WarningDo not merge this PR, or any PR in this stack, individually. The whole stack will be squash-merged only after every stack PR is approved. Layer 3/6 of the review stack that splits the closed #293. The base is layer 2/6, #358. Scope Dispatch teardown for the per-dispatch durable event loop: DurableEventLoop installs the async-generator hooks for each dispatch and restores the host's previous hooks afterwards. close() drains, then cancels, pending tasks and closes tracked async generators. close() is idempotent. Only the worker closes the loop: orchestrator code that calls loop.close() while the loop is running gets an actionable RuntimeError, as asyncio does for a running loop, and the dispatch's normal teardown still runs. Cooperative cleanup is capped at about 10,000 loop steps per cleanup phase (more for dispatches with many tasks or generators). Each async-generator sweep spends from a budget fixed at sweep entry, so tasks or generators created during the sweep cannot extend it. Truncated cleanup is reported once as a warning without changing the snapshotted response. Cleanup errors are collected per handle. The first unexpected failure is kept; a process-control exception such as KeyboardInterrupt or SystemExit takes precedence, even when grouped or raised after other errors. The existing dispatch response is preserved, and background and cleanup errors are logged. wait_durable cannot schedule durable work once the loop is closing. The orchestration context also rejects sequence-number allocation during async cleanup, and exiting an entity critical section during teardown does not schedule extra release messages. Control-flow exception classification moves from worker into the shared durabletask.internal.exceptions.is_control_flow_exception. Its BaseExceptionGroup handling is unchanged. Docs docs/async-orchestrators.md gains a warning callout describing the cleanup cap and truncation, and documents async-generator ownership during dispatch, explicit aclose() / contextlib.aclosing(...), and teardown handling of entity critical sections and process-control exits. CI Adds an async-runtime-windows job to .github/workflows/durabletask.yml that runs the asyncio, replay, and dispatch cleanup tests on Windows across Python 3.11-3.15. Layer 4/6 (#361) extends it with test_async_context.py. Intermediate adaptations reversed in layer 4/6 Async orchestrators still receive the eager task.OrchestrationContext at this layer, so tests annotate contexts as task.OrchestrationContext instead of task.AsyncOrchestrationContext, and operations that will later go through ctx.as_task_context() (for example call_activity(...) and create_timer(...) that need eager handles) are called directly on ctx. No changelog changes; release notes are added in layer 6/6 (#364).

Open Graph Description: WarningDo not merge this PR, or any PR in this stack, individually. The whole stack will be squash-merged only after every stack PR is approved. Layer 3/6 of the review stack that splits the close...

X Description: WarningDo not merge this PR, or any PR in this stack, individually. The whole stack will be squash-merged only after every stack PR is approved. Layer 3/6 of the review stack that splits the close...

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

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:80330de4-c295-97c5-26e4-14dcf947cedb
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id99CC:1086D1:7179E:95B5D:6AFE2CF5
html-safe-nonce06763bf05c8277c7b3330c4ad2edd8261111a225facb1b3b52e98571cab040bf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUNDOjEwODZEMTo3MTc5RTo5NUI1RDo2QUZFMkNGNSIsInZpc2l0b3JfaWQiOiI4NTY0MTUzMjUzNzM2ODg1NDkzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacbf02416c831de7476057cd090ae52bd2d80d443e52527af39c1b6c772b34ad9c
hovercard-subject-tagpull_request:5265975427
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/360/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 PR in this stack, individually. The whole stack will be squash-merged only after every stack PR is approved. Layer 3/6 of the review stack that splits the close...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee973f9ec3625f3faad8cac5c2d11a214b7ffe45f3cc563b828459b290ecaeed3
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
release1f92c367595b9190e0be293896078033886b1913
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/pull/360/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F360%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%2F360%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/360/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/360/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/360/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-2-asyncio-compositionhttps://github.com/microsoft/durabletask-python/tree/andystaples-async-stack-2-asyncio-composition
andystaples-async-stack-3-dispatch-cleanuphttps://github.com/microsoft/durabletask-python/tree/andystaples-async-stack-3-dispatch-cleanup
Conversation 4 https://github.com/microsoft/durabletask-python/pull/360
Commits 11 https://github.com/microsoft/durabletask-python/pull/360/commits
Checks 30 https://github.com/microsoft/durabletask-python/pull/360/checks
Files changed https://github.com/microsoft/durabletask-python/pull/360/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/files
[Async stack 3/6] Dispatch cleanup for coroutine orchestrators https://github.com/microsoft/durabletask-python/pull/360/files#top
Show all changes 11 commits https://github.com/microsoft/durabletask-python/pull/360/files
fd6b402 Harden async orchestration dispatch cleanup andystaples Nov 11, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/fd6b4025b58b2fd12dca956620abf08ad37a6102
de57073 Harden async dispatch cleanup ownership and signal precedence andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/de57073201ac24e8a80edfccdcbe56a9bb280480
c164cb6 Bound async-generator cleanup discovery budget andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/c164cb697613b02067c17c77b7e97022a73a09b8
f6a45e8 Merge andystaples-async-stack-2-asyncio-composition into andystaples-… andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/f6a45e8f59823368139bdbbaae549a5de364d318
5ca6f3c Merge andystaples-async-stack-2-asyncio-composition into andystaples-… andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/5ca6f3c307f1709d04602459f402d26abc8f968c
e918345 Merge andystaples-async-stack-2-asyncio-composition into andystaples-… andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/e918345115926ffbbbc0b54c54ab59d6cda2e472
344196a Make async cleanup budgets cumulative and close idempotent andystaples Nov 12, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/344196a643b1d2b0415c34ac3546f7b0b8ecde95
b696bd0 Merge andystaples-async-stack-2-asyncio-composition into andystaples-… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/b696bd0ee2a27e8dc97a279f69ff2d02c8605cd1
3b5e007 Merge andystaples-async-stack-2-asyncio-composition into andystaples-… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/3b5e0075101c5088fe0a2dc6f6b12a248883f152
6908585 Merge andystaples-async-stack-2-asyncio-composition into andystaples-… andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/690858584d1359b8fdb33f34cc59a89e27341f6a
d50a68f Reject closing the durable loop from orchestrator code andystaples Nov 16, 2026 https://github.com/microsoft/durabletask-python/pull/360/commits/d50a68ffce7cf49847c34e98bc30f69919bfebc4
Clear filters https://github.com/microsoft/durabletask-python/pull/360/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/files
durabletask.yml https://github.com/microsoft/durabletask-python/pull/360/files#diff-67f446127cd48d3d60af952eaf0e91c7626d3de562e98a55864e17b9a6575162
async-orchestrators.md https://github.com/microsoft/durabletask-python/pull/360/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
asyncio_loop.py https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
exceptions.py https://github.com/microsoft/durabletask-python/pull/360/files#diff-7cee37fa9e9281db434398dcf8b2e47fa04590c8e96053d71b8deec9b23ae56d
worker.py https://github.com/microsoft/durabletask-python/pull/360/files#diff-821cca3b6d2d4c27b83bc2ea2c1dfbce058c46419967498ae26dc12693418899
test_asyncio_orchestrators.py https://github.com/microsoft/durabletask-python/pull/360/files#diff-3f4f24b2fcba2e5d488f7876e8ad325f8de6a46896d88007d62be7f4bf3c9484
.github/workflows/durabletask.ymlhttps://github.com/microsoft/durabletask-python/pull/360/files#diff-67f446127cd48d3d60af952eaf0e91c7626d3de562e98a55864e17b9a6575162
View file https://github.com/microsoft/durabletask-python/blob/d50a68ffce7cf49847c34e98bc30f69919bfebc4/.github/workflows/durabletask.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/360/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/360/files#diff-67f446127cd48d3d60af952eaf0e91c7626d3de562e98a55864e17b9a6575162
https://github.com/microsoft/durabletask-python/pull/360/files#diff-67f446127cd48d3d60af952eaf0e91c7626d3de562e98a55864e17b9a6575162
docs/async-orchestrators.mdhttps://github.com/microsoft/durabletask-python/pull/360/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
View file https://github.com/microsoft/durabletask-python/blob/d50a68ffce7cf49847c34e98bc30f69919bfebc4/docs/async-orchestrators.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/360/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/360/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
https://github.com/microsoft/durabletask-python/pull/360/files#diff-4041f5af72d58e9641665b5b94354c8039eedd8ff6b1d3356ae76eecd8a22fcc
durabletask/internal/asyncio_loop.pyhttps://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
View file https://github.com/microsoft/durabletask-python/blob/d50a68ffce7cf49847c34e98bc30f69919bfebc4/durabletask/internal/asyncio_loop.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/360/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/files
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/files
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
https://github.com/microsoft/durabletask-python/pull/360/files#diff-b47a297d48291ca48ccaeff82a094c93788a41cc7077d83021f9a477bbb95407
durabletask/internal/exceptions.pyhttps://github.com/microsoft/durabletask-python/pull/360/files#diff-7cee37fa9e9281db434398dcf8b2e47fa04590c8e96053d71b8deec9b23ae56d
View file https://github.com/microsoft/durabletask-python/blob/d50a68ffce7cf49847c34e98bc30f69919bfebc4/durabletask/internal/exceptions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/360/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/360/files#diff-7cee37fa9e9281db434398dcf8b2e47fa04590c8e96053d71b8deec9b23ae56d
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/360/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.