Repository navigation
fix(agent-manager): reload the PR diff when a review snapshot expires - #14183
Merged
Merged
Conversation
The Agent Manager diff surfaces cache PR snapshots per target while the host keeps only the eight most recent, so a cached snapshot can be evicted and every comment post then fails with "Review snapshot expired". Drop the cached snapshot and reload it when the host rejects a comment, so the next attempt is bound to a snapshot the host still holds.
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Note: the new Fix these issues in Kilo Cloud Previous Review Summary (commit 3a98691)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 3a98691)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (5 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Content rejections such as an empty body or a bad line range leave the snapshot valid, so gate the reload on the host's reload hints instead of every failed comment. Extend the regression test to cover the non-expiry cases.
marius-kilocode
enabled auto-merge
September 15, 2026 16:54
kirillk
approved these changes
Sep 15, 2026
This was referenced Sep 16, 2026
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.
What Problem This Solves
Posting an inline pull request review comment from an Agent Manager diff could fail with:
and stay broken: retrying reused the same rejected snapshot, so the comment could not be posted until the whole review was reopened.
Why This Change Was Made
The Agent Manager diff surfaces cache a PR snapshot per review target in
createPRDiffCommentState(webview-ui/agent-manager/pr/diff-comment-state.ts) and never refetch a target they already hold. The host keeps at most eight snapshots perPRReviewActionsinstance and clears them on project re-activation (review-actions.ts,PRStatusBridge.reset). Once the host dropped a snapshot, the webview kept sending its id, so every retry failed and the documented recovery ("Reload the review") never happened on its own.The fix subscribes the diff comment state to review results. When a
agentManager.createReviewCommentfails, it drops the cached snapshot for the matching target and reloads it. A failed post is deliberately not auto-retried (it may already have reached GitHub), so the draft is kept and the next send runs against a snapshot the host still holds.The webview
ExtensionMessageunion now also includesPRReviewResult, which the host already sends but the webview types did not declare.User Impact
An inline PR review comment that fails because its snapshot expired now recovers: the diff reloads in the background and the next send succeeds, instead of requiring the user to close and reopen the review.
Evidence
packages/kilo-vscode/tests/unit/pr-diff-comment-state.test.tsdrives the state directly and reproduces the failure. Without the fix, a rejected comment does not trigger a reload and the test fails withExpected length: 2, Received length: 1. With the fix, the stale snapshot is dropped, a newloadPRFilesrequest is posted, and the fresh snapshot replaces it.bun test tests/unit/pr-diff-comment-state.test.ts tests/unit/pr-review-actions.test.ts tests/unit/diff-comment-form.test.ts tests/unit/diff-preview-request.test.ts tests/unit/agent-manager-arch.test.ts(136 pass).eslintandprettier --checkclean on the changed files.