Skip to content

feat(staged): adopt and resume interrupted autoreviews - #632

Merged
matt2e merged 2 commits into
mainfrom
interrupted-autoreview
Apr 15, 2026
Merged

feat(staged): adopt and resume interrupted autoreviews#632
matt2e merged 2 commits into
mainfrom
interrupted-autoreview

Conversation

@matt2e

@matt2e matt2e commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When an autoreview is interrupted (e.g. app crash/restart), the cancelled session and review records are now preserved instead of deleted
  • On branch card mount, if a review exists without a completedAt timestamp and has no running session, it is automatically resumed
  • Adds completedAt field to the Review type to distinguish completed vs interrupted reviews

Test plan

  • Verify that interrupting an autoreview (e.g. by restarting the app) preserves the review and session records
  • Verify that reopening a branch with an interrupted autoreview automatically resumes the review session
  • Verify that normally completed autoreviews are not re-triggered on branch card mount
  • Verify existing tests pass (crates-test, staged-ci, differ-ci)

🤖 Generated with Claude Code

matt2e and others added 2 commits April 15, 2026 15:43
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>
@matt2e
matt2e requested review from baxen and wesbillman as code owners April 15, 2026 06:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +197 to +200
const needsResume = !review.completedAt && review.sessionId && !this.autoReviewSessionId;
if (needsResume) {
await commands.resumeSession(
review.sessionId!,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@matt2e
matt2e merged commit cf05e53 into main Apr 15, 2026
6 checks passed
@matt2e
matt2e deleted the interrupted-autoreview branch April 15, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant