Skip to content

Cloudflare code-update reset leaves awaited agent dispatch pending until outer Workflow attempt fails #459

Description

@dknecht

Summary

An awaited init(agent, { id, uid: null }).dispatch(...) running inside a Cloudflare Workflow step did not promptly settle after the target agent Durable Object was reset by a deployment. The agent trace recorded Durable Object reset because its code was updated, but the caller remained pending until Cloudflare Workflows failed the step with WorkflowInternalError after about five minutes.

The Workflow retry then found the create-only agent instance already present and had to treat it as an existing in-flight conversation. There was no prompt terminal result from the original awaited dispatch.

Reproduction shape

  1. From a Cloudflare Workflow step, await a dispatch to a create-only one-shot agent instance.
  2. Let the agent begin a model turn.
  3. Deploy updated agent code while the turn is active.
  4. Observe the agent operation report a code-update Durable Object reset.
  5. Observe the awaiting Workflow step remain pending, then fail with WorkflowInternalError several minutes later instead of receiving a prompt structured rejection or resumed result.

Expected behavior

After a deployment reset, Flue should either recover the durable submission or settle the awaited dispatch promptly with a structured interruption error. The caller should not remain pending until an outer Cloudflare Workflow platform failure.

Questions / suggested checks

  • Is this another manifestation of the stale process-local attempt/controller recovery race described in Cloudflare interrupted submission recovery can be blocked by stale activeAttempts entry #457?
  • Can code-update recovery ensure the original dispatch() promise observes the replacement attempt or terminal settlement?
  • Can the runtime expose a distinct code-update interruption/recovery outcome so an outer durable orchestrator can retry deterministically?
  • A regression test where a Cloudflare agent fiber is interrupted by a code update while dispatch() is awaited from a Workflow would cover this boundary.

Environment

  • @flue/runtime@0.4.0-nightly.202605101957
  • Cloudflare Workers Durable Objects
  • Cloudflare Workflows caller
  • Workers AI model call active at deployment time

The application also had ephemeral cross-turn state that needed to move to usePersistentState; that is being fixed application-side. This issue is specifically about the awaited dispatch remaining pending after the code-update reset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix pendingFixed on a development branch; lands with the next release

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions