Skip to content

Commit 0933829

Browse files
authored
Speed up opening session log tab (#7165)
1 parent 2e0ccce commit 0933829

File tree

8 files changed

+213
-110
lines changed

8 files changed

+213
-110
lines changed

src/common/timelineEvent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ export interface ReopenedEvent {
154154
}
155155

156156
export interface SessionPullInfo {
157+
id: number;
157158
host: string;
158159
owner: string;
159160
repo: string;
160-
pullId: number;
161+
pullNumber: number;
161162
}
162163

163164
export interface SessionLinkInfo extends SessionPullInfo {

src/github/copilotRemoteAgent.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { GitHubRemote } from '../common/remote';
1414
import { CODING_AGENT, CODING_AGENT_AUTO_COMMIT_AND_PUSH, CODING_AGENT_ENABLED } from '../common/settingKeys';
1515
import { toOpenPullRequestWebviewUri } from '../common/uri';
1616
import { OctokitCommon } from './common';
17-
import { CopilotApi, RemoteAgentJobPayload } from './copilotApi';
17+
import { CopilotApi, RemoteAgentJobPayload, SessionInfo } from './copilotApi';
1818
import { CopilotPRWatcher, CopilotStateModel } from './copilotPrWatcher';
1919
import { CredentialStore } from './credentials';
2020
import { FolderRepositoryManager } from './folderRepositoryManager';
@@ -27,8 +27,8 @@ type RemoteAgentErrorResult = { error: string; state: 'error' };
2727
type RemoteAgentResult = RemoteAgentSuccessResult | RemoteAgentErrorResult;
2828

2929
export interface IAPISessionLogs {
30-
sessionId: string;
31-
logs: string;
30+
readonly info: SessionInfo;
31+
readonly logs: string;
3232
}
3333

3434
export interface ICopilotRemoteAgentCommandArgs {
@@ -443,7 +443,7 @@ export class CopilotRemoteAgentManager extends Disposable {
443443
}
444444

445445
const logs = await capi.getLogsFromSession(session.id);
446-
return { sessionId: session.id, logs };
446+
return { info: session, logs };
447447
}
448448

449449
async getSessionUrlFromPullRequest(pullRequest: PullRequestModel): Promise<string | undefined> {
@@ -459,16 +459,6 @@ export class CopilotRemoteAgentManager extends Disposable {
459459
return sessions.html_url;
460460
}
461461

462-
async getSessionLogsFromSessionId(sessionId: string): Promise<IAPISessionLogs> {
463-
const capi = await this.copilotApi;
464-
if (!capi) {
465-
return { sessionId: '', logs: '' };
466-
}
467-
468-
const logs = await capi.getLogsFromSession(sessionId);
469-
return { sessionId, logs };
470-
}
471-
472462
private getLatestRun<T extends { last_updated_at?: string; updated_at?: string }>(runs: T[]): T {
473463
return runs
474464
.slice()

src/github/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*--------------------------------------------------------------------------------------------*/
55
'use strict';
66

7-
import * as crypto from 'crypto';
87
import * as OctokitTypes from '@octokit/types';
8+
import * as crypto from 'crypto';
99
import * as vscode from 'vscode';
1010
import { Repository } from '../api/api';
1111
import { GitApiImpl } from '../api/api1';
@@ -1003,11 +1003,12 @@ export function parseSelectRestTimelineEvents(
10031003
): Common.TimelineEvent[] {
10041004
const parsedEvents: Common.TimelineEvent[] = [];
10051005

1006-
const prSessionLink = {
1006+
const prSessionLink: Common.SessionPullInfo = {
1007+
id: issueModel.id,
10071008
host: issueModel.githubRepository.remote.gitProtocol.host,
10081009
owner: issueModel.githubRepository.remote.owner,
10091010
repo: issueModel.githubRepository.remote.repositoryName,
1010-
pullId: issueModel.number,
1011+
pullNumber: issueModel.number,
10111012
};
10121013

10131014
let sessionIndex = 0;

0 commit comments

Comments
 (0)