Skip to content

Commit 8dc2a83

Browse files
committed
move waitForQueuedToInProgress to inside invoke
1 parent c52cad0 commit 8dc2a83

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/github/copilotRemoteAgent.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as pathLib from 'path';
77
import * as marked from 'marked';
8-
import vscode, { ChatPromptReference } from 'vscode';
8+
import vscode, { CancellationTokenSource, ChatPromptReference } from 'vscode';
99
import { parseSessionLogs, parseToolCallDetails, StrReplaceEditorToolData } from '../../common/sessionParsing';
1010
import { COPILOT_ACCOUNTS } from '../common/comment';
1111
import { CopilotRemoteAgentConfig } from '../common/config';
@@ -610,6 +610,8 @@ export class CopilotRemoteAgentManager extends Disposable {
610610
this._onDidCreatePullRequest.fire(pull_request.number);
611611
const webviewUri = await toOpenPullRequestWebviewUri({ owner, repo, pullRequestNumber: pull_request.number });
612612
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);
613615
return {
614616
state: 'success',
615617
number: pull_request.number,
@@ -796,7 +798,7 @@ export class CopilotRemoteAgentManager extends Disposable {
796798

797799

798800

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> {
800802
const { request, history } = options;
801803
if (!options.prompt) {
802804
throw new Error(`Prompt is expected to provide a new chat session item`);
@@ -837,15 +839,13 @@ export class CopilotRemoteAgentManager extends Disposable {
837839
throw new Error(`Failed to provide new chat session item: ${result.error}`);
838840
}
839841

840-
const { number, sessionId } = result;
842+
const { number } = result;
841843

842844
const pullRequest = await this.findPullRequestById(number, true);
843845
if (!pullRequest) {
844846
throw new Error(`Failed to find session for pull request: ${number}`);
845847
}
846848

847-
await this.waitForQueuedToInProgress(sessionId, token);
848-
849849
const timeline = await pullRequest.getCopilotTimelineEvents(pullRequest);
850850
const status = copilotEventToSessionStatus(mostRecentCopilotEvent(timeline));
851851
const tooltip = await issueMarkdown(pullRequest, this.context, this.repositoriesManager);

0 commit comments

Comments
 (0)