fix(core): preserve workflow input after finish#1362
Conversation
WorkflowStateManager.finish() reassigned the stored input to the current data, so reading state.input after a workflow completed returned the final output instead of the initial input it documents. update() already preserves the input during a run; finish() now does too. state.data still reflects the final value. Adds a regression test.
🦋 Changeset detectedLatest commit: 79496a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughRemoves a single line from ChangesWorkflow state input preservation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What this fixes
WorkflowStateManager.finish()reassigned the stored input to the current data:WorkflowState.inputis documented as the initial input to the workflow, andupdate()deliberately preserves it across the run. Butfinish()overwrote it with the finaldata, so readingstate.inputafter a workflow completed returned the final output instead of the original input.Repro
Fix
Remove the reassignment in
finish(). The input is set once instart()and now stays put through completion;state.datastill reflects the final value. Added a regression test, and the full workflow suite (164 tests) stays green.Summary by cubic
In
@voltagent/core, fixWorkflowStateManager.finish()overwritingstate.inputwith the finaldata, so completed workflows now preserve their original input. Removed the reassignment and added a regression test;state.datastill reflects the final value.Written for commit 79496a1. Summary will update on new commits.
Summary by CodeRabbit