Repository navigation
[Refactor] Make Task.create share its startup path with Task.run - #2146
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: Required CI passed. Waiting for automated review of the latest commit. If automated review does not start, a maintainer must restart it. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Related GitHub Issue
Closes: #2145
Description
Task.createrepeated the startup logic ofTask.run. It calledstartIdleTelemetryCheckitself. It also chose betweenstartTaskandresumeTaskFromHistory. The two startup paths could drift apart.This PR makes
Task.createvalidate its options first. It then returnsinstance.run()as the startup promise.Task.createandTask.runnow share one startup path. The returned promise is the cached run promise. A laterrun()call on the created instance returns the same promise, so the task cannot start twice.Resume, delegation, and persistence behavior is unchanged.
Reviewers should check two points with care:
Task.createnow throws before it constructs the instance when the options contain notask,images, orhistoryItem. Previously the throw happened after construction.historyItemplustask/imagesoption combination, startup now follows theTask.runselection semantics instead of the raw options. No code in this repository uses that combination.Test Procedure
pnpm --dir src run check-types— passed.pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 core/task/Task.ts— passed. The suppression count forTask.tsdid not change.pnpm --dir src exec vitest run core/task/__tests__— 600 tests in 37 files passed. All 195Task.spec.tstests passed.pnpm testfrom the repository root — passed. 543 test files ran. 11151 tests passed, 39 skipped.Reviewers can repeat these commands after checkout.
Pre-Submission Checklist
*.visual.tsxsnapshot inwebview-ui/. Seewebview-ui/AGENTS.md→ "When a UI change needs a snapshot".Visual Snapshots
Not applicable. This PR changes no user interface.
Videos (interaction / animation only)
Not applicable. This PR changes no interaction or animation.
Documentation Updates
Additional Notes
This is a pure refactor with no intended functional difference. No paired Zoo-Code-Docs PR is needed.
Get in Touch
0x7777777_