fix: parallel/pipeline 不应吞掉工作流取消异常 - #1348
Conversation
📝 WalkthroughWalkthrough
ChangesWorkflow cancellation handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/workflow-engine/src/__tests__/runWorkflow.test.ts (1)
217-223: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAdd an assertion for the persisted terminal state.
The test checks
result.statusand the finalrun_doneevent. It does not check the persisted run record. A persistence regression could still storecompleted: [null]while this test passes. Read the persisted state, or assert the persistence call, for both workflow cases and requirestatus === 'killed'.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/workflow-engine/src/__tests__/runWorkflow.test.ts` around lines 217 - 223, Extend the affected workflow tests around the result status and final run_done assertions to also verify the persisted run record for both workflow cases. Read the stored state or inspect the persistence call, and require its status to be 'killed', guarding against a persisted completed value of [null].
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/workflow-engine/src/__tests__/runWorkflow.test.ts`:
- Around line 217-223: Extend the affected workflow tests around the result
status and final run_done assertions to also verify the persisted run record for
both workflow cases. Read the stored state or inspect the persistence call, and
require its status to be 'killed', guarding against a persisted completed value
of [null].
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6647c3d7-8b52-45fa-85c6-dcd798bdb649
📒 Files selected for processing (3)
packages/workflow-engine/src/__tests__/hooks.test.tspackages/workflow-engine/src/__tests__/runWorkflow.test.tspackages/workflow-engine/src/engine/hooks.ts
Summary
parallel()和pipeline()中重新抛出WorkflowAbortedError。null。runWorkflow端到端状态测试。修复后,用户取消组合 workflow 时,result、
run_done事件和持久化终态都保持为killed,不会错误显示completed: [null]。Test plan
bun test packages/workflow-engine/src/__tests__/hooks.test.ts packages/workflow-engine/src/__tests__/runWorkflow.test.ts(61 pass)bun run typecheckgit diff --check关联 issue
Closes #1345Summary by CodeRabbit
Bug Fixes
killedstatus and emit the final completion event.Tests