Skip to content

fix(workflow): invalidate UI parts when a step retries - #18626

Open
uuzzrm wants to merge 2 commits into
vercel:mainfrom
uuzzrm:codex/fix-workflow-retry-invalidation
Open

fix(workflow): invalidate UI parts when a step retries#18626
uuzzrm wants to merge 2 commits into
vercel:mainfrom
uuzzrm:codex/fix-workflow-retry-invalidation

Conversation

@uuzzrm

@uuzzrm uuzzrm commented Aug 10, 2026

Copy link
Copy Markdown

Summary

When a workflow model step retries, the UI message stream can retain parts produced by the failed attempt. This leaves stale text, reasoning, or tool state visible to the client.

This change adds a transient reload marker around retried model steps and makes the UI stream discard the current step's parts when it receives that marker.

Changes

  • Emit a data-reload marker between finish-step and start-step for retry attempts.
  • Preserve the marker when converting workflow stream parts to UI message chunks.
  • Clear the current step's text, reasoning, and partial tool-call state when the marker is processed.
  • Add regression coverage for the workflow and UI stream paths.
  • Add patch changesets for ai and @ai-sdk/workflow.

Verification

  • AI package tests: 3411 passed
  • Workflow Node tests: 166 passed
  • Workflow Edge tests: 166 passed
  • AI and Workflow type checks passed
  • Package builds and declaration generation passed
  • oxlint passed with 0 errors
  • git diff --check passed

Fixes #18481

Comment thread packages/ai/src/ui/process-ui-message-stream.ts Outdated
Signed-off-by: Ruiming Zhao <uuzzrm@gmail.com>
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.

WorkflowAgent has no way to communicate to client that a retry invalidated stream parts

1 participant