Skip to content

Fix activity retry expiration time not recalculated on workflow reset#10671

Open
NasitSony wants to merge 1 commit into
temporalio:mainfrom
NasitSony:fix-activity-retry-expiration-on-reset
Open

Fix activity retry expiration time not recalculated on workflow reset#10671
NasitSony wants to merge 1 commit into
temporalio:mainfrom
NasitSony:fix-activity-retry-expiration-on-reset

Conversation

@NasitSony

Copy link
Copy Markdown

When failInflightActivity resets a workflow, it overwrites ScheduledTime and FirstScheduledTime to the reset time, but RetryExpirationTime was not recalculated. This caused the expiration time to be earlier than the new scheduled time, making activities appear expired immediately after reset.

Fix: compute the retry duration (RetryExpirationTime - ScheduledTime) before overwriting ScheduledTime, then set:
RetryExpirationTime = resetTime + duration

This preserves the original schedule-to-close timeout duration relative to the new scheduled time.

Fixes #6952

What changed?

In failInflightActivity, recalculate RetryExpirationTime
based on the reset time before overwriting ScheduledTime.

Why?

When a workflow is reset, failInflightActivity overwrites
ScheduledTime and FirstScheduledTime to the reset time,
but RetryExpirationTime was left unchanged. This caused
the expiration time to be earlier than the new scheduled time,
making activities appear expired immediately after reset —
preventing retries from occurring.

The fix preserves the original schedule-to-close timeout
duration relative to the new reset time:

duration = RetryExpirationTime - ScheduledTime
RetryExpirationTime = resetTime + duration

This must be computed before ScheduledTime is overwritten
to preserve the original duration.

Fixes #6952

How did you test it?

  • built
  • covered by existing tests

Potential risks

Low — only affects activities with a retry expiration time
set (RetryExpirationTime != nil). Activities without a
retry policy are unaffected. Preserves the original
schedule-to-close timeout duration relative to reset time.

When failInflightActivity resets a workflow, it overwrites
ScheduledTime and FirstScheduledTime to the reset time, but
RetryExpirationTime was not recalculated. This caused the
expiration time to be earlier than the new scheduled time,
making activities appear expired immediately after reset.

Fix: compute the retry duration (RetryExpirationTime - ScheduledTime)
before overwriting ScheduledTime, then set:
RetryExpirationTime = resetTime + duration

This preserves the original schedule-to-close timeout duration
relative to the new scheduled time.

Fixes temporalio#6952
@NasitSony NasitSony requested a review from a team as a code owner June 12, 2026 01:33
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.

Extend activity retry expiration time upon reset

1 participant