Skip to content

Add suspend and resume reasons - #250

Open
andystaples wants to merge 6 commits into
mainfrom
andystaples-suspend-resume-reasons
Open

Add suspend and resume reasons#250
andystaples wants to merge 6 commits into
mainfrom
andystaples-suspend-resume-reasons

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Summary

  • add optional keyword-only reason arguments to sync and async suspend/resume APIs
  • serialize lifecycle reasons into the corresponding protobuf requests
  • forward Durable Functions v1 compatibility reasons instead of discarding them

Closes #223

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 941fc052-b910-42af-93fa-4f00138813ab
Copilot AI lite review requested due to automatic review settings August 10, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds suspend/resume “reason” parity with the .NET client across the core Durable Task Python clients and the Azure Functions Durable compatibility client, ensuring the optional reason is serialized and preserved.

Changes:

  • Added keyword-only optional reason parameters to sync/async suspend_orchestration and resume_orchestration APIs and serialized them into the protobuf requests.
  • Updated Azure Functions Durable v1-compat suspend() / resume() deprecated aliases to forward the provided reason.
  • Added unit tests and changelog entries covering both populated and omitted reasons.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
durabletask/client.py Adds optional keyword-only reason to suspend/resume APIs and serializes it into SuspendRequest/ResumeRequest.
tests/durabletask/test_client.py Adds tests validating reason serialization and omission behavior for sync and async clients.
tests/azure-functions-durable/test_client_compat.py Updates compat tests to ensure deprecated v1 methods forward reason to the new APIs.
azure-functions-durable/azure/durable_functions/client.py Forwards v1 deprecated reason argument to durabletask suspend/resume APIs instead of discarding it.
CHANGELOG.md Documents the new optional suspend/resume reason parameters in the core SDK changelog under Unreleased.
azure-functions-durable/CHANGELOG.md Documents the v1 compat fix to forward suspend/resume reasons under Unreleased.
Suppressed comments (1)

tests/durabletask/test_client.py:1279

  • Test name grammar: "include" should be "includes" (third-person singular) for readability/consistency.
async def test_async_suspend_resume_orchestration_include_optional_reason():

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/durabletask/test_client.py Outdated
andystaples and others added 2 commits August 10, 2026 10:29
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 941fc052-b910-42af-93fa-4f00138813ab

@berndverst Bernd Verst (berndverst) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the inline compatibility, in-memory backend, and package changelog gaps before merging.

"""
await self.suspend_orchestration(instance_id)
"""Deprecated alias for :meth:`suspend_orchestration`."""
await self.suspend_orchestration(instance_id, reason=reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now always passes reason=, but azure-functions-durable/pyproject.toml still permits durabletask>=1.9.0, whose suspend/resume methods do not accept this keyword. A valid dependency resolution can therefore make every deprecated suspend()/resume() call fail with TypeError, even when no reason is supplied. Please raise the minimum core version to the first release containing these signatures and coordinate the package release order.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented the required coordinated release in the Azure Functions changelog and repository agent guidance. Per release policy, package versions and dependency minimums remain unchanged in this feature PR; a dedicated release PR must publish the core package first, then update provider minimums and versions.

Comment thread durabletask/client.py
reason: str | None = None) -> None:
req = pb.SuspendRequest(
instanceId=instance_id,
reason=helpers.get_string_value(reason),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please carry this reason through the public in-memory testing backend too. InMemoryOrchestrationBackend.SuspendInstance/ResumeInstance still call new_suspend_event()/new_resume_event() without request.reason, and those helpers create history events with empty input; tests using that backend therefore lose the reason while a real sidecar preserves it. Pass the optional reason through the helpers and add an in-memory history regression test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed the optional request reason into the in-memory suspend/resume history events and added an in-memory E2E regression that verifies both persisted history inputs. Fixed in 63db777.

Comment thread CHANGELOG.md

ADDED

- Added optional `reason` parameters to `TaskHubGrpcClient` and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new parameters are also inherited by DurableTaskSchedulerClient and AsyncDurableTaskSchedulerClient, but durabletask-azuremanaged/CHANGELOG.md still has an empty Unreleased section. Repository policy requires each affected package changelog, and the prior inherited rewind API was documented there. Please add an ADDED entry for suspend/resume reasons.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the inherited suspend/resume reason API entry under durabletask-azuremanaged/CHANGELOG.md Unreleased. Fixed in 63db777.

andystaples and others added 3 commits August 13, 2026 10:42
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 941fc052-b910-42af-93fa-4f00138813ab
Updated instructions for creating a dedicated release PR to ensure proper versioning and compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add suspend and resume reason parity with .NET

3 participants