From ec6ada084bbbe49a192a11e1739cdd7adc1e43c9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:16:56 +0000 Subject: [PATCH 1/5] Initial plan From 03e39a2b658299c3dcc7bee00a678152f9c7831f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:23:37 +0000 Subject: [PATCH 2/5] Initial plan for handling reaction permission errors Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --- src/@types/vscode.proposed.chatParticipantAdditions.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts index 71520fa1ec..aa7001a3d2 100644 --- a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts @@ -105,6 +105,7 @@ declare module 'vscode' { isComplete?: boolean; toolSpecificData?: ChatTerminalToolInvocationData; fromSubAgent?: boolean; + presentation?: 'hidden' | 'hiddenAfterComplete' | undefined; constructor(toolName: string, toolCallId: string, isError?: boolean); } From d2b35effa8d170d3d3bafecc8eee9ba32fb4561b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:26:53 +0000 Subject: [PATCH 3/5] Fix: Ignore GraphQL permission error when quickly toggling reactions When users quickly click on a reaction to add/remove it, a race condition can occur where the client tries to remove a reaction that the user doesn't have permission to remove. This results in a GraphQL error: "does not have the correct permissions to execute 'RemoveReaction'" This change silently ignores this specific error as it's expected behavior during rapid toggling of reactions. Fixes microsoft/vscode#69321 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --- src/view/pullRequestCommentController.ts | 27 +++++++++++++++++------- src/view/reviewCommentController.ts | 9 +++++++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/view/pullRequestCommentController.ts b/src/view/pullRequestCommentController.ts index 3823de2c6d..a84d7c5c99 100644 --- a/src/view/pullRequestCommentController.ts +++ b/src/view/pullRequestCommentController.ts @@ -546,14 +546,25 @@ export class PullRequestCommentController extends CommentControllerBase implemen return; } - if ( - comment.reactions && - !comment.reactions.find(ret => ret.label === reaction.label && !!ret.authorHasReacted) - ) { - // add reaction - await this.pullRequestModel.addCommentReaction(comment.rawComment.graphNodeId, reaction); - } else { - await this.pullRequestModel.deleteCommentReaction(comment.rawComment.graphNodeId, reaction); + try { + if ( + comment.reactions && + !comment.reactions.find(ret => ret.label === reaction.label && !!ret.authorHasReacted) + ) { + // add reaction + await this.pullRequestModel.addCommentReaction(comment.rawComment.graphNodeId, reaction); + } else { + await this.pullRequestModel.deleteCommentReaction(comment.rawComment.graphNodeId, reaction); + } + } catch (e) { + // Ignore permission errors when removing reactions due to race conditions + // See: https://github.com/microsoft/vscode/issues/69321 + const errorMessage = (e as Error).message || String(e); + if (errorMessage.includes('does not have the correct permissions to execute \'RemoveReaction\'')) { + // Silently ignore this error - it occurs when quickly toggling reactions + return; + } + throw e; } } diff --git a/src/view/reviewCommentController.ts b/src/view/reviewCommentController.ts index 51fe26df56..28442833a2 100644 --- a/src/view/reviewCommentController.ts +++ b/src/view/reviewCommentController.ts @@ -985,7 +985,14 @@ ${suggestionInformation.suggestionContent} ); } } catch (e) { - throw new Error(formatError(e)); + // Ignore permission errors when removing reactions due to race conditions + // See: https://github.com/microsoft/vscode/issues/69321 + const errorMessage = formatError(e); + if (errorMessage.includes('does not have the correct permissions to execute \'RemoveReaction\'')) { + // Silently ignore this error - it occurs when quickly toggling reactions + return; + } + throw new Error(errorMessage); } } From a9c521ac015cdced59f33c844c1bb5608c3fd565 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:29:42 +0000 Subject: [PATCH 4/5] Refactor: Use consistent error handling in both toggleReaction implementations - Import formatError in pullRequestCommentController.ts - Use formatError(e) consistently in both implementations - Throw new Error(errorMessage) consistently instead of rethrowing original error Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --- src/view/pullRequestCommentController.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/view/pullRequestCommentController.ts b/src/view/pullRequestCommentController.ts index a84d7c5c99..7da244e530 100644 --- a/src/view/pullRequestCommentController.ts +++ b/src/view/pullRequestCommentController.ts @@ -12,7 +12,7 @@ import { disposeAll } from '../common/lifecycle'; import Logger from '../common/logger'; import { ITelemetry } from '../common/telemetry'; import { fromPRUri, Schemes } from '../common/uri'; -import { groupBy } from '../common/utils'; +import { formatError, groupBy } from '../common/utils'; import { PULL_REQUEST_OVERVIEW_VIEW_TYPE } from '../common/webview'; import { FolderRepositoryManager } from '../github/folderRepositoryManager'; import { GitHubRepository } from '../github/githubRepository'; @@ -559,12 +559,12 @@ export class PullRequestCommentController extends CommentControllerBase implemen } catch (e) { // Ignore permission errors when removing reactions due to race conditions // See: https://github.com/microsoft/vscode/issues/69321 - const errorMessage = (e as Error).message || String(e); + const errorMessage = formatError(e); if (errorMessage.includes('does not have the correct permissions to execute \'RemoveReaction\'')) { // Silently ignore this error - it occurs when quickly toggling reactions return; } - throw e; + throw new Error(errorMessage); } } From ced6df6762dccf682fb8de29de0900e4bfc63c6e Mon Sep 17 00:00:00 2001 From: Alex Ross <38270282+alexr00@users.noreply.github.com> Date: Thu, 11 Dec 2025 15:23:29 +0100 Subject: [PATCH 5/5] Fix message --- src/view/pullRequestCommentController.ts | 2 +- src/view/reviewCommentController.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/pullRequestCommentController.ts b/src/view/pullRequestCommentController.ts index 7da244e530..e60677266d 100644 --- a/src/view/pullRequestCommentController.ts +++ b/src/view/pullRequestCommentController.ts @@ -560,7 +560,7 @@ export class PullRequestCommentController extends CommentControllerBase implemen // Ignore permission errors when removing reactions due to race conditions // See: https://github.com/microsoft/vscode/issues/69321 const errorMessage = formatError(e); - if (errorMessage.includes('does not have the correct permissions to execute \'RemoveReaction\'')) { + if (errorMessage.includes('does not have the correct permissions to execute `RemoveReaction`')) { // Silently ignore this error - it occurs when quickly toggling reactions return; } diff --git a/src/view/reviewCommentController.ts b/src/view/reviewCommentController.ts index 28442833a2..4c4c7fe090 100644 --- a/src/view/reviewCommentController.ts +++ b/src/view/reviewCommentController.ts @@ -988,7 +988,7 @@ ${suggestionInformation.suggestionContent} // Ignore permission errors when removing reactions due to race conditions // See: https://github.com/microsoft/vscode/issues/69321 const errorMessage = formatError(e); - if (errorMessage.includes('does not have the correct permissions to execute \'RemoveReaction\'')) { + if (errorMessage.includes('does not have the correct permissions to execute `RemoveReaction`')) { // Silently ignore this error - it occurs when quickly toggling reactions return; }