Skip to content

Conversation

@gow
Copy link
Contributor

@gow gow commented Nov 24, 2025

What changed?

  • Prevents workflow task generation when paused (ex: signals, activity completions, child workflow completions etc)
  • Prevents activity task generation when a workflow is paused and an inflight workflow task comes back with start activity commands.
  • Prevents eager activity starts when the workflow is paused.

Why?

When a workflow is paused, we should not generate any more new activity and workflow tasks.

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)

Note

Prevents scheduling new workflow and activity tasks while a workflow is paused and adds functional tests covering pause/unpause behavior with activities and child workflows.

  • History/API:
    • service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go
      • Use bypassTaskGeneration to skip activity task creation when eagerStartActivity or workflow status is WORKFLOW_EXECUTION_STATUS_PAUSED.
    • service/history/api/update_workflow_util.go
      • Only schedule a new workflow task if there is no pending task and execution status is WORKFLOW_EXECUTION_STATUS_RUNNING.
  • Tests:
    • tests/pause_workflow_execution_test.go
      • Expand functional tests to register an activity and child workflow; gate activity completion via channel.
      • Assert workflow remains PAUSED after activity completion and after receiving a signal; verify it completes after UNPAUSE.
      • Add cleanup/unpause path and assertions for already-paused scenarios.

Written by Cursor Bugbot for commit 25a4b89. This will update automatically on new commits. Configure here.

@gow gow requested review from a team as code owners November 24, 2025 06:12
@gow gow requested review from spkane31 and yycptt November 24, 2025 06:13
err = s.SdkClient().SignalWorkflow(ctx, workflowID, runID, s.testEndSignal, "signal to complete the workflow")
s.NoError(err)

time.Sleep(2 * time.Second) // wait 2 seconds to give enough time record the signal.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the sleep required with the s.EventuallyWithT below?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's also a failure in tests that needs to be fixed but lgtm

Comment on lines +513 to +515
} else { // if not we bypass activity task generation if eager start activity is requested.
bypassActivityTaskGeneration = eagerStartActivity
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: looks like the else part is a duplication of L509.

// Create a transfer task to schedule a workflow task
if !mutableState.HasPendingWorkflowTask() {
// Create a transfer task to schedule a workflow task only if the workflow is in running status and there is no pending workflow task.
if !mutableState.HasPendingWorkflowTask() && mutableState.GetExecutionState().GetStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think workflow tasks scheduled on the task processing side goes through this code path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm.. maybe intercepting in the task generator is the better? Specifically in TaskGeneratorImpl.GenerateScheduleWorkflowTaskTasks().

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.

4 participants