Title: Preserve trailing external events after continue-as-new with pending losing waits · Issue #274 · microsoft/durabletask-python · GitHub
Open Graph Title: Preserve trailing external events after continue-as-new with pending losing waits · Issue #274 · microsoft/durabletask-python
X Title: Preserve trailing external events after continue-as-new with pending losing waits · Issue #274 · microsoft/durabletask-python
Description: Bug When a timer wins when_any, the orchestrator calls continue_as_new(..., save_events=True) and returns, and matching external events occur later in the same history batch, those events can be lost instead of carried into the new execu...
Open Graph Description: Bug When a timer wins when_any, the orchestrator calls continue_as_new(..., save_events=True) and returns, and matching external events occur later in the same history batch, those events can be lo...
X Description: Bug When a timer wins when_any, the orchestrator calls continue_as_new(..., save_events=True) and returns, and matching external events occur later in the same history batch, those events can be lo...
Opengraph URL: https://github.com/microsoft/durabletask-python/issues/274
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Preserve trailing external events after continue-as-new with pending losing waits","articleBody":"## Bug\n\nWhen a timer wins `when_any`, the orchestrator calls `continue_as_new(..., save_events=True)` and returns, and matching external events occur later in the same history batch, those events can be lost instead of carried into the new execution.\n\nConfirmed on Python commit ec9af14386ba737f3598e33867ba080f99b3d5e1. Equivalent Go fix: microsoft/durabletask-go#163.\n\n## Reproduction\n\n```python\ndef orchestrator(ctx, _):\n event = ctx.wait_for_external_event(\"event\")\n timer = ctx.create_timer(timedelta(seconds=1))\n yield task.when_any([event, timer])\n ctx.continue_as_new(None, save_events=True)\n```\n\nReplay the initial execution and timer creation, then process a new batch containing `timerFired`, `eventRaised(\"event\", 1)`, `eventRaised(\"event\", 2)`.\n\n**Actual:** carryover contains only `2`. The abandoned losing wait consumes `1`.\n\n**Expected:** both trailing, undelivered events carry forward, once each. Events delivered to live waits before the execution finishes must not be resurrected.\n\n## Relevant code and scope\n\n`durabletask/worker.py`: `_OrchestrationExecutor.process_event` external-event dispatch and `_RuntimeOrchestrationContext` completion/carryover handling. This is shared by Azure Managed and the Azure Functions provider in this repository.\n\nPreserve `save_events=False` behavior, cancellation semantics, entity-event routing, replay, and existing Python continue-as-new semantics (Python marks the context complete at the call, unlike Go's deferred intent). Cover meaningful successful/failed/terminated lifecycle boundaries without blindly porting Go semantics.\n\nAdd focused regression coverage and applicable Unreleased changelog entries. Global ordering across different event names is a separate defect and should remain separately scoped.","author":{"url":"https://github.com/andystaples","@type":"Person","name":"andystaples"},"datePublished":"2026-09-29T17:41:19Z","url":"https://github.com/microsoft/durabletask-python/issues/274"}
| 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:88df3285-52ba-3e78-fc0b-9be0914d5f89 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E07E:1BC582:C820A6:11745DB:6AFE2CD7 |
| html-safe-nonce | 8e6603dc5efa83e8f5dd1e75579221e712cd15f53bd387bf3a309132455141a1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDdFOjFCQzU4MjpDODIwQTY6MTE3NDVEQjo2QUZFMkNENyIsInZpc2l0b3JfaWQiOiI3NTY3MTUwMzg3ODAzNTk4MDM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 83f7e6da5af2a2431a23722a4df7e7a26ecffd55a45a9879847bcf70c81eb489 |
| hovercard-subject-tag | issue:5634594658 |
| 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/274/issue_layout |
| twitter:image | https://opengraph.githubassets.com/08d558a2c88c7ac7f594977e6da8de4a0262ed9e5174921ab8355f2207afa2da/microsoft/durabletask-python/issues/274 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/08d558a2c88c7ac7f594977e6da8de4a0262ed9e5174921ab8355f2207afa2da/microsoft/durabletask-python/issues/274 |
| og:image:alt | Bug When a timer wins when_any, the orchestrator calls continue_as_new(..., save_events=True) and returns, and matching external events occur later in the same history batch, those events can be lo... |
| 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 | e973f9ec3625f3faad8cac5c2d11a214b7ffe45f3cc563b828459b290ecaeed3 |
| 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 | 1f92c367595b9190e0be293896078033886b1913 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width