Recently (since January) we have encountered some cases when deploying new versions of our managed package.
We have had at least 2 separate instances where changing a batch or an apex class referenced in a batch breaks the async execution because the batch has an old version of the code in memory.
I was reading the question "Does Apex Engine maintains old version of apex code for Async Apex?" from 2019 and they actually say
deploying a change in logic to the batchable's execute() will pick up the changes after the deployment while the job is running
But we encountered the complete opposite scenario where some apex jobs were scheduled to run and the code base was changed, but the job that was already scheduled actually ran with the old version of the code, and the next iteration (the one scheduled/ran after the code base change) actually runs with the new code base without a problem
Is this the normal behavior with async apex now? Just wondering how is everyone handling this situation. Right now we have come down to abort all scheduled jobs of any scheduled apex job being modified between package versions, but it's something really hard to narrow down if a reference has been modified in a way that may break the code.