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); } diff --git a/src/view/pullRequestCommentController.ts b/src/view/pullRequestCommentController.ts index 3823de2c6d..e60677266d 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'; @@ -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 = 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); } } diff --git a/src/view/reviewCommentController.ts b/src/view/reviewCommentController.ts index 51fe26df56..4c4c7fe090 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); } }