Skip to content

Commit 6cf4bc3

Browse files
committed
fix bug of workflow ts impacting chasm
1 parent 9674980 commit 6cf4bc3

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

service/history/workflow/timeskipping.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@ func (ms *MutableStateImpl) closeTransactionHandleWorkflowTimeSkipping(
394394
ctx context.Context,
395395
transactionPolicy historyi.TransactionPolicy,
396396
) (needRegenTasks bool) {
397+
// This is the workflow (history-event) time-skipping path. CHASM executions (e.g. standalone
398+
// activities) run their own decision in the CHASM tree's closeTransactionHandleTimeSkipping;
399+
// running this path for them would scan only workflow-level targets (timers, pending activities,
400+
// run timeout) — none of which exist for a CHASM component — and its GateByFastForward would then
401+
// skip straight to the fast-forward and disable time skipping before the CHASM path ever runs.
402+
if !ms.IsWorkflow() {
403+
return false
404+
}
397405
switch transactionPolicy {
398406
case historyi.TransactionPolicyActive:
399407
// 1. gate: only a running, time-skipping-enabled, idle workflow may skip time

tests/activity_standalone_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ func (s *standaloneActivityTestSuite) TestTimeSkipping_StartDelayAndRetryBackoff
173173
BackoffCoefficient: 1.0,
174174
MaximumAttempts: 2,
175175
},
176+
// The 1h FastForward budget never binds here (both skip targets — the 20m start delay and
177+
// the 20m retry backoff — are well under 1h, so time skipping advances to them, not to the
178+
// budget). It is kept deliberately as a regression guard: it is precisely what surfaces the
179+
// bug where the workflow (history-event) time-skipping path runs for a CHASM execution and,
180+
// finding no workflow-level target, skips straight to the fast-forward and disables time
181+
// skipping before the CHASM path runs (fixed by the !ms.IsWorkflow() gate in
182+
// closeTransactionHandleWorkflowTimeSkipping). Without a FastForward that path has nothing to
183+
// skip to and the regression would not reproduce.
176184
TimeSkippingConfig: &commonpb.TimeSkippingConfig{
177185
Enabled: true,
178186
FastForward: durationpb.New(time.Hour),

0 commit comments

Comments
 (0)