@@ -15,8 +15,8 @@ import { IFileSystemService } from '../../../platform/filesystem/common/fileSyst
1515import { IGitExtensionService } from '../../../platform/git/common/gitExtensionService' ;
1616import { getGitHubRepoInfoFromContext , IGitService , RepoContext } from '../../../platform/git/common/gitService' ;
1717import { toGitUri } from '../../../platform/git/common/utils' ;
18- import { IOctoKitService } from '../../../platform/github/common/githubService' ;
1918import { derivePullRequestState } from '../../../platform/github/common/githubAPI' ;
19+ import { IOctoKitService } from '../../../platform/github/common/githubService' ;
2020import { ILogService } from '../../../platform/log/common/logService' ;
2121import { IPromptsService , ParsedPromptFile } from '../../../platform/promptFiles/common/promptsService' ;
2222import { ITelemetryService } from '../../../platform/telemetry/common/telemetry' ;
@@ -1660,10 +1660,9 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
16601660
16611661 /**
16621662 * Gets the agent to be used.
1663- * If creating a new session, then uses the agent configured in settings.
1664- * If opening an existing session, then uses the agent associated with that session.
1665- * If creating a new session with a prompt file that specifies an agent, then uses that agent.
1663+ * If the request has a prompt file (modeInstructions2) that specifies an agent, uses that agent.
16661664 * If the prompt file specifies tools, those tools override the agent's default tools.
1665+ * Otherwise returns undefined (no agent).
16671666 */
16681667 private async getAgent ( sessionId : string | undefined , request : vscode . ChatRequest | undefined , token : vscode . CancellationToken ) : Promise < SweCustomAgent | undefined > {
16691668 // If we have a prompt file that specifies an agent or tools, use that.
@@ -1677,8 +1676,8 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
16771676 return customAgent ;
16781677 }
16791678 }
1680- const sessionAgent = sessionId ? await this . chatSessionMetadataStore . getSessionAgent ( sessionId ) : undefined ;
1681- return sessionAgent ? await this . copilotCLIAgents . resolveAgent ( sessionAgent ) : undefined ;
1679+ // If not found, don't use any agent, default to empty agent.
1680+ return undefined ;
16821681 }
16831682
16841683 private async getPromptInfoFromRequest ( request : vscode . ChatRequest , token : vscode . CancellationToken ) : Promise < ParsedPromptFile | undefined > {
0 commit comments