Implement approved plans in new worktrees#819
Implement approved plans in new worktrees#819Mitch515 wants to merge 5 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
|
Assets for review: Implementation actions screenshot: Muted video: |
f0f98a1 to
b5bbb6d
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
| if (!api || !targetThreadId || !targetProject) return; | ||
| if (targetThreadId !== activeThreadId && !isServerThread && !options?.allowLocalDraftThread) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Silent early returns bypass throwOnError contract
Medium Severity
runProjectScript has multiple early return paths (guard conditions at lines 1410 and 1411–1413) that silently resolve even when throwOnError is true. In startImplementationThread, runWorktreeSetupScript is called with throwOnError: true, expecting an error to propagate if the script fails to execute. If any guard condition triggers (e.g., a timing issue with isServerThread or missing api), runProjectScript returns undefined instead of throwing, so startImplementationThread proceeds to dispatch thread.turn.start as if the setup succeeded — creating a thread without its setup script and without any error feedback.
Additional Locations (1)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| }; | ||
| }, | ||
| [createWorktreeMutation], | ||
| ); |
There was a problem hiding this comment.
Unstable useMutation return defeats useCallback memoization
Low Severity
createWorktreeFromBaseBranch wraps createWorktreeMutation.mutateAsync in a useCallback with [createWorktreeMutation] as a dependency. Since useMutation returns a new object reference on each render, this useCallback recreates every render, providing no memoization benefit. This cascades to onImplementPlanInNewWorktree, which lists createWorktreeFromBaseBranch in its own dependency array, causing it to also recreate every render.



What Changed
Why
UI Changes
Checklist
Note
Implement approved plans in new git worktrees from ChatView
startImplementationThreadto centralize thread creation, optional setup-script execution, first-turn dispatch, snapshot sync, and navigation for both new-thread and new-worktree flows.AlertDialogsurfaces rollback options: keep or delete the newly created worktree.runProjectScriptto accept a target thread/project/worktree context, enabling setup scripts to run in the correct terminal group for non-active threads.Macroscope summarized b74be50.
Note
Medium Risk
Adds a new plan-to-implementation path that creates/deletes git worktrees and starts new threads, plus refactors terminal/script execution targeting; failures could leave inconsistent thread/worktree state if edge cases are missed.
Overview
Enables implementing an approved plan directly into a new git worktree, adding an
Implement in new worktreeaction alongside the existing new-thread action and wiring it togitCreateWorktree+ new implementation thread creation.Refactors implementation thread startup into a shared
startImplementationThreadhelper and expandsrunProjectScriptto support targeting a specific thread/project/worktree (used to run optional setup scripts in the correct terminal group).Adds failure handling when worktree creation succeeds but thread startup/setup fails: an
AlertDialogoffers keep vs delete the created worktree (with git query invalidation on delete), and browser tests cover menu visibility, successful worktree start, and rollback UI; MSW websocket replies now surface mock RPC errors instead of crashing.Written by Cursor Bugbot for commit b74be50. This will update automatically on new commits. Configure here.