How to design long running workflows?

Hi Team,

I am designing an Tenant lifecycle workflow where each tenant has a dedicated workflow upon creation.

Several use cases for the Tenant like extending the timelines, backing up the data and delete or force delete after a dedicated wait are handled using external signals to this lifecycle workflow.

I have set of tenants created and its submits a lifecycle and if there are workflow code changes in the future the old set of lifecycle does not work and getting the below error,

Caused by: io.temporal.internal.replay.NonDeterminisicWorkflowError: Unknown CommandId{commandTarget=TIMER, commandEventId=17}. The possible causes are a nondeterministic workflow definition code or an incompatible change in the workflow definition.
at io.temporal.internal.replay.CommandHelper.getCommand(
at io.temporal.internal.replay.CommandHelper.handleTimerStarted(
at io.temporal.internal.replay.ReplayWorkflowExecutor.processEvent(
at io.temporal.internal.replay.ReplayWorkflowExecutor.handleWorkflowTaskImpl(
at io.temporal.internal.replay.ReplayWorkflowExecutor.handleWorkflowTask(
at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskWithEmbeddedQuery(
at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskImpl(
at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(
at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(
at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(
at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(

How should i go about handling the older lifecycle workflows? As the newly added business logic is applicable for the older tenants as well and it has lots of states which i dont want to discard by submitting a new workflow. Please advise.

Duplicate of Unexpected error causing Out of Memory while running lifecycle workflows