Skip to content

Expose requested_start_time and actual_start_time on standalone activities#10760

Merged
fretz12 merged 3 commits into
fredtzeng/saa-start-delay-resetfrom
fredtzeng/saa-start-delay-desclist
Jun 30, 2026
Merged

Expose requested_start_time and actual_start_time on standalone activities#10760
fretz12 merged 3 commits into
fredtzeng/saa-start-delay-resetfrom
fredtzeng/saa-start-delay-desclist

Conversation

@fretz12

@fretz12 fretz12 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What changed?

Adds requested_start_time and actual_start_time to ActivityExecutionInfo for standalone activities:

  • requested_start_time = schedule_time + start_delay. Always populated (equals schedule_time when start_delay is unset).
  • actual_start_time = when a worker first picked up the activity, read from first_attempt_started_time. Unset until first pickup, and never moves on retries or resets.

The delta between the two is a useful debugging signal: it captures how long a worker took to pick the activity up after its requested target (matching backlog, worker downtime, etc.).

Also cleaned up a misleading timeout error message.

Why?

Both fields to be exposed via Describe for the SAA "delayed-not-yet-dispatched" use case. Describe today shows neither. This PR closes the Describe-side gap.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

@fretz12 fretz12 requested review from a team as code owners June 17, 2026 23:22
@fretz12 fretz12 marked this pull request as draft June 17, 2026 23:23
@fretz12 fretz12 force-pushed the fredtzeng/saa-start-delay-reset branch from d1ba240 to 41170f2 Compare June 18, 2026 20:03
@fretz12 fretz12 force-pushed the fredtzeng/saa-start-delay-desclist branch from 4748df2 to b1d3d85 Compare June 18, 2026 20:03
@fretz12 fretz12 force-pushed the fredtzeng/saa-start-delay-reset branch from 41170f2 to 1d2c473 Compare June 18, 2026 21:23
@fretz12 fretz12 force-pushed the fredtzeng/saa-start-delay-desclist branch from b1d3d85 to 0e74b39 Compare June 18, 2026 21:23
@fretz12 fretz12 force-pushed the fredtzeng/saa-start-delay-reset branch from 1d2c473 to 4d444ae Compare June 18, 2026 22:15
@fretz12 fretz12 force-pushed the fredtzeng/saa-start-delay-desclist branch from 0e74b39 to 7e132e7 Compare June 18, 2026 22:15
} else {
// Deduction failed as there's not enough information to fill in missing timeouts.
return serviceerror.NewInvalidArgumentf("a valid StartToClose or ScheduleToCloseTimeout is not set on ScheduleActivityTaskCommand. ActivityId=%s ActivityType=%s",
return serviceerror.NewInvalidArgumentf("a valid StartToCloseTimeout or ScheduleToCloseTimeout must be set on the activity. ActivityId=%s ActivityType=%s",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sliding in an err message fix as pointed out in another conversation

@fretz12 fretz12 marked this pull request as ready for review June 18, 2026 22:56

@dandavison dandavison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

## What changed?
Pre-dispatch unpause for standalone activities now lifts the next
dispatch to `scheduleTime + start_delay` instead of firing at unpause
time, by wiring the existing `respectStartDelay` helper into the
`unpause` path (one line). This means:
- Pause then unpause within the delay window → still dispatches at the
original wall-clock target. Multiple cycles do not drift it.
- Pause past the delay end + unpause → dispatches immediately (no extra
delay re-imposed).
- Pause after first dispatch + worker yield + unpause → `start_delay` is
not re-applied (no-op once the activity has been picked up).
- `ScheduleToStartTimeout` re-emitted on unpause is anchored to the new
dispatch target, not to "now."

`ScheduleToClose` behavior during pause is intentionally unchanged: the
deadline stays active and can fire while paused, matching the existing
`ScheduleToCloseTimeoutWhilePaused` test.

Also annotates the time-constants across the `TestStartDelay` subtests
with the math/intent behind each.
  
## Why?
The `start_delay` countdown is wall-clock and keeps ticking through
pause; on unpause the activity should dispatch at the original
`scheduleTime + start_delay` (or immediately if that target is already
past). Before this change, unpause in the delay window dispatched at
"now," so a user could accidentally shrink the delay by pausing and
unpausing.

## How did you test it?

- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

---------

Co-authored-by: Dan Davison <dan.davison@temporal.io>
@fretz12 fretz12 merged commit efa05c3 into fredtzeng/saa-start-delay-reset Jun 30, 2026
43 of 45 checks passed
@fretz12 fretz12 deleted the fredtzeng/saa-start-delay-desclist branch June 30, 2026 23:19
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.

2 participants