From fa3a5d298f7b667ff6d986002ae3dc9da55b09d7 Mon Sep 17 00:00:00 2001 From: Tim Conley Date: Mon, 9 Mar 2026 08:44:03 -0700 Subject: [PATCH 1/3] Fix RetryPolicy.from_proto() pickle error with non_retryable_error_types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert protobuf RepeatedScalarContainer to Python list to make RetryPolicy objects picklable when non_retryable_error_types is set. This fixes crashes in sync activities using ProcessPoolExecutor. Fixes #1350 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- temporalio/common.py | 2 +- tests/test_common.py | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/temporalio/common.py b/temporalio/common.py index d328863ed..2f34c6387 100644 --- a/temporalio/common.py +++ b/temporalio/common.py @@ -69,7 +69,7 @@ def from_proto(proto: temporalio.api.common.v1.RetryPolicy) -> RetryPolicy: if proto.HasField("maximum_interval") else None, maximum_attempts=proto.maximum_attempts, - non_retryable_error_types=proto.non_retryable_error_types + non_retryable_error_types=list(proto.non_retryable_error_types) if proto.non_retryable_error_types else None, ) diff --git a/tests/test_common.py b/tests/test_common.py index 84dfc09b9..35da93995 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -7,7 +7,7 @@ import pytest -from temporalio.api.common.v1 import Payload +from temporalio.api.common.v1 import Payload, RetryPolicy as RetryPolicyProto from temporalio.common import ( Priority, RawValue, @@ -123,3 +123,26 @@ def test_cant_construct_bad_priority(): Priority(priority_key=1.1) # type: ignore with pytest.raises(ValueError): Priority(priority_key=-1) + + +def test_retry_policy_from_proto_pickle(): + """Test that RetryPolicy.from_proto() creates a picklable object when non_retryable_error_types is set.""" + # Create a protobuf with non_retryable_error_types + proto = RetryPolicyProto() + proto.initial_interval.seconds = 1 + proto.backoff_coefficient = 2.0 + proto.maximum_attempts = 3 + proto.non_retryable_error_types.extend(["SomeError", "AnotherError"]) + + # Convert from proto + retry_policy = RetryPolicy.from_proto(proto) + + # This should not raise a PickleError + pickled = pickle.dumps(retry_policy) + unpickled = pickle.loads(pickled) + + # Verify the data is intact + assert unpickled.initial_interval == timedelta(seconds=1) + assert unpickled.backoff_coefficient == 2.0 + assert unpickled.maximum_attempts == 3 + assert unpickled.non_retryable_error_types == ["SomeError", "AnotherError"] From 98bde6ac60779765d704711fed1d99d78e365494 Mon Sep 17 00:00:00 2001 From: Tim Conley Date: Mon, 9 Mar 2026 11:40:53 -0700 Subject: [PATCH 2/3] Fix linting errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix import formatting and code formatting issues in tests/test_common.py 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tests/test_common.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_common.py b/tests/test_common.py index 35da93995..59a5ebbdf 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -7,7 +7,8 @@ import pytest -from temporalio.api.common.v1 import Payload, RetryPolicy as RetryPolicyProto +from temporalio.api.common.v1 import Payload +from temporalio.api.common.v1 import RetryPolicy as RetryPolicyProto from temporalio.common import ( Priority, RawValue, @@ -133,14 +134,14 @@ def test_retry_policy_from_proto_pickle(): proto.backoff_coefficient = 2.0 proto.maximum_attempts = 3 proto.non_retryable_error_types.extend(["SomeError", "AnotherError"]) - + # Convert from proto retry_policy = RetryPolicy.from_proto(proto) - + # This should not raise a PickleError pickled = pickle.dumps(retry_policy) unpickled = pickle.loads(pickled) - + # Verify the data is intact assert unpickled.initial_interval == timedelta(seconds=1) assert unpickled.backoff_coefficient == 2.0 From eb3efc3a280e7b08ab8019ec89abdc6858729ac1 Mon Sep 17 00:00:00 2001 From: Tim Conley Date: Mon, 9 Mar 2026 15:50:48 -0700 Subject: [PATCH 3/3] Extend latest deps timeout --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af1f916e4..5288b402e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,7 +159,7 @@ jobs: - run: poe lint - run: mkdir junit-xml - run: poe test -s --junit-xml=junit-xml/latest-deps.xml - timeout-minutes: 10 + timeout-minutes: 15 - name: "Upload junit-xml artifacts" uses: actions/upload-artifact@v4 if: always()