Skip to content

Conversation

spkane31
Copy link
Contributor

READ BEFORE MERGING: All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted.

What changed?
adding a timestamp to TriggerImmediatelyRequest message

We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id.

Breaking changes

Server PR

@spkane31 spkane31 requested review from a team as code owners June 25, 2025 15:21
@@ -278,6 +278,9 @@ message ScheduleState {
message TriggerImmediatelyRequest {
// If set, override overlap policy for this one request.
temporal.api.enums.v1.ScheduleOverlapPolicy overlap_policy = 1;

// Timestamp for when this request should be triggered.
Copy link
Contributor

Choose a reason for hiding this comment

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

This time is not "when" anything will happen, it will always happen immediately. I'd say it more like:

Suggested change
// Timestamp for when this request should be triggered.
// Timestamp used for the identity of the target workflow.

Copy link
Member

Choose a reason for hiding this comment

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

Even with that explanation I don't understand it exactly. Is this the value that is in TemporalScheduledStartTime SA (and what helps make up the workflow ID) or is this in the workflow start event or something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it'll be the value in that SA. But more importantly it'll be the value in the workflow id, so the "same" trigger always makes the same workflow id.

Ideally we could fix this issue without touching api, but it does make some sense to have an explicit timestamp here (backfill has explicit timestamps, for example). And putting it here simplifies the server. I don't think it has to be exposed in SDKs but it could be if anyone wants it.

Copy link
Member

@cretz cretz Jun 25, 2025

Choose a reason for hiding this comment

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

👍 I suppose my only suggestion would be to call this scheduled_time to clarify it is used as the deterministic/idempotent time the workflow was considered scheduled at, but no strong opinion. I assume we will default this to "now" (also worth clarifying).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah, we should add that it defaults to now in the comment. I'm fine with either name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to scheduled_time and updated the comment with @dnr and @cretz suggestions

@spkane31 spkane31 requested review from cretz and dnr June 25, 2025 18:09
@spkane31 spkane31 merged commit 486e456 into master Jun 25, 2025
5 checks passed
@spkane31 spkane31 deleted the spk/trigger-immediately-bug branch June 25, 2025 18:29
yycptt pushed a commit that referenced this pull request Aug 4, 2025
_**READ BEFORE MERGING:** All PRs require approval by both Server AND
SDK teams before merging! This is why the number of required approvals
is "2" and not "1"--two reviewers from the same team is NOT sufficient.
If your PR is not approved by someone in BOTH teams, it may be summarily
reverted._

<!-- Describe what has changed in this PR -->
**What changed?**
adding a timestamp to `TriggerImmediatelyRequest` message

<!-- Tell your future self why have you made these changes -->
We can make the wft “more idempotent”: put the desired trigger time in
the trigger immediately request itself, so it goes in the signal
payload, so all wfts attempt to start the target with the same id.


<!-- Are there any breaking changes on binary or code level? -->
**Breaking changes**


<!-- If this breaks the Server, please provide the Server PR to merge
right after this PR was merged. -->
[**Server PR**](temporalio/temporal#7968)
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.

3 participants