When both activity and workflow code changes in the same deployment, which is updated first in a running workflow?

Let’s say I have this code

WorkflowA
   err = run ActivityX
   return
ActivityX
   isRetryableErr = true
   isRetryableErr?
      return someRetryableErr
   return someNonRetryableErr

and then I set isRetryableErr to false and also change WorkflowA to run another activity in case ActivityX fails with non-retryable error like this

WorkflowA
   err = run ActivityX
   isNonRetryableError(err)?
      run ActivityZ
   return
  • If I deploy activity change first, currently running workflow will fail and ActivityZ will never run.
  • If I deploy workflow change first, currently running workflow will run ActivityZ.

But what if I deploy both at the same time? Will workflow code definitely update before activity change?

You are making a backward incompatible change in the activity interface. So, you either rename the activity or use a different task queue to execute it.

So you are saying it is not a good practice at all to deploy these changes together?

If that is the case, I believe deploying workflow code change first should prevent the potential issue.