cloudflare / cloudflare/cloudflare-os
Long agent turns can lose completion when their Worker execution ends
- Dominant language
- TypeScript
- Stars
- 9.9k
- Forks
- 1.2k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 107
Description
## Problem
I ran into a lifecycle problem while testing longer agent tasks. A turn starts in the workspace Durable Object, but the path that returns its result still depends on the Worker execution that started it.
Short turns finish before this matters. A longer turn can outlive that execution. When this happens, the user can lose the final result even though the workspace still knows that the turn was active.
## Why this matters
The duration of a turn depends on the model, tools, and work being done. A correct task should not fail only because it needed more time.
The lifecycle also needs to remain consistent after a restart. We should not run the same turn twice, leave stale active state, or require the user to retry without knowing whether the original work is still running.
## Expected behavior
A long turn should have a durable completion path. It should either return its result or fail cleanly. A restart should not duplicate the work, and a finished turn should not leave active state behind.
## Related changes
The implementation is split into two stacked pull requests:
1. #206 adds the release support needed to deploy Workflow definitions.
2. #207 adds the durable agent-turn lifecycle and depends on #206.
Contributor guide
Research direction
Start by reading stacked PRs #206 and #207, since the issue says the implementation has moved there and #207 depends on #206. Trace the Worker and workspace Durable Object lifecycle described in those changes. Done means long turns complete or fail cleanly, restarts do not duplicate work, and finished turns clear active state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, cloud, distributed-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100