Skip to content

Fix activity retry scheduled timestamps in the test server - #3078

Open
sangkyoonnam wants to merge 1 commit into
temporalio:mainfrom
sangkyoonnam:fix/1069-test-server-first-retry-delay
Open

sangkyoonnam wants to merge 1 commit into
temporalio:mainfrom
sangkyoonnam:fix/1069-test-server-first-retry-delay

Conversation

@sangkyoonnam

Copy link
Copy Markdown
Contributor

What was changed

  • StateMachines#attemptActivityRetry now sets the retry attempt's current_attempt_scheduled_time to the current time plus the backoff interval, instead of the failure time.
  • Added ActivityRetryScheduledTimeTest covering the scheduled timestamps of retry attempts on the test server. It is skipped against an external server, where the retries take over a minute of wall time.

Why?

The test server already scheduled the retry timer correctly after the backoff, but stamped the attempt's scheduled time with the failure time. The retries ran at the right time, while ActivityInfo#getCurrentAttemptScheduledTimestamp reported the first retry as scheduled immediately (approximately 0, 0, 10, 30 seconds relative to the first attempt, instead of 0, 10, 30, 70 seconds). The real server sets the scheduled time to the next attempt time after the backoff, and the Nexus operation retry path in the same file already does this. lastAttemptCompleteTime remains the failure completion time; only the next attempt's scheduled timestamp includes the backoff.

Checklist

  1. Closes TestWorkflowEnvironment schedules the first activity retry immediately #1069

  2. How was this tested:
    New ActivityRetryScheduledTimeTest records getCurrentAttemptScheduledTimestamp() for four attempts with a 10s initial interval and 2.0 backoff coefficient, and asserts each gap is within [backoff - 1s, backoff + 5s]. Run with ./gradlew :temporal-sdk:test --tests "io.temporal.workflow.activityTests.ActivityRetryScheduledTimeTest". The regression test fails with the implementation change reverted (attempt 2 scheduled PT0.01S after previous, expected between PT9S and PT15S) and passes with the fix.

  3. Any docs updates needed?
    No.

@sangkyoonnam
sangkyoonnam requested a review from a team as a code owner September 16, 2026 05:36
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.

TestWorkflowEnvironment schedules the first activity retry immediately

1 participant