Skip to content

Commit 239b61a

Browse files
Copilotalexr00
andauthored
Fix file-scoped comments failing with "Error: File has been deleted" (#8664)
* Initial plan * Initial analysis Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/2e5f5355-cccd-4ac6-b866-9d00dcd8b8b4 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Fix file-scoped comment failing with "Error: File has been deleted" When creating a file-scoped comment (range is undefined), the createReviewThread method was passing `line: 0` to the GitHub GraphQL API. The API does not accept line 0 and returns a null thread, which caused the misleading "File has been deleted" error. Fix: pass endLine directly (undefined for file-scoped comments) instead of converting undefined to 0. The line parameter is not required when subjectType is FILE. Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/2e5f5355-cccd-4ac6-b866-9d00dcd8b8b4 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Remove file-scoped comment test that only tests mocks Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/2bb682a1-a239-4791-a328-bfb6a7d341dd Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent eacf539 commit 239b61a

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
lines changed

src/@types/vscode.proposed.chatSessionsProvider.d.ts

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ declare module 'vscode' {
343343
/**
344344
* Statistics about the chat session.
345345
*/
346-
changes?: readonly ChatSessionChangedFile[] | readonly ChatSessionChangedFile2[];
346+
changes?: readonly ChatSessionChangedFile[];
347347

348348
/**
349349
* Arbitrary metadata for the chat session. Can be anything, but must be JSON-stringifyable.
@@ -353,34 +353,7 @@ declare module 'vscode' {
353353
metadata?: { readonly [key: string]: any };
354354
}
355355

356-
/**
357-
* @deprecated Use `ChatSessionChangedFile2` instead
358-
*/
359356
export class ChatSessionChangedFile {
360-
/**
361-
* URI of the file.
362-
*/
363-
modifiedUri: Uri;
364-
365-
/**
366-
* File opened when the user takes the 'compare' action.
367-
*/
368-
originalUri?: Uri;
369-
370-
/**
371-
* Number of insertions made during the session.
372-
*/
373-
insertions: number;
374-
375-
/**
376-
* Number of deletions made during the session.
377-
*/
378-
deletions: number;
379-
380-
constructor(modifiedUri: Uri, insertions: number, deletions: number, originalUri?: Uri);
381-
}
382-
383-
export class ChatSessionChangedFile2 {
384357
/**
385358
* URI of the file.
386359
*/
@@ -728,9 +701,18 @@ declare module 'vscode' {
728701
export interface ChatSessionInputState {
729702
/**
730703
* Fired when the input state is changed by the user.
704+
*
705+
* Move to controller?
731706
*/
732707
readonly onDidChange: Event<void>;
733708

709+
/**
710+
* The resource associated with this chat session.
711+
*
712+
* This is `undefined` for chat sessions that have not yet started.
713+
*/
714+
readonly sessionResource: Uri | undefined;
715+
734716
/**
735717
* The groups of options to show in the UI for user input.
736718
*

src/github/pullRequestModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
751751
pullRequestId: this.graphNodeId,
752752
pullRequestReviewId: pendingReviewId,
753753
startLine: startLine === endLine ? undefined : startLine,
754-
line: (endLine === undefined) ? 0 : endLine,
754+
line: endLine,
755755
side,
756756
subjectType: (startLine === undefined || endLine === undefined) ? SubjectType.FILE : SubjectType.LINE
757757
}

0 commit comments

Comments
 (0)