[Bug] Retried `ActivityHandle.terminate()` can fail after the activity is already terminated
Maintainer thường phản hồi trong vòng 1 ngày
@maciejdudko đang làm issue này rồi.
Từ ngày 22/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What are you really trying to do?
Terminate a standalone activity with ActivityHandle.terminate() and rely on the client's built-in RPC retries.
Describe the bug
_ClientImpl.terminate_activity in temporalio/client/_impl.py builds TerminateActivityExecutionRequest without request_id and sends it with retry=True. The sibling calls (cancel_activity, pause_activity, unpause_activity, start_activity) all set request_id=str(uuid.uuid4()), and the Go SDK sets RequestId on this request too.
On the server, an empty request ID is replaced with a new random one for each attempt (validateAndNormalizeRequestID in chasm/lib/activity/validator.go). Activity.Terminate returns success for a repeat only when the request ID matches the stored one, and otherwise returns NotFound: no running activity execution: it closed with status TERMINATED. So if the first attempt terminates the activity but the response is lost (for example a transient UNAVAILABLE), the automatic retry fails and terminate() raises although the activity was terminated.
Minimal Reproduction
from unittest import mock
import temporalio.api.workflowservice.v1
from temporalio.client import Client
async def main() -> None:
rpc = mock.AsyncMock(
return_value=temporalio.api.workflowservice.v1.TerminateActivityExecutionResponse()
)
service_client = mock.MagicMock()
service_client.config.identity = "test-identity"
service_client.workflow_service.terminate_activity_execution = rpc
client = Client(service_client)
await client.get_activity_handle("my-activity").terminate(reason="done")
print(repr(rpc.call_args.args[0].request_id)) # prints '' on main
Environment/Versions
- SDK:
mainat 600cbec - Python 3.13, Linux x86_64
Additional context
Adding request_id=str(uuid.uuid4()) to the request makes retries of the same call idempotent, matching the other activity operator calls.
- Ngôn ngữ chính
- Python
- Star
- 1.2k
- Fork
- 276
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 68
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của temporalio/sdk-python
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
temporalio/sdk-python#496 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Annotated constraints and validators on workflow/activity/handler parameters are ignored by the Pydantic data converterCó thể đã có người làm @tconley1428 đã nhận 3 ngày trước. Đang mởbug
temporalio/sdk-python#2006 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Proposal: handle SIGTERM by default to initiate graceful worker shutdownCó thể đã có người làm @eamsden đã nhận 17 ngày trước. Đang mở
temporalio/sdk-python#1948 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Cloud CI Skips Nexus TestsCó thể làm lại được @tconley1428 đã nhận 75 ngày trước và không có pull request nào đang mở. Đang mở
temporalio/sdk-python#1704 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows ARM64 wheel supportĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
temporalio/sdk-python#1592 · 8 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của temporalio/sdk-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NVIDIA/flare-local-inference#90 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/streaming comp/gateway P2 platform/telegram type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-agent#144897 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
request-theme
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
LizardByte/ThemerrDB#9575 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Author Page: noshin-nawalĐang mởauthor-page correction
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
acl-org/acl-anthology#10599 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zilliztech/memsearch#818 ·
Maintainer thường phản hồi trong vòng 1 ngày