Prevent workflow task and activity task generation when workflow is paused
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?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [x] added new functional test(s)
[!NOTE] Prevents new workflow/activity tasks and updates on paused workflows (disables eager activities, rejects force-create WFT), and avoids WFT scheduling across signal, reapply, and close-transaction paths with comprehensive tests.
- Behavior changes (paused workflows):
- Block new workflow tasks when paused:
- Reject
ForceCreateNewWorkflowTaskinrespondworkflowtaskcompleted(api.go).- Skip WFT scheduling in
signalwithstartworkflowand NDCevents_reapplier.- Guard
ScheduleWorkflowTaskandcloseTransactionHandleWorkflowTaskSchedulingagainst paused state.UpdateWorkflowWithNewno longer schedules WFT if paused.- Block activity dispatch when paused:
- In
workflow_task_completed_handler.go, disable eager activity and bypass activity task generation when paused.- API/Interfaces:
- Add
MutableState.IsWorkflowExecutionStatusPaused()and implement inworkflow/mutable_state_impl.go.- Tests:
- New/updated unit and functional tests covering paused behavior for updates, signals, reapply, WFT completion, activity failure, and transfer queue (
tests/pause_workflow_execution_test.go, variousapi_*_test.go,events_reapplier_test.go,transfer_queue_active_task_executor_test.go).Written by Cursor Bugbot for commit 10512802ec80e7cc989a484ffda7dc6310655e00. This will update automatically on new commits. Configure here.
This needs more work. Moving it back to draft.
I think task_refresher needs to be updated as well to not regenerated activity & workflow task. and yeah I think I'd prefer the logic lives in refresher not task generator, and keeps generator logic simple/straightforward.
Looked into this and it seems like existing checks will already prevent task generation. In both places we first check if the wokflow status is in RUNNING before generating the tasks.