Skip to content

Commit eba2917

Browse files
authored
Fix folder name in agent session window (#3244)
* Fix folder name in agent session window * Fixes
1 parent 479da3f commit eba2917

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,6 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
726726
}
727727

728728
this.copilotCLIAgents.trackSessionAgent(session.object.sessionId, agent?.name);
729-
if (session.object.options.workingDirectory && !session.object.options.isolationEnabled) {
730-
const workspaceFolder = this.workspaceService.getWorkspaceFolder(session.object.options.workingDirectory);
731-
if (workspaceFolder) {
732-
void this.workspaceFolderService.trackSessionWorkspaceFolder(session.object.sessionId, workspaceFolder.fsPath);
733-
}
734-
}
735729
if (isUntitled) {
736730
_untitledSessionIdMap.set(session.object.sessionId, id);
737731
disposables.add(toDisposable(() => _untitledSessionIdMap.delete(session.object.sessionId)));
@@ -901,9 +895,17 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
901895
this.logService.info(`Using Copilot CLI session: ${session.object.sessionId} (isNewSession: ${isNewSession}, isolationEnabled: ${isolationEnabled}, workingDirectory: ${workingDirectory}, worktreePath: ${worktreeProperties?.worktreePath}, changesAction: ${uncommitedChangesAction})`);
902896
if (isNewSession) {
903897
this.untitledSessionIdMapping.set(id, session.object.sessionId);
904-
}
905-
if (isNewSession && worktreeProperties) {
906-
void this.copilotCLIWorktreeManagerService.setWorktreeProperties(session.object.sessionId, worktreeProperties);
898+
if (worktreeProperties) {
899+
void this.copilotCLIWorktreeManagerService.setWorktreeProperties(session.object.sessionId, worktreeProperties);
900+
}
901+
if (session.object.options.workingDirectory && !session.object.options.isolationEnabled) {
902+
const workspaceFolder = this.workspaceService.getWorkspaceFolder(session.object.options.workingDirectory);
903+
if (workspaceFolder) {
904+
void this.workspaceFolderService.trackSessionWorkspaceFolder(session.object.sessionId, workspaceFolder.fsPath);
905+
} else {
906+
void this.workspaceFolderService.trackSessionWorkspaceFolder(session.object.sessionId, session.object.options.workingDirectory.fsPath);
907+
}
908+
}
907909
}
908910
disposables.add(session.object.attachStream(stream));
909911
disposables.add(session.object.attachPermissionHandler(async (permissionRequest: PermissionRequest, toolCall: ToolCall | undefined, token: vscode.CancellationToken) => requestPermission(this.instantiationService, permissionRequest, toolCall, this.toolsService, request.toolInvocationToken, token)));

0 commit comments

Comments
 (0)