|
5 | 5 |
|
6 | 6 | import * as pathLib from 'path'; |
7 | 7 | import * as marked from 'marked'; |
8 | | -import vscode, { ChatPromptReference } from 'vscode'; |
| 8 | +import vscode, { CancellationTokenSource, ChatPromptReference } from 'vscode'; |
9 | 9 | import { parseSessionLogs, parseToolCallDetails, StrReplaceEditorToolData } from '../../common/sessionParsing'; |
10 | 10 | import { COPILOT_ACCOUNTS } from '../common/comment'; |
11 | 11 | import { CopilotRemoteAgentConfig } from '../common/config'; |
@@ -610,6 +610,8 @@ export class CopilotRemoteAgentManager extends Disposable { |
610 | 610 | this._onDidCreatePullRequest.fire(pull_request.number); |
611 | 611 | const webviewUri = await toOpenPullRequestWebviewUri({ owner, repo, pullRequestNumber: pull_request.number }); |
612 | 612 | const prLlmString = `The remote agent has begun work and has created a pull request. Details about the pull request are being shown to the user. If the user wants to track progress or iterate on the agent's work, they should use the pull request.`; |
| 613 | + |
| 614 | + await this.waitForQueuedToInProgress(session_id, new CancellationTokenSource().token); |
613 | 615 | return { |
614 | 616 | state: 'success', |
615 | 617 | number: pull_request.number, |
@@ -796,7 +798,7 @@ export class CopilotRemoteAgentManager extends Disposable { |
796 | 798 |
|
797 | 799 |
|
798 | 800 |
|
799 | | - public async provideNewChatSessionItem(options: { request: vscode.ChatRequest; prompt?: string; history: ReadonlyArray<vscode.ChatRequestTurn | vscode.ChatResponseTurn>; metadata?: any; }, token: vscode.CancellationToken): Promise<ChatSessionWithPR | ChatSessionFromSummarizedChat> { |
| 801 | + public async provideNewChatSessionItem(options: { request: vscode.ChatRequest; prompt?: string; history: ReadonlyArray<vscode.ChatRequestTurn | vscode.ChatResponseTurn>; metadata?: any; }, _token: vscode.CancellationToken): Promise<ChatSessionWithPR | ChatSessionFromSummarizedChat> { |
800 | 802 | const { request, history } = options; |
801 | 803 | if (!options.prompt) { |
802 | 804 | throw new Error(`Prompt is expected to provide a new chat session item`); |
@@ -837,15 +839,13 @@ export class CopilotRemoteAgentManager extends Disposable { |
837 | 839 | throw new Error(`Failed to provide new chat session item: ${result.error}`); |
838 | 840 | } |
839 | 841 |
|
840 | | - const { number, sessionId } = result; |
| 842 | + const { number } = result; |
841 | 843 |
|
842 | 844 | const pullRequest = await this.findPullRequestById(number, true); |
843 | 845 | if (!pullRequest) { |
844 | 846 | throw new Error(`Failed to find session for pull request: ${number}`); |
845 | 847 | } |
846 | 848 |
|
847 | | - await this.waitForQueuedToInProgress(sessionId, token); |
848 | | - |
849 | 849 | const timeline = await pullRequest.getCopilotTimelineEvents(pullRequest); |
850 | 850 | const status = copilotEventToSessionStatus(mostRecentCopilotEvent(timeline)); |
851 | 851 | const tooltip = await issueMarkdown(pullRequest, this.context, this.repositoriesManager); |
|
0 commit comments