Title: when_all hangs with shared or duplicate pending task references · Issue #285 · microsoft/durabletask-python · GitHub
Open Graph Title: when_all hangs with shared or duplicate pending task references · Issue #285 · microsoft/durabletask-python
X Title: when_all hangs with shared or duplicate pending task references · Issue #285 · microsoft/durabletask-python
Description: Summary when_all can remain pending after all leaf tasks complete when a pending task is shared between composite groups or appears multiple times in one group. This is the same bug addressed by microsoft/durabletask-js#383. Confirmed ag...
Open Graph Description: Summary when_all can remain pending after all leaf tasks complete when a pending task is shared between composite groups or appears multiple times in one group. This is the same bug addressed by mi...
X Description: Summary when_all can remain pending after all leaf tasks complete when a pending task is shared between composite groups or appears multiple times in one group. This is the same bug addressed by mi...
Opengraph URL: https://github.com/microsoft/durabletask-python/issues/285
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"when_all hangs with shared or duplicate pending task references","articleBody":"## Summary\n\n`when_all` can remain pending after all leaf tasks complete when a pending task is shared between composite groups or appears multiple times in one group. This is the same bug addressed by microsoft/durabletask-js#383.\n\nConfirmed against `main` at commit `912d33573b4c833556695950ef5ce2b9a24191e9`, by executing the unmodified task classes extracted from `durabletask/task.py` (no scheduler required).\n\n## Reproduction\n\n```python\nfrom durabletask.task import CompletableTask, when_all\n\n# Shared pending task: constructing right overwrites a's parent.\na, b, c = CompletableTask(), CompletableTask(), CompletableTask()\nleft = when_all([a, b])\nright = when_all([a, c])\nroot = when_all([left, right])\n\na.complete(\"A\")\nb.complete(\"B\")\nc.complete(\"C\")\n\nprint(left.is_complete, right.is_complete, root.is_complete, left.pending_tasks)\n# Actual: False True False 1\n# Expected: True True True 0\n# Expected root result: [[\"A\", \"B\"], [\"A\", \"C\"]]\n\n# Duplicate pending task: one completion callback accounts for only one slot.\ntask = CompletableTask()\ngroup = when_all([task, task])\ntask.complete(\"V\")\n\nprint(task.is_complete, group.is_complete, group.pending_tasks)\n# Actual: True False 1\n# Expected: True True 0\n# Expected group result: [\"V\", \"V\"]\n```\n\nPre-completing the duplicate child before constructing `when_all([task, task])` succeeds, so behavior depends on completion timing.\n\n## Root cause\n\n- [`Task._notify_parent`](https://github.com/microsoft/durabletask-python/blob/912d33573b4c833556695950ef5ce2b9a24191e9/durabletask/task.py#L652-L654) notifies a single `_parent`.\n- [`CompositeTask.__init__`](https://github.com/microsoft/durabletask-python/blob/912d33573b4c833556695950ef5ce2b9a24191e9/durabletask/task.py#L663-L673) assigns `task._parent = self`, overwriting an earlier observer.\n- [`WhenAllTask.on_child_completed`](https://github.com/microsoft/durabletask-python/blob/912d33573b4c833556695950ef5ce2b9a24191e9/durabletask/task.py#L701-L723) increments the completed count by one, even when that child occupies multiple input positions.\n\nThe same single-parent mechanism affects overlapping `when_all`/`when_any` groups and nested shared composites, including failed children and cancellable/retryable tasks.\n\n## Impact\n\nAn orchestration yielding the stranded group may remain running indefinitely despite every scheduled activity having completed. Retrying or replaying does not repair the dependency graph.\n\n## Suggested fix and regression coverage\n\nSupport multiple dependent composites per task, account for duplicate input occurrences exactly once per terminal child, and preserve input order/duplicate result positions. Detach a completed `when_any` from its losing children without detaching other observers. Preserve existing wait-all failure semantics and ensure one throwing completion callback cannot prevent other observers from being notified.\n\nCover pending and pre-completed duplicates, all completion orders for shared groups, nested composites, overlapping all/any groups, success/failure/cancellation/retry exhaustion, and an orchestration-level regression proving completion without extra activity scheduling.","author":{"url":"https://github.com/andystaples","@type":"Person","name":"andystaples"},"datePublished":"2026-10-12T16:41:38Z","url":"https://github.com/microsoft/durabletask-python/issues/285"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f8839ceb-3f6d-d400-8621-5b1a3be62a5a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DEA8:1086D1:5DE21:7BB18:6AFE2CA7 |
| html-safe-nonce | 2b93e125d59d5926cdfc84423f2723fd574f54db28035a006891cf7f1e1a4659 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERUE4OjEwODZEMTo1REUyMTo3QkIxODo2QUZFMkNBNyIsInZpc2l0b3JfaWQiOiI0MDYzMDk4NDAzMDc5MjA0MDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 19787d26e2eaf3de8b4ec390c90e8aea50cc2a77821dd357598708f29c8a5714 |
| hovercard-subject-tag | issue:5817247086 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/durabletask-python/285/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e87aa2857fb590efb1f0925aab6ea2e30da9986579abf6a81627aaf6b94b0cad/microsoft/durabletask-python/issues/285 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e87aa2857fb590efb1f0925aab6ea2e30da9986579abf6a81627aaf6b94b0cad/microsoft/durabletask-python/issues/285 |
| og:image:alt | Summary when_all can remain pending after all leaf tasks complete when a pending task is shared between composite groups or appears multiple times in one group. This is the same bug addressed by mi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andystaples |
| hostname | github.com |
| expected-hostname | github.com |
| None | d70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 627664515 |
| octolytics-dimension-repository_nwo | microsoft/durabletask-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627664515 |
| octolytics-dimension-repository_network_root_nwo | microsoft/durabletask-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ccb88d9c92abe69245b429398c8a57ae87070c7c |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width