feat(staged): adopt and resume interrupted autoreviews - #632
Conversation
Interrupted autoreviews (cancelled for new commits, app quit, or crashed) were either deleted or adopted incomplete with no way to resume them. - Stop deleting review records when cancelling in-flight autoreviews so they survive for potential adoption - Remove frontend deleteReview call from cancelAutoReview() - Resume incomplete autoreviews (completedAt is null) during adoption by calling resumeSession with the existing session - Add completedAt field to the shared Review TypeScript interface Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Only orphaned reviews (from crashes/app quit) should survive for resume. When explicitly cancelling an autoreview to start a new session, delete the review record as before to avoid accumulating cancelled reviews. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b99b488c39
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const needsResume = !review.completedAt && review.sessionId && !this.autoReviewSessionId; | ||
| if (needsResume) { | ||
| await commands.resumeSession( | ||
| review.sessionId!, |
There was a problem hiding this comment.
Guard autoreview resume against already-running sessions
This resume check relies on !this.autoReviewSessionId instead of the persisted session status, so after a branch card remount/reload (where autoReviewSessionId is empty until a new event arrives) an already-running auto review is treated as needing resume. The new block then calls resumeSession for that running session, but backend resume_session rejects it when transition_to_running returns false for running sessions; tryAdoptAutoReview falls into catch and returns false, so callers proceed to start a new review session and you can end up with duplicate concurrent reviews on the same branch.
Useful? React with 👍 / 👎.
Summary
completedAttimestamp and has no running session, it is automatically resumedcompletedAtfield to theReviewtype to distinguish completed vs interrupted reviewsTest plan
crates-test,staged-ci,differ-ci)🤖 Generated with Claude Code