Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/github/copilotRemoteAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ export class CopilotRemoteAgentManager extends Disposable {
}
return {
id: `${session.number}`,
label: session.title || `Session ${session.number}`,
label: session.title || this.generateSessionIdentifier(session.number),
iconPath: this.getIconForSession(status),
pullRequest: session
};
Expand Down Expand Up @@ -903,7 +903,7 @@ export class CopilotRemoteAgentManager extends Disposable {
timelineEvents: readonly TimelineEvent[],
capi: CopilotApi
): Promise<string> {
let sessionPrompt = session.name || `Session ${sessionIndex + 1} (ID: ${session.id})`;
let sessionPrompt = session.name || this.generateSessionIdentifier(sessionIndex + 1, session.id);

if (sessionIndex === 0) {
sessionPrompt = await this.getInitialSessionPrompt(session, pullRequest, capi, sessionPrompt);
Expand Down Expand Up @@ -988,6 +988,19 @@ export class CopilotRemoteAgentManager extends Disposable {
return 0;
}

/**
* Generates a session identifier string in various formats
* @param sessionNumber The session number (1-based)
* @param sessionId Optional session ID to include in the identifier
* @returns Formatted session identifier string
*/
private generateSessionIdentifier(sessionNumber: number, sessionId?: string): string {
if (sessionId) {
return `Session ${sessionNumber} (ID: ${sessionId})`;
}
return `Session ${sessionNumber}`;
}

private findRelevantTimelineEvents(
timelineEvents: readonly TimelineEvent[],
previousSessionEndTime: number,
Expand Down