Skip to content

edge case fixes for time skipping propagation and fast-forward completion - #11373

Merged
feiyang3cat merged 1 commit into
temporalio:mainfrom
feiyang3cat:vts-fix-propagation
Aug 19, 2026
Merged

edge case fixes for time skipping propagation and fast-forward completion#11373
feiyang3cat merged 1 commit into
temporalio:mainfrom
feiyang3cat:vts-fix-propagation

Conversation

@feiyang3cat

@feiyang3cat feiyang3cat commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What changed and why?

  1. Edge case: If fast-forward completes during a workflow transaction but when time skipping checks at close transaction this fast-forward time is before ms.Now(), time skipping should still get disabled. Now we don't look at time points that are in the past and it is a bug.

  2. Time-skipping propagation: Always propagate the time-skipping configuration and fast-forward state to the next run and other executions, regardless of whether time skipping is currently active. This ensures that read APIs (for example, Describe and PollFastForward) continue to return meaningful information instead of nil.

    • Otherwise, in an edge case where fast-forward completes in the first run and the user polls after the second run has become the current run of the workflow execution, the poll API would return a NotFound error instead of a completed poll result.
    • Similarly, the Describe API would return a nil configuration instead of the original configuration that should have been propagated.
  3. Trivial changes:

    • simiplify parameter of propagateTimeSkippingToNextRun
    • unify UT names of timeskipping_test.go

@feiyang3cat
feiyang3cat force-pushed the vts-fix-propagation branch 2 times, most recently from 29a9c10 to 8e9ae5e Compare August 3, 2026 22:42
@feiyang3cat feiyang3cat changed the title add tests and fixes of time skipping fix time skipping should always propagate configuration Aug 3, 2026
@feiyang3cat feiyang3cat changed the title fix time skipping should always propagate configuration edge case fixes for time skipping propagation and fast-forward completion Aug 3, 2026
@feiyang3cat
feiyang3cat marked this pull request as ready for review August 3, 2026 23:39
@feiyang3cat
feiyang3cat requested a review from a team August 3, 2026 23:39
@feiyang3cat
feiyang3cat requested review from a team as code owners August 3, 2026 23:39
@feiyang3cat
feiyang3cat force-pushed the vts-fix-propagation branch from 8e9ae5e to 873b1e5 Compare August 3, 2026 23:39
@@ -267,16 +276,16 @@ func (t *timeSkippingTransition) GateByFastForward(ff *persistencespb.FastForwar
return
}
ffTargetTime := ff.GetTargetTime().AsTime()
// If a real candidate is scheduled strictly before the fast-forward target, we skip to
// that and the fast-forward budget is not yet exhausted — leave time skipping enabled.
if !ffTargetTime.After(t.CurrentTime) {

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.

for reviewers:

about the edgy case bug fix that ff completes during the transaction and Now() is after ff target time


// actions based on ff states: 1) disable time skipping 2) add ff timer task
if hasReached {
tsc.Enabled = false

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.

So FastForwardInfo is still set after time skipping is disabled. Do we always consult Enabled before returning FastForwardInfo (e.g. describe workflow execution call and others)

@feiyang3cat feiyang3cat Aug 11, 2026

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.

  1. read API like describe workflow execution returns the time skipping state (enabled, fast-forward info, etc) regardless of time skipping is enabled or not.
  2. So FastForwardInfo is still set after time skipping is disabled. right now the design is "we propagate both fast-forward config and fast-forward info thru the chain" so we don't differentiate the propagation on states. I am taking this path also kind of feeling this design is simpler than propagating different contents with different state?

ms.executionInfo.TimeSkippingInfo.Config = config
// restart the skip session before (re)applying fast-forward so the fast-forward's max-skip

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.

nit: I don't think applyFastForward actually looks at SessionSkipCount at all

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.

you are right. this comment misleads.

}
ms.executionInfo.TimeSkippingInfo = tsi

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.

nit: can set directly

@feiyang3cat
feiyang3cat merged commit bb09631 into temporalio:main Aug 19, 2026
81 of 83 checks passed
davidporter-id-au pushed a commit to davidporter-id-au/temporal that referenced this pull request Aug 24, 2026
…tion (temporalio#11373)

## What changed and why?

1. Edge case: If fast-forward completes during a workflow transaction
but when time skipping checks at close transaction this fast-forward
time is before ms.Now(), time skipping should still get disabled. Now we
don't look at time points that are in the past and it is a bug.

2. Time-skipping propagation: Always propagate the time-skipping
configuration and fast-forward state to the next run and other
executions, regardless of whether time skipping is currently active.
This ensures that read APIs (for example, Describe and PollFastForward)
continue to return meaningful information instead of nil.
- Otherwise, in an edge case where fast-forward completes in the first
run and the user polls after the second run has become the current run
of the workflow execution, the poll API would return a NotFound error
instead of a completed poll result.
- Similarly, the Describe API would return a nil configuration instead
of the original configuration that should have been propagated.

3. Trivial changes:
    - simiplify parameter of `propagateTimeSkippingToNextRun`
    - unify UT names of timeskipping_test.go
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