Skip to content

[Refactor] Make Task.create share its startup path with Task.run - #2146

Merged
edelauna merged 2 commits into
mainfrom
refactor/task-create-shared-startup-2145
Oct 23, 2026
Merged

edelauna merged 2 commits into
mainfrom
refactor/task-create-shared-startup-2145

Conversation

@ghost

@ghost ghost commented Oct 22, 2026

Copy link
Copy Markdown

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

Closes: #2145

Description

Task.create repeated the startup logic of Task.run. It called startIdleTelemetryCheck itself. It also chose between startTask and resumeTaskFromHistory. The two startup paths could drift apart.

This PR makes Task.create validate its options first. It then returns instance.run() as the startup promise. Task.create and Task.run now share one startup path. The returned promise is the cached run promise. A later run() 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.create now throws before it constructs the instance when the options contain no task, images, or historyItem. Previously the throw happened after construction.
  • For the historyItem plus task/images option combination, startup now follows the Task.run selection 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 for Task.ts did not change.
  • pnpm --dir src exec vitest run core/task/__tests__ — 600 tests in 37 files passed. All 195 Task.spec.ts tests passed.
  • pnpm test from the repository root — passed. 543 test files ran. 11151 tests passed, 39 skipped.

Reviewers can repeat these commands after checkout.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): If a user would notice this change at a glance (layout, theme tokens, brand elements, empty/error states), I added or updated a *.visual.tsx snapshot in webview-ui/. See webview-ui/AGENTS.md → "When a UI change needs a snapshot".
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

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

  • No documentation updates are required.
  • Yes, documentation updates are required. (Describe what to update, or link to a PR in the docs repository).

Additional Notes

This is a pure refactor with no intended functional difference. No paired Zoo-Code-Docs PR is needed.

Get in Touch

0x7777777_

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This 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. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review October 23, 2026 03:18
@edelauna
edelauna enabled auto-merge October 23, 2026 03:18
@edelauna
edelauna added this pull request to the merge queue Oct 23, 2026
@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 23, 2026
Merged via the queue into main with commit 37b66fe Oct 23, 2026
29 of 30 checks passed
@edelauna
edelauna deleted the refactor/task-create-shared-startup-2145 branch October 23, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit coderabbit-review-active Required CI passed; CodeRabbit review is active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Task.create share its startup promise with Task.run

2 participants