Title: Add support for custom properties in FailureDetails · Issue #67 · microsoft/durabletask-python · GitHub
Open Graph Title: Add support for custom properties in FailureDetails · Issue #67 · microsoft/durabletask-python
X Title: Add support for custom properties in FailureDetails · Issue #67 · microsoft/durabletask-python
Description: Context The original reference is Azure/azure-functions-durable-extension#3215, which added exception-property enrichment for .NET isolated Durable Functions on top of microsoft/durabletask-dotnet#474 and the TaskFailureDetails.propertie...
Open Graph Description: Context The original reference is Azure/azure-functions-durable-extension#3215, which added exception-property enrichment for .NET isolated Durable Functions on top of microsoft/durabletask-dotnet#...
X Description: Context The original reference is Azure/azure-functions-durable-extension#3215, which added exception-property enrichment for .NET isolated Durable Functions on top of microsoft/durabletask-dotnet#...
Opengraph URL: https://github.com/microsoft/durabletask-python/issues/67
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add support for custom properties in FailureDetails","articleBody":"## Context\r\n\r\nThe original reference is [Azure/azure-functions-durable-extension#3215](https://github.com/Azure/azure-functions-durable-extension/pull/3215), which added exception-property enrichment for .NET isolated Durable Functions on top of [microsoft/durabletask-dotnet#474](https://github.com/microsoft/durabletask-dotnet/pull/474) and the `TaskFailureDetails.properties` protobuf field from [microsoft/durabletask-protobuf#45](https://github.com/microsoft/durabletask-protobuf/pull/45).\r\n\r\n## Research update (2026-07-28)\r\n\r\n| SDK | Current state |\r\n| --- | --- |\r\n| .NET | Complete. `IExceptionPropertiesProvider.GetExceptionProperties(Exception)` returns `IDictionary\u003cstring, object?>?`; the provider is registered on the worker, invoked recursively for the exception chain, and serialized through `map\u003cstring, google.protobuf.Value>`. The public `TaskFailureDetails` exposes both `InnerFailure` and `Properties`. [PR #474](https://github.com/microsoft/durabletask-dotnet/pull/474) established the behavior; [PR #560](https://github.com/microsoft/durabletask-dotnet/pull/560) later added a sample without changing the contract. |\r\n| Java | Complete since [microsoft/durabletask-java#263](https://github.com/microsoft/durabletask-java/pull/263) (2026-04-29). Java added `ExceptionPropertiesProvider`, worker-builder registration, recursive `innerFailure`, protobuf round-tripping, integration tests, a depth limit, and safe handling when the provider itself throws. |\r\n| JavaScript | Custom properties are not implemented. The main [`FailureDetails`](https://github.com/microsoft/durabletask-js/blob/19781fd3efeaae0043584b53e9949105cfddad15/packages/durabletask-js/src/task/failure-details.ts) still exposes only message, error type, and stack trace, and no code reads or writes the generated protobuf properties map. JS does have partial adjacent support: [PR #310](https://github.com/microsoft/durabletask-js/pull/310) added recursive `Error.cause` serialization, and the entity-specific failure model reads inner failures recursively. This is context, not a dependency for Python. |\r\n| Python | The generated protobuf gained `properties` incidentally with [PR #110](https://github.com/microsoft/durabletask-python/pull/110), so no protobuf update is needed. Python now writes recursive `innerFailure` ([PR #99](https://github.com/microsoft/durabletask-python/pull/99)), made `FailureDetails` a frozen dataclass for JSON-safe history export ([PR #172](https://github.com/microsoft/durabletask-python/pull/172)), and added fully-qualified error types plus `is_caused_by()` ([PR #194](https://github.com/microsoft/durabletask-python/pull/194)). However, all public proto-to-model paths still discard `innerFailure` and `properties`, and workers cannot populate custom properties. |\r\n\r\nThe current .NET and Java implementations agree on the portable property model: `None`/null, strings, booleans, numbers, nested string-keyed mappings, and lists are represented with `google.protobuf.Value`; unsupported values fall back to their string representation. This path is independent of the payload `DataConverter`. Protobuf numbers are float64, so integer-like values read back as `float`. Date/time values are not inferred on read: review of extension PR #3215 rejected prefix-based `dt:`/`dto:` type guessing because ordinary customer strings could be irreversibly coerced. Python should require providers to stringify date/time values and treat prefixed values from .NET as opaque strings.\r\n\r\n## Target behavior\r\n\r\nAdd an optional Python `ExceptionPropertiesProvider` protocol with:\r\n\r\n```python\r\ndef get_exception_properties(\r\n self, exception: Exception\r\n) -> Mapping[str, Any] | None: ...\r\n```\r\n\r\nWhen configured on a worker, it is called for the top-level exception and each captured inner exception. `None` or an empty mapping omits the wire map. If the provider raises, log a warning with the exception and continue reporting the task failure without custom properties, matching Java's worker-safety behavior.\r\n\r\nExtend the existing frozen `FailureDetails` dataclass by appending backward-compatible defaulted fields:\r\n\r\n```python\r\ninner_failure: FailureDetails | None = None\r\nproperties: dict[str, Any] | None = None\r\n```\r\n\r\nKeep stored properties as ordinary JSON-safe dictionaries so `dataclasses.asdict()` and history export continue to work after PR #172.\r\n\r\n## Implementation plan\r\n\r\n1. **Add shared failure conversion utilities.** In `durabletask/internal/helpers.py`, add Python-to-`google.protobuf.Value` and protobuf-to-Python conversion for null, bool, number (including `Decimal`, encoded as float64), string, nested mapping, and list values, with string fallback for unsupported outbound values. Do not add date/time type inference or prefix parsing. Extend `new_failure_details()` to accept an optional provider/logger, preserve the existing cycle/depth protection, and apply the provider recursively.\r\n2. **Expose the complete public model everywhere.** Add `inner_failure` and `properties` to `durabletask.task.FailureDetails`, then centralize protobuf-to-`FailureDetails` conversion and reuse it from `TaskFailedError`, `client.parse_orchestration_state()`, `history._failure_details()`, and entity failure conversion. Also teach `_failure_details_from_core_dict()` to consume legacy `Properties` and recursive `InnerFailure`. This covers task failures, orchestration state queries, entity failures, and all failure-bearing history events without separate partial implementations.\r\n3. **Configure workers.** Add `exception_properties_provider` to `TaskHubGrpcWorker`, retain it on the worker, and thread it through `_OrchestrationExecutor` / `_RuntimeOrchestrationContext` so user-orchestrator failures are enriched. Use it for activity failures, entity-operation failures, output-serialization failures, and outer worker failure paths that create `TaskFailureDetails`.\r\n4. **Preserve provider support in derived workers.** Add and forward the same optional parameter from `DurableTaskSchedulerWorker`; export the provider protocol from the public package surface. Existing constructors and behavior remain unchanged when no provider is supplied.\r\n5. **Keep Azure Functions integration non-blocking.** The new `azure-functions-durable` 2.x package was added after this issue was opened and creates internal workers per invocation, while activity exceptions are reported by the Functions host/worker pipeline. Core read support will make incoming properties visible immediately. A Functions-specific registration/serialization surface should be designed separately rather than blocking core and DTS support in this issue.\r\n6. **Add coverage.** Test every protobuf value kind, `Decimal`/float64 conversion, and nested combination; null/empty mappings; unsupported-value string fallback; recursive properties on `__cause__`/`__context__`; cycle/depth limits; selective providers; provider exceptions; and no-provider compatibility. Add worker-level tests for orchestration, activity, and entity failures; round-trip tests through `TaskFailedError`, orchestration state, and history events; a history JSON-serialization regression test; an Azure Managed constructor/forwarding test; and a fixture that consumes .NET-produced properties.\r\n7. **Document the user-facing API.** Add a short worker example showing correlation/domain metadata extraction and update `CHANGELOG.md` plus `durabletask-azuremanaged/CHANGELOG.md` under `Unreleased`.\r\n\r\n## Acceptance criteria\r\n\r\n- A configured provider can attach portable custom values to orchestration, activity, and entity failures.\r\n- Properties and recursive inner failures survive protobuf round-trips and are visible through `TaskFailedError.details`, orchestration-state APIs, and history APIs.\r\n- Existing three-argument `FailureDetails(...)` construction and workers without a provider behave unchanged.\r\n- Provider failures never replace or suppress the original task failure.\r\n- No protobuf regeneration or JavaScript implementation is required before merging Python support.\r\n","author":{"url":"https://github.com/andystaples","@type":"Person","name":"andystaples"},"datePublished":"2025-10-23T21:29:00Z","url":"https://github.com/microsoft/durabletask-python/issues/67"}
| 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:1cc7ebd7-e6cb-a6db-1309-7fa68808061a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBDC:2A1B81:FCA81:1485AF:6AFE431D |
| html-safe-nonce | 9bec7fd3b1db39788fa4b496513319b20d59e4ac75934da20296d99da8332c00 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkRDOjJBMUI4MTpGQ0E4MToxNDg1QUY6NkFGRTQzMUQiLCJ2aXNpdG9yX2lkIjoiNDU1Nzk5OTkzODMzOTc1MDY4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9747edbdf00483dcef87a514437c9761f76ad5ddfe51f4e3f592eb8b0fa51d33 |
| hovercard-subject-tag | issue:3546661780 |
| 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/67/issue_layout |
| twitter:image | https://opengraph.githubassets.com/874d5340dc3e96e1a311ea5c997293b55054d3773f6577d31bb2f78c14409782/microsoft/durabletask-python/issues/67 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/874d5340dc3e96e1a311ea5c997293b55054d3773f6577d31bb2f78c14409782/microsoft/durabletask-python/issues/67 |
| og:image:alt | Context The original reference is Azure/azure-functions-durable-extension#3215, which added exception-property enrichment for .NET isolated Durable Functions on top of microsoft/durabletask-dotnet#... |
| 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 | ce393ea11ad276623b946bc9663d3e7d6f564275 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width