Skip to content
MustHave.ai
AI Tools

Cloudflare Shows How to Resume Codex Runs After a Worker Restarts

Cloudflare’s experimental Codex example preserves sessions and completed steps across restarts. Interrupted steps can run again, so external writes need safeguards.

Cloudflare Shows How to Resume Codex Runs After a Worker Restarts
Cloudflare’s experimental Codex example stores completed steps so they can be reused after a restart.

A restarted agent can recover its work and still submit the same ticket twice.

On November 9, Cloudflare published an experimental Codex example for Workers. It runs the Codex agent loop in a Durable Object, where it can keep conversation history, files, and completed model and tool results across restarts. The example adapts the Rust code that processes Codex turns to WebAssembly.

The restart boundary runs through the tool call

The implementation guide explains how the Agents SDK records model and tool steps. If a step finished and its result was recorded, the agent can reuse that result after a restart. If execution was interrupted before the result was recorded, the step can run again. The same principle applies to interrupted model calls.

Suppose the agent files a support ticket. The ticket service accepts the request, but the Worker stops before it records the response. The agent sees an unfinished step even though the ticket already exists. Keeping the conversation and files safe does not resolve that ambiguity.

Test recovery with a write you can count

Start with a mock ticket service and a stable identifier for each intended ticket. Send the same identifier on a retry and have the service return the existing ticket instead of creating another one. Stop the Worker once before the write and once after the service accepts it. In each case, success means one ticket and a usable result for the resumed agent.

Also test a tool that only reads data. Repeating a read may be acceptable, though its result can change. A write that sends a message or changes a record calls for a different retry rule. We have not run this interruption test.

Use the example to check the parts your app owns

Cloudflare’s example uses GPT-6.1 Sol through AI Gateway. Its setup instructions describe the model configuration, tool support, and recovery limits. Treat it as a reference for building an agent on Workers. The announcement does not turn an existing Codex desktop session into a hosted Worker.

Our Pi session migration article covers a separate Cloudflare agent integration. If you use both, test recovery for each one before you put a write-capable tool behind it.

Abdessalam Alaoui

I'm Abdessalam Alaoui, founder of Musthave.AI. I write practical guides to AI models, tools, generative media.

Join the discussion

Your email address will not be published. Required fields are marked *

Keep reading

All news