From 3bbe2650a45e5d75a9f3260ed846009becb731b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:35:45 +0000 Subject: [PATCH 1/2] Initial plan From 46fb74c3104b66c657a451b4be0ccacf0a3add7f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:49:27 +0000 Subject: [PATCH 2/2] Extract generateSessionIdentifier function to avoid duplication Co-authored-by: rebornix <876920+rebornix@users.noreply.github.com> --- src/github/copilotRemoteAgent.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/github/copilotRemoteAgent.ts b/src/github/copilotRemoteAgent.ts index 17968c9191..bb67a4c3ee 100644 --- a/src/github/copilotRemoteAgent.ts +++ b/src/github/copilotRemoteAgent.ts @@ -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 }; @@ -903,7 +903,7 @@ export class CopilotRemoteAgentManager extends Disposable { timelineEvents: readonly TimelineEvent[], capi: CopilotApi ): Promise { - 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); @@ -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,