Skip to content

fix(workflows): await _workflow_updateState RPC calls in _wrapStep#1071

Merged
threepointone merged 1 commit intomainfrom
fix/await-workflow-state-rpc
Mar 5, 2026
Merged

fix(workflows): await _workflow_updateState RPC calls in _wrapStep#1071
threepointone merged 1 commit intomainfrom
fix/await-workflow-state-rpc

Conversation

@threepointone
Copy link
Contributor

Fix

Adds missing await to three _workflow_updateState RPC calls inside step.do() callbacks in AgentWorkflow._wrapStep().

Affected methods: updateAgentState, mergeAgentState, resetAgentState

Without await, the step.do() callback returns immediately, the Workflows engine marks the step as durably completed, and the workflow moves on — but the RPC may not have been delivered to the Agent yet. This can cause state updates to be silently lost.

The other wrapped methods (reportComplete, reportError, sendEvent) already correctly await their RPC calls.

Fixes #1067

Credit to @zeke for the detailed writeup and root cause analysis.

updateAgentState, mergeAgentState, and resetAgentState were not awaiting
the RPC call inside step.do(), causing state updates to be silently lost
when the Workflows engine marked the step as complete before the RPC was
delivered.

fixes #1067
@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: 9d1eaaa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/agents@1071
npm i https://pkg.pr.new/@cloudflare/ai-chat@1071
npm i https://pkg.pr.new/@cloudflare/codemode@1071
npm i https://pkg.pr.new/hono-agents@1071

commit: 88fe6b7

@threepointone threepointone merged commit 6312684 into main Mar 5, 2026
3 checks passed
@threepointone threepointone deleted the fix/await-workflow-state-rpc branch March 5, 2026 11:56
@github-actions github-actions bot mentioned this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: step.mergeAgentState/updateAgentState/resetAgentState don't await RPC call

1 participant