r/programming • • Oct 18 '26

Durable workflows without replay: freezing the VM instead of re-running the code

https://qoqi.dev/blog/durable-workflows-without-replay
0 Upvotes

9 comments sorted by

12

u/marku01 Oct 19 '26

For what it's worth, this isn't an entirely new idea, and in my opinion, this is not that good of a solution/implementation. Inventing a whole new language, VM and compiler (or rather having an LLM do it) kinda kills any real world applicability.

On a technical side the VM design seems a bit odd to me. Personally, I find it strange to represent every type by bit-hacking 64bit floats. That just seems to waste a third of nearly all variables, and I imagine working with 48bit integers and the like can occasionally be a bit mystical. The use of some terminology is also a bit weird IMO. For example, not referring to CPU registers when using the term "registers", renaming stack frames to "windows" (from what I understand) and calling compiled functions "chunks" and so on... Also, I understand that a bytecode interpreter is initially much simpler, but it looks a bit like you roadblocked yourself from writing an AoT compiler in the future and therefore leaving huge performance gains forever on the table.

And all that just to still delegate the meat of a workflow to external invocations. So a developer still has to deal with managing idempotency manually, in addition to learning a new language.

I'm sorry, but I won't bother going too much deeper into the technicals. It is very clear that this is entirely LLM generated with the documentation seemingly consisting of LLM discussions. I have not read any of the code, and I suspect that you haven't either.

From what I gather, the industry is slowly heading to doing the same with WebAssembly. WASM provides a well-defined sandbox and standardised bytecode format with promising support in many languages. There are already durable Record/Replay runtimes out there and some* snapshotting capable runtimes. They promise features similar to your claims with vastly better industry support and performance, and additionally offer better system interfaces (WASI 0.3 and onwards).

I apologize if this sounds mean or rude, but at this point it kinda annoys me to see these huge slopware projects with barely any engineering effort behind them. So many are just a 5 hours old slopped out mess that was never really tested nor maintained after publishing an inspirational blog post about it.

*Wasmer already has guest assisted snapshotting using asyncify, and full VM snapshots are also kinda feasible.

3

u/dangerbird2 Oct 19 '26

There's also the whole "solution in search of a problem" thing, where for the vast majority of workloads, "replays" aren't really a major performance issue, and getting rid of them with a ad-hoc vm takes away the consistency/reliability guarantees of using battle-tested databases and/or message queues for persisting state.

Maybe it's an issue for people using durable workflows for AI agents, but in that case you're almost certainly relying on python libraries in which case this thing is a total non-starter

0

u/Fit-Chicken3944 Oct 20 '26

Avoiding replay isn't the only thing the approach buys:

  • No determinism rules. Nothing is replayed, so workflow code doesn't have to be deterministic. No "don't call the clock", no special APIs: just ordinary code between steps (in a new language, admittedly 😅).
  • Versioning checked at compile time. The compiler knows where a workflow can pause, and refuses a deploy that would break instances already running.
  • Side effects enforced by the compiler. Anything that touches the outside world has to go through a step. Otherwise it's a compile error, not a convention.

And the state isn't kept in an ad-hoc store: it lives in Postgres, MySQL or SQLite, written in transactions. Inputs, step results and messages are stored as plain JSON, so you can inspect them at any time. It hasn't been tested with millions of records yet, but the runtime is small and easy to audit.

No Python SDK yet, though, so for AI agents it's not usable today.

2

u/didroe Oct 20 '26

I agree with most of what you've said. But on the technical side I think it mostly makes sense for a VM, though not necessarily this particular one.

In dynamic languages (and this looks to be static!), you have to record the type of each value somehow. So you're never going to have a 32-bit integer be 32 bits. NaN tagging is a perfectly valid approach for this, and is used in Firefox/Safari Javascript engines and LuaJIT.

The overloading of "register" is also normal for a VM. Even CPUs overload the term and can have different internal registers to the ones your program refers to (eg. x86).

Calling compiled code a "chunk" seems ok to me, and could be generic enough to be used for other code that isn't a function if the need arises. On "frame", it seems like they used that for the continuation and then had to pick a different name for the memory region. I probably would have used "continuation" and "frame" rather than "frame" and "window".

Still, I don't think it's good to invent a whole new VM and language for this use case

1

u/marku01 Oct 20 '26

That's interesting to know. I was only familiar with some WASM runtimes, so I guess it just seemed odd to me, but not odd generally. Type annotations make a lot more sense when considering dynamic typing.

0

u/Fit-Chicken3944 Oct 20 '26

Fair enough, and I probably should have framed the context better in my post.

I'm not claiming this is the best idea, a revolutionary one, or the best solution to the problem. It's a prototype of an idea I had, built in a few weeks, and yes, with heavy use of AI. I have some background in compilers, but not enough to claim I could have designed a production-grade compiler and VM on my own.

Honestly, that's what I find exciting: going from an idea to a working prototype, with a compiler, a durable runtime, SDKs and tests, in that little time. It clearly has rough edges, but I don't think that makes it slop by default.

What I wanted to test is one specific idea: if the language knows where a workflow can pause, it can check at compile time that a new version won't break the instances already running. The VM design, the naming and the docs are the parts most shaped by the speed of the prototype, and your points on them are fair.

One thing I'd push back on: idempotency isn't left to the developer. Every step has a stable key, its result is persisted and never re-run, and the SDKs store an external app's answer in its own DB transaction under that key. There's also a test mode that crashes a flow after every write and checks that no step ran twice.

WASM-based durable runtimes are a serious direction, probably the more realistic one for the industry. This is an experiment, not a competitor to them. I'm sorry if it felt like a waste of your time, but I don't think everything in it deserves to be thrown away. Thanks for the detailed feedback either way.

1

u/marku01 Oct 20 '26

Sorry if I misunderstood, but when I read about your tool call protocol I assumed that these tools are not inherently failure-resistant, right? If an invocation fails halfway through, it must be invoked again. Which is fine, but it means that the developer has to identify every possible side effect and still handle idempotency. You can publish SDKs to help, but not every side effect is an easily recorded HTTP request or DB transaction that can be replayed/skipped. Also, you can't publish SDKs for every language in any case.

If it's not meant to be a competitor, then why does your website contain a rather aggressive feature comparison chart? It seems you are trying to suggest that your solution is better than the others in every category. And I find some info in there to be a bit dishonest. Like "A step never runs twice" for which you state "Settled<T>" (which I don't understand). But isn't your thing the exact same at least once execution guarantee of every other solution? See above, you have to retry steps in case of failures, no? Or "Steps in any languages" where you claim to support any language because of an HTTP interface while others are limited to selected languages only. But by that logic all runtimes support all languages because a Python+SDK step can just as easily call a C++ HTTP API. And I haven't looked into any of the other solutions, but somehow I doubt that none of them simulate step failures or why "A server" is in any way different from your "One binary" claim.

Regarding AI.Your prototype is over 170k LoC which I guess is at least 99% LLM generated. Obviously it's impossible to tell the exact energy cost or environmental impact. If this were really important work then maybe it's justified. But using the unethical, inefficient, plagiarism machines developed by the most shameless, arrogant and wasteful companies, just to do an "experiment"? Not what I would consider exciting. And I have to cut it short here because otherwise this comment would just be another 3 paragraphs whining about LLMs.

1

u/Fit-Chicken3944 Oct 20 '26

Fair criticism on the comparison pages. They exist because the first question people ask is "why not just use Temporal, or the Workflow SDK?", and I wanted that answered upfront, not to claim Qoqi beats them everywhere. But i agree some rows went too far and most of your points are valid. I'm going to address this. I also updated the article to disclose AI usage.

On idempotency: you're right, side effects still have to be idempotent. Each step gets a stable key to help, nothing more. Where Qoqi differs is when a step must not be retried. Elsewhere, an at-most-once step that dies mid-flight usually comes back as an ordinary timeout, which looks like "it failed" and invites a retry, so you get charged twice. In Qoqi, "it may or may not have happened" is its own case, and the compiler won't let you skip it:

step fn charge(order: Order) -> Result<Charge, Decline> {
    return gateway.charge(order.id, order.amount, flow.key());
}

step fn capture(auth: String, amount: Int) -> Settled<String> within 1.minutes() { ... }

match capture(auth, order.amount) {
    case Done(reference): return Outcome.Paid(reference);
    case Unknown: return lookup(auth);   // required: ask the bank what happened
}

On AI: it isn't 99% generated. The language came first, as a personal project I worked on for a while; the workflow engine on top is what I put together in a few weeks, with a lot of AI help.
TBH, I get your position on LLMs, and I won't try to change your mind 🙂

2

u/robert_7524 Oct 22 '26

One edge case: the provider's idempotency-key retention has to outlast the workflow's retry window, or a late retry can still duplicate the effect.