Workflow retries logic

Hi all. I have the following activity options in my workflow:

activityCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
		StartToCloseTimeout: time.Hour,
		HeartbeatTimeout:    2 * time.Second,
		RetryPolicy: &temporal.RetryPolicy{
			InitialInterval:    time.Second,
			BackoffCoefficient: 2.0,
			MaximumInterval:    time.Minute,
			MaximumAttempts:    20,

When the workflow fails, temporal created a new one with the same identifier and kept trying in it. Why does this happen?

Can you check if you have retry policy configured for your workflow too? If so, after the activity exhaust it’s retries, the workflow itself will be retried with a continue-as-new execution, hence the same workflow ID.

Reference: Retry Policies | Temporal Documentation

Yes, workflow also has retry options. Its MaximumAttempts option are higher than the activity MaximumAttempts. Thank you!

It’s typically not recommended to explicitly set workflow retry policy. Do you have specific use case for it?

No, there are no special use cases.

Ok, in that case I don’t think you should specify it.