fix(workflow): Fix stepNumber on telemetry events#15151
Merged
Conversation
5 tasks
gr2m
added a commit
that referenced
this pull request
May 11, 2026
## Background Follow-up to #15151: `doStreamStep` creates the `StepResult`, so it should receive the step number instead of relying on callers to patch the result afterward. ## Summary Adds a defaulted `stepNumber` option for workflow stream steps. ## Manual Verification - `pnpm turbo build --filter=@ai-sdk/workflow...` - `pnpm test:node src/stream-text-iterator.test.ts` from `packages/workflow` - `pnpm type-check` from `packages/workflow` ## Checklist - [ ] All commits are signed (PRs with unsigned commits cannot be merged) - [ ] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [ ] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [ ] I have reviewed this pull request (self-review) ## Related Issues Follow-up to #15151. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
stepNumber on telemetry events
Contributor
|
🚀 Published in:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Follow-up fixes from testing WorkflowAgent telemetry with DevTools.
Manual Verification
Run Locally
Start DevTools from the example workspace:
cd packages/devtools pnpm devOpen http://localhost:4983 to inspect captured telemetry.
In a second terminal, run the Workflow example:
cd examples/next-workflow pnpm devOpen http://localhost:3000/telemetry and run the scenarios from the sidebar.
When running "Happy path" example with telemetry disabled, only 7 steps are created (
doStreamStepx3,getWeather,calculate,writeToolResultsWithStepBoundaryx2But with telemetry disabled, an additional step is added for each telemetry callback, resulting in ~70 steps
Possible Fix
WorkflowAgentshould keep telemetry overhead minimal by buffering telemetry events internally and flushing them in coarse, best-effort batches, e.g. once per AI step or once per run, instead of awaiting every integration callback individually. That would let users configure normal remote telemetry integrations without each telemetry event becoming its own durable workflow step.