Skip to content

Add configurable max_task_poll_retries to WorkerConfig#1

Open
soutar wants to merge 1 commit intoworkflow-sdkfrom
max-task-poll-retries
Open

Add configurable max_task_poll_retries to WorkerConfig#1
soutar wants to merge 1 commit intoworkflow-sdkfrom
max-task-poll-retries

Conversation

@soutar
Copy link

@soutar soutar commented Feb 23, 2026

Summary

  • Add max_task_poll_retries field to WorkerConfig (default 0 = unlimited, preserving existing behavior)
  • Add task_poll_retry_override to RetryClient with with_task_poll_retry_config() builder method
  • Wire WorkerConfig.max_task_poll_retriesRetryClient in init_worker_client()

Context

During INC-33, our Temporal workers retried poll_workflow_task_queue indefinitely for 50 minutes on stuck connections (TimeoutExpired errors). The SDK's task_poll_retry_policy() hardcodes max_retries: 0 (unlimited). With this change, setting a nonzero max_task_poll_retries causes the worker to exit after that many consecutive poll failures, allowing Kubernetes to restart the pod with fresh connections.

Error propagation path

RetryClient → ForwardError → wft_poller yields Err → workflow_stream "fatal error" → worker.run() returns Err → main() exits → K8s restarts pod

Test plan

  • cargo build passes
  • cargo test -p temporal-client -- retry — all 10 existing tests pass
  • cargo check with downstream consumer (tella-fusion temporal worker)

🤖 Generated with Claude Code

During INC-33, workers retried poll_workflow_task_queue indefinitely for
50 minutes on stuck connections (TimeoutExpired errors). The SDK's
task_poll_retry_policy() hardcodes max_retries: 0 (unlimited).

Add max_task_poll_retries field to WorkerConfig (default 0 = unlimited,
preserving existing behavior). When set to a nonzero value, the worker's
RetryClient uses a modified poll retry policy with a finite retry limit.
After exhausting retries, the error propagates through the poller stream,
causing the worker to exit so the orchestrator can restart it with fresh
connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant