fix(code-reviews): recover stuck reviews#3040
Merged
alex-alecu merged 3 commits intomainfrom May 5, 2026
Merged
Conversation
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by gpt-5.5-20260423 · 391,926 tokens |
RSO
approved these changes
May 5, 2026
# Conflicts: # apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.test.ts # apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some code reviews could stay queued because the worker can miss the first signal that tells it to start work. When that happened, the app had no backup path to wake the review again.
Before this PR, the app did roughly this:
The weak point was step 4.
If the Worker accepted the review but the background start was missed or failed early, the review could stay queued forever.
Now the Worker does this:
The fix adds a backup wake-up path for queued reviews and makes the app check worker state before deciding what to do next. This lets stuck reviews start again without starting the same review twice.
The cancel flow is also safer. If a worker request times out, the app no longer marks active reviews as cancelled unless it knows the review is still queued and has not started a worker session.
Tests cover the stuck queue case, the backup wake-up path, worker state checks, and safer cancel handling.
Verification
Manual test passed.
Tested:
Verified:
Reviewer Notes
The main risk is the boundary between app state and worker state. The change keeps that logic high level: only retry when the worker says no review is active, and only cancel locally when the review has not started yet.