feat(auto-drive): launch commit review after diagnostics#352
feat(auto-drive): launch commit review after diagnostics#352
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub(crate) fn handle_auto_review_commit_ready(&mut self, outcome: AutoReviewOutcome) { | ||
| self.auto_review_pending = false; | ||
| match outcome { | ||
| AutoReviewOutcome::Skip { reason } => { | ||
| self.pending_review_commit = None; | ||
| self.push_background_tail(format!("Auto Drive review skipped: {reason}")); | ||
| self.cleanup_active_review_worktree(); | ||
| } | ||
| AutoReviewOutcome::Error(err) => { | ||
| self.pending_review_commit = None; | ||
| self.push_background_tail(format!("Auto Drive review prep failed: {err}")); | ||
| tracing::warn!("auto_review_prep_failed" = %err); | ||
| self.cleanup_active_review_worktree(); | ||
| } | ||
| AutoReviewOutcome::Commit(prepared) => { | ||
| self.launch_commit_review(prepared); | ||
| } |
There was a problem hiding this comment.
Skip commit review when Auto Drive is no longer active
When the async preparation for a commit review completes, handle_auto_review_commit_ready always calls launch_commit_review for a Commit outcome. If the user has already stopped Auto Drive while the preparation was running, auto_stop clears pending_review_commit and marks the state idle but nothing prevents this handler from firing afterwards. The review UI is then launched unexpectedly and a review worktree is created even though the run was cancelled, which leaves no cleanup path because the stop logic already ran. Guard the launch with a check such as self.auto_state.is_active() (and clean up the worktree otherwise) so that cancelling Auto Drive while a review is being prepared does not reopen the workflow or leak resources.
Useful? React with 👍 / 👎.
804b5ad to
b7927a2
Compare
feat(auto-drive): launch commit review after diagnostics