Serialize resolveCommentThread to fix race condition with rapid resolves#8651
Merged
Serialize resolveCommentThread to fix race condition with rapid resolves#8651
Conversation
When resolving multiple PR comments quickly in the webview, concurrent resolveCommentThread handlers would race: each fetches the full timeline after its mutation, and a stale response from an earlier call can overwrite a newer one. Serialize these operations using a promise queue so each mutation + timeline fetch completes before the next starts. Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/cbcba014-095c-41d9-a8bd-d041f599c908 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix state not updating for resolved comments in PR
Serialize resolveCommentThread to fix race condition with rapid resolves
Apr 8, 2026
alexr00
approved these changes
Apr 8, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a race condition in the Pull Request webview where rapidly resolving/unresolving multiple review threads could cause older timeline refreshes to overwrite newer resolved state.
Changes:
- Introduces a
_resolveCommentThreadQueuepromise chain to serialize resolve/unresolve operations. - Updates
resolveCommentThreadto enqueue mutation +_getTimeline()refresh sequentially per request.
Show a summary per file
| File | Description |
|---|---|
src/github/pullRequestOverview.ts |
Serializes review-thread resolve/unresolve operations to prevent stale timeline refreshes from overwriting newer state. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
alexr00
approved these changes
Apr 8, 2026
aeschli
approved these changes
Apr 8, 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.
Resolving multiple comment threads quickly in the PR webview causes resolved state to not persist. Each
resolveCommentThreadcall runs a mutation then fetches the full timeline via_getTimeline(). When concurrent, the timeline re-fetch from an earlier call can return stale data (before a later mutation has propagated) and overwrite the webview state viaupdatePR({ events })._resolveCommentThreadQueuepromise chain toPullRequestOverviewPanelthat serializes resolve/unresolve operations, ensuring each mutation + timeline fetch completes before the next begins