#11846

durable: let a tool mark a durable wait so restarts while waiting don't hit restartLimit

Openian-pascoeopened 2d ago

What do you want to change?

Give ToolExecutionApi a way to say "this call has reached a durable wait", so its reruns after a restart stop counting toward restartLimit. For example, api.progressed(context) would clear the task's restarts, and its owners' as well, so a codemode call that waits on a nested call is covered.

Why?

On Cloudflare, a Durable Object whose only pending work is an in-memory await goes to sleep after about 10 s. That await could be an approval or secret prompt waiting on the user. Our 60 s heartbeat alarm then wakes a fresh instance, and open() adds a restart to every running task. A replay: "safe" tool that just waits again commits nothing. So after 5 wakes, about 5 minutes, the call is parked (1.4) or ended (1.5), even though nothing crashed. Any human-in-the-loop tool that waits longer than about 5 minutes hits this.

How? (optional)

We patch 1.4.0 locally. progressed() goes through the same #gated + commitWith path as memo. It deletes restarts on the task, then walks up its owners, stopping at one that is parked or marked for abort. The tool calls it once its request is stored, right before it awaits. I'm happy to send a PR if that's wanted.

Activity

0

No activity yet.