What are you really trying to do?
We're using KEDA to autoscale Temporal Python SDK workers to zero replicas when no workflows are executing. We use temporal_worker_task_slots_used (summed across all worker types) as the KEDA composite metric trigger, expecting it to be 0 when the worker is idle.
Describe the bug
sum(temporal_worker_task_slots_used{task_queue="..."}) never drops to 0 even when no workflows are running
Minimal Reproduction
Start a Python SDK worker with any workflow that has ≥2 sequential activities
Scrape temporal_worker_task_slots_used at 15s intervals
Observe: WorkflowWorker slots = 1 during WFT scheduling between activity 1 completing and activity 2 starting — even though ActivityWorker = 0 at that exact moment
Sum across all worker_type values: the sum is always ≥1 while any workflow is in progress, including the inter-activity scheduling gaps
Environment/Versions
OS: Linux (Kubernetes, Python 3.13)
Temporal Server: self-hosted, version does not have worker_heartbeats capability (pre-1.27)
Python SDK: latest (temporalio with sdk-core at commit 2872b53)
Worker Deployment versioning: enabled (WorkerVersioningStrategy::WorkerDeploymentBased)
Deployment: Kubernetes with KEDA autoscaler, cooldownPeriod: 600s, activationTargetValue: 0
Additional context
What are you really trying to do?
We're using KEDA to autoscale Temporal Python SDK workers to zero replicas when no workflows are executing. We use temporal_worker_task_slots_used (summed across all worker types) as the KEDA composite metric trigger, expecting it to be 0 when the worker is idle.
Describe the bug
sum(temporal_worker_task_slots_used{task_queue="..."}) never drops to 0 even when no workflows are running
Minimal Reproduction
Start a Python SDK worker with any workflow that has ≥2 sequential activities
Scrape temporal_worker_task_slots_used at 15s intervals
Observe: WorkflowWorker slots = 1 during WFT scheduling between activity 1 completing and activity 2 starting — even though ActivityWorker = 0 at that exact moment
Sum across all worker_type values: the sum is always ≥1 while any workflow is in progress, including the inter-activity scheduling gaps
Environment/Versions
OS: Linux (Kubernetes, Python 3.13)
Temporal Server: self-hosted, version does not have worker_heartbeats capability (pre-1.27)
Python SDK: latest (temporalio with sdk-core at commit 2872b53)
Worker Deployment versioning: enabled (WorkerVersioningStrategy::WorkerDeploymentBased)
Deployment: Kubernetes with KEDA autoscaler, cooldownPeriod: 600s, activationTargetValue: 0
Additional context