Long Running Temporal Workflow

I have a long running temporal workflow, some instance of which can continue running indefinitely. I understand that workflows are deterministic, however is there a way to update my workflow logic without restarting it? I understand versioning is an option however for my indefinitely running workflows I do not know if that is a possibility.

Also following up the above topic, if I had a long running workflow W1 which called activity A1 and the activity returned an object O1 with 3 fields. If I added a 4th field to object when returning from the activity, would that classify my workflow as non-deterministic?

Lastly if my workflow continued-as-new would that be counted as a new version?

Sounds like you will have to address event history size and count limits for single execution in your case. Once an execution hits these limits it would get terminated by service.
You should be able to apply changes using versioning. Did you run into any issues with it? Temporal test env also provides WorkflowReplayer that you could use to test your versioned changes against event history of your running executions to catch any nondeterministic issues.

For activity question, no that wouldnt be a change you have to version.

Continueasnew completes current exec and atomically creates new one with same wfid. The continued exec is a new execution and it would run your workflow code from beginning. It does not increment versions as those directives are in your workflow code so you control it.

Thanks @tihomir for your response.
What do you mean by “address event history size and count limits for single execution”? Doesn’t continueAsNew address the event history size?

If you say continueAsNew does not increment workflow version I am not sure how I could version the workflow if I have an Indefinitely running workflow?

What do you mean by “address event history size and count limits for single execution” ? Doesn’t continueAsNew address the event history size?

yes, should check the isContinueAsNewSuggested flag see if true to decide to contiunueasnew, this flag addresses both event history count and size (is set to true on 4k event count, 4MB history size, whichever is reached first)

If you say continueAsNew does not increment workflow version I am not sure how I could version the workflow if I have an Indefinitely running workflow?

i think these are mutually exclusive, as in you can apply versioned changed to your workflow (see versioning/patching api in docs for your specific sdk) independently from need to address limitations of single execution mentioned (event history count/size).
Maybe take a look at Versioning - Java SDK | Temporal Platform Documentation and see if have specific questions