I have a long-running workflow that can sleep for weeks or even months. In the meantime we found bugs in our steps code, so we now have many on‑flight workflows that will execute wrong code logic in the future. How can I upgrade the on‑flight workflows to the latest code version?
Hey, @joaomainka! You cannot update in-flight workflows to use new code. Once a workflow starts, it captures the code at that point in time and will continue using that version until completion.
Vercel Workflows uses event sourcing and deterministic replay. This means:
- When a workflow sleeps, it saves its state and event history
- When it wakes up, it replays from that saved state using the original code
- This ensures consistency but prevents code updates mid-flight
The team is aware this can be challenging for long-running workflows, but changing this would break the deterministic guarantee that makes workflows reliable.