diff --git a/src/vs/platform/agentHost/node/agentHostSessionTitleController.ts b/src/vs/platform/agentHost/node/agentHostSessionTitleController.ts index 20a4f585b44..98fd7924099 100644 --- a/src/vs/platform/agentHost/node/agentHostSessionTitleController.ts +++ b/src/vs/platform/agentHost/node/agentHostSessionTitleController.ts @@ -11,6 +11,7 @@ import { ILogService } from '../../log/common/log.js'; import { ISessionDataService } from '../common/sessionDataService.js'; import { SessionServerToolName } from '../common/serverToolNames.js'; import { ActionType } from '../common/state/sessionActions.js'; +import { ChatOriginKind } from '../common/state/protocol/state.js'; import { buildDefaultChatUri, isAhpChatChannel, isDefaultChatUri, type Turn, type URI as ProtocolURI } from '../common/state/sessionState.js'; import { buildConversationContext, renderResponseMarkdown, truncateMiddle } from '../common/agentHostConversationContext.js'; import { AgentHostStateManager } from './agentHostStateManager.js'; @@ -448,6 +449,9 @@ export class AgentHostSessionTitleController extends Disposable { return undefined; } const independentChat = this._independentChatChannel(channel, chatChannel); + if (independentChat && this._stateManager.getChatOrigin(independentChat)?.kind === ChatOriginKind.SideChat) { + return undefined; + } const key = independentChat ?? channel; if (this._renamedTitles.has(key)) { return undefined; diff --git a/src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts b/src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts index 2cf7198df52..b2972c61f09 100644 --- a/src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts +++ b/src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts @@ -13,6 +13,7 @@ import { NullLogService } from '../../../log/common/log.js'; import { AgentHostStateManager } from '../../node/agentHostStateManager.js'; import { AgentHostSessionTitleController } from '../../node/agentHostSessionTitleController.js'; import { ActionType } from '../../common/state/sessionActions.js'; +import { ChatOriginKind } from '../../common/state/protocol/state.js'; import { buildChatUri, buildDefaultChatUri, MessageKind, ResponsePartKind, SessionStatus, ToolCallConfirmationReason, ToolCallStatus, TurnState, type ResponsePart, type SessionSummary, type ToolCallCompletedState, type Turn } from '../../common/state/sessionState.js'; import { type AutoMergeMethod, type CreatedPullRequest, type GitHubIssueOrPullRequest, type IAgentHostOctoKitService } from '../../node/shared/agentHostOctoKitService.js'; import { type ICopilotApiService, type ICopilotApiServiceRequestOptions, type ICopilotUtilityChatCompletionRequest } from '../../node/shared/copilotApiService.js'; @@ -269,6 +270,27 @@ suite('AgentHostSessionTitleController', () => { }); }); + test('active-agent mode keeps the fallback title without a rename reminder for side chats', async () => { + const { controller, stateManager, session } = setup(undefined, 'Session title', undefined, undefined, undefined, undefined, undefined, true); + const chat = buildChatUri(session.toString(), 'side-chat'); + stateManager.addChat(session.toString(), chat, { + origin: { + kind: ChatOriginKind.SideChat, + chat: buildDefaultChatUri(session), + turnId: 'turn-1', + }, + }); + controller.seedTitleFromFirstMessage(session.toString(), 'salut', chat); + + assert.deepStrictEqual({ + title: stateManager.getChatState(chat)?.title, + instruction: await controller.prepareInstructionForAgent(session.toString(), chat), + }, { + title: 'salut', + instruction: undefined, + }); + }); + test('clearSession releases session and peer-chat rename state', async () => { const { controller, stateManager, session, db } = setup(undefined, '', undefined, undefined, undefined, undefined, undefined, true); const defaultChat = buildDefaultChatUri(session);