Title: history_export: resolve activity dependencies per invocation (retire the process-global bind_context) · Issue #182 · microsoft/durabletask-python · GitHub
Open Graph Title: history_export: resolve activity dependencies per invocation (retire the process-global bind_context) · Issue #182 · microsoft/durabletask-python
X Title: history_export: resolve activity dependencies per invocation (retire the process-global bind_context) · Issue #182 · microsoft/durabletask-python
Description: Summary Give durabletask.extensions.history_export a way to resolve activity dependencies per invocation (a factory / resolver), so it no longer relies on a process-global context bound once via bind_context(). Background The history-exp...
Open Graph Description: Summary Give durabletask.extensions.history_export a way to resolve activity dependencies per invocation (a factory / resolver), so it no longer relies on a process-global context bound once via bi...
X Description: Summary Give durabletask.extensions.history_export a way to resolve activity dependencies per invocation (a factory / resolver), so it no longer relies on a process-global context bound once via bi...
Opengraph URL: https://github.com/microsoft/durabletask-python/issues/182
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"history_export: resolve activity dependencies per invocation (retire the process-global bind_context)","articleBody":"### Summary\r\n\r\nGive `durabletask.extensions.history_export` a way to resolve activity dependencies **per invocation** (a factory / resolver), so it no longer relies on a process-global context bound once via `bind_context()`.\r\n\r\n### Background\r\n\r\nThe history-export activities resolve their runtime dependencies (a durabletask client and a `HistoryWriter`) from a module-global `_context` installed by `bind_context(HistoryExportContext(...))`. The code notes this is \"acceptable because activities run in-process within the worker that registered them.\"\r\n\r\nThat assumption holds for a standalone worker, but **not** for host-driven, multi-process models such as Azure Functions: the process that binds the context (the client-triggered request handler) is often **not** the worker process that runs an export activity, so `_require_context()` raises.\r\n\r\n### What azure-functions-durable did (PR #155)\r\n\r\nThe Functions adapter worked around this **adapter-side**: the export activities now declare a `durable_client_input` binding and build the client **per invocation** from it (the host supplies it in whatever worker runs the activity), and the `HistoryWriter` is registered at `configure_history_export(writer=...)` time. That's Functions-specific plumbing layered on top of the core's `bind_context` model.\r\n\r\n### Proposal\r\n\r\nAdopt a per-invocation / factory-based dependency-resolution pattern in the **core** extension so any hosting model can supply deps without a process-global. For example: register client/writer **factories** (or pass a resolver) instead of `bind_context(instance)`, and resolve lazily per invocation.\r\n\r\nBenefits:\r\n\r\n- removes the fragile process-global and its \"in-process\" assumption;\r\n- lets `azure-functions-durable` drop its adapter shim and fit into a single pattern;\r\n- reduces host-specific special-casing.\r\n\r\n### Context\r\n\r\nFollow-up from microsoft/durabletask-python#155 (see the #2 review thread on the process-global context).\r\n","author":{"url":"https://github.com/andystaples","@type":"Person","name":"andystaples"},"datePublished":"2026-07-23T00:38:37Z","url":"https://github.com/microsoft/durabletask-python/issues/182"}
| 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:478c6ff0-dc2c-5e7b-7537-4dc5b9524031 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D20:5B76F:3EEF8:53BDF:6AFE413C |
| html-safe-nonce | 3f80ac720a53c0061e9140578c2056e03242cfb2b4fc556d7f9d539d5d8dc494 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDIwOjVCNzZGOjNFRUY4OjUzQkRGOjZBRkU0MTNDIiwidmlzaXRvcl9pZCI6IjMxMDc2NDAwMjEzNjA3MjIyMzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b93e1c710ab6870fa85f29924592b49204ceb1772abc2441519d31eda7c8f468 |
| hovercard-subject-tag | issue:4954323723 |
| 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/182/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51fac90cb821f549b906c62cc0a4d92ec1954cd848a3e17270be5c22ba1b2e66/microsoft/durabletask-python/issues/182 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51fac90cb821f549b906c62cc0a4d92ec1954cd848a3e17270be5c22ba1b2e66/microsoft/durabletask-python/issues/182 |
| og:image:alt | Summary Give durabletask.extensions.history_export a way to resolve activity dependencies per invocation (a factory / resolver), so it no longer relies on a process-global context bound once via bi... |
| 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 | f1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c |
| 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 | c4447fdce9ed0f33af959d2b6680d0bc18212a6a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width