From ff54e5cbb1e1e34873d2bc423314976a2d8b41b6 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 28 Jan 2026 09:05:11 -0800 Subject: [PATCH] chat: fix handling of old session states (#291185) Guard old sessions from Insiders that may have Pending or NeedsInput states, converting them to Complete state for consistency. This ensures proper handling of sessions migrated from pre-PR #288161 versions. - Added check to convert Pending/NeedsInput states to Complete state - Preserves backward compatibility with old session data - Prevents state display issues in migrated sessions (Commit message generated by Copilot) --- .../contrib/chat/common/chatService/chatServiceImpl.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts b/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts index 17e8088fb7f..d133ab69419 100644 --- a/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts +++ b/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts @@ -380,6 +380,7 @@ export class ChatService extends Disposable implements IChatService { .filter(entry => !this._sessionModels.has(LocalChatSessionUri.forSession(entry.sessionId)) && entry.initialLocation === ChatAgentLocation.Chat && !entry.isEmpty) .map((entry): IChatDetail => { const sessionResource = LocalChatSessionUri.forSession(entry.sessionId); + const lastResponseState = entry.lastResponseState ?? ResponseModelState.Complete; return ({ ...entry, sessionResource, @@ -391,7 +392,8 @@ export class ChatService extends Disposable implements IChatService { }, isActive: this._sessionModels.has(sessionResource), // TODO@roblourens- missing for old data- normalize inside the store - lastResponseState: entry.lastResponseState ?? ResponseModelState.Complete, + // TODO@connor4312: the check here guards old sessions from Insiders pre PR #288161 and it can be safely removed after a transition period. + lastResponseState: lastResponseState === ResponseModelState.Pending || lastResponseState === ResponseModelState.NeedsInput ? ResponseModelState.Complete : lastResponseState, }); }); }