- Issues
- #141
Celld v0.1.0 stalls Agents SDK fire-and-forget runFiber I/O after response
dleviminzi opened ·
## Expected behavior
The Agents SDK documents `void this.runFiber(...)` as its fire-and-forget execution pattern:
https://developers.cloudflare.com/agents/runtime/execution/durable-execution/#inline-vs-fire-and-forget
I expect Celld to behave like workerd:
1. Return the `202 Accepted` response immediately. 2. Continue executing the fiber. 3. Complete both outbound fetches. 4. Persist the final `completed` status.
## Actual behavior
Under Celld:
1. The request returns `202 Accepted`. 2. The fiber records `fetch-1-started`. 3. The destination echo server receives no request. 4. The durable status remains at `fetch-1-started` after more than 35 seconds. 5. The default 30-second Agents SDK keepalive alarm does not advance the minimal reproduction.
Under Wrangler/workerd, the same detached fiber completes both fetches in approximately 28 ms.
## Minimal behavioral difference
Both test modes execute the same fiber:
```ts const fiber = this.runFiber("sequential-fetches", async () => { await this.runChain(); });
if (attachToWaitUntil) { this.ctx.waitUntil(fiber); }
return Response.json({ accepted: true }, { status: 202 }); ```
Results:
- `attachToWaitUntil = true`: Celld completes immediately. - `attachToWaitUntil = false`: Celld stalls. - `attachToWaitUntil = false` under workerd: completes immediately.
The detached form matches the Agents SDK documentation:
```ts void this.runFiber("background", async () => { await longRunningProcess(); }); ```
## Workaround
```ts const fiber = this.runFiber("background", async () => { await longRunningProcess(); });
this.ctx.waitUntil(fiber); ```
This makes the Celld test complete immediately.
## Impact
This blocks frameworks that use the Agents SDK's documented detached `runFiber()` behavior.
For example, an agent may return an acceptance response and run its model/tool loop inside a durable fiber. Under Celld, that fiber can stall as soon as it performs outbound I/O. In my case, I was trying to run https://github.com/withastro/flue
## Reproduction environment
I've attached the files I used to reproduce this issue in isolation below.
Celld release commit: `553ae73f83c87c3f7c7a5f73c32c2211d9d7341f`
[agents-worker.ts](https://github.com/user-attachments/files/30961692/agents-worker.ts) [compose-agents.yaml](https://github.com/user-attachments/files/30961691/compose-agents.yaml) [compose.yaml](https://github.com/user-attachments/files/30961693/compose.yaml) [package-lock.json](https://github.com/user-attachments/files/30961698/package-lock.json) [package.json](https://github.com/user-attachments/files/30961702/package.json) [RESULTS.md](https://github.com/user-attachments/files/30961700/RESULTS.md) [run-repro.sh](https://github.com/user-attachments/files/30961701/run-repro.sh) [worker.js](https://github.com/user-attachments/files/30961694/worker.js) [wrangler-control.log](https://github.com/user-attachments/files/30961696/wrangler-control.log) [wrangler.agents.celld.json](https://github.com/user-attachments/files/30961699/wrangler.agents.celld.json) [wrangler.agents.jsonc](https://github.com/user-attachments/files/30961695/wrangler.agents.jsonc) [wrangler.celld.json](https://github.com/user-attachments/files/30961697/wrangler.celld.json)
- BA
Thanks for the report. We've already fixed it and we'll cut a 0.2.0 release soon.
werkamsusreferenced this in fix(cloudflare): retain background actor reconciliation via ctx.waitUntil #2972 months ago on GitHub
bohdanbirdiereferenced this in v0.4.1: detached timer stalls after DO webSocketMessage returns #1892 months ago on GitHub