Skip to content

Commit 69adedd

Browse files
authored
fix: serialize/deserialize working set URIs for restored chat requests (#234375)
* fix: serialize/deserialize working set URIs for restored chat requests * tests: update snapshots
1 parent 450a3b3 commit 69adedd

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

src/vs/workbench/contrib/chat/common/chatModel.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ export interface ISerializableChatRequestData {
663663
isHidden: boolean;
664664
responseId?: string;
665665
agent?: ISerializableChatAgentData;
666+
workingSet?: UriComponents[];
666667
slashCommand?: IChatAgentCommand;
667668
// responseErrorDetails: IChatResponseErrorDetails | undefined;
668669
result?: IChatAgentResult; // Optional for backcompat
@@ -1004,7 +1005,7 @@ export class ChatModel extends Disposable implements IChatModel {
10041005

10051006
// Old messages don't have variableData, or have it in the wrong (non-array) shape
10061007
const variableData: IChatRequestVariableData = this.reviveVariableData(raw.variableData);
1007-
const request = new ChatRequestModel(this, parsedRequest, variableData, raw.timestamp ?? -1, undefined, undefined, undefined, undefined, undefined, undefined, raw.requestId);
1008+
const request = new ChatRequestModel(this, parsedRequest, variableData, raw.timestamp ?? -1, undefined, undefined, undefined, undefined, raw.workingSet?.map((uri) => URI.revive(uri)), undefined, raw.requestId);
10081009
request.isHidden = !!raw.isHidden;
10091010
if (raw.response || raw.result || (raw as any).responseErrorDetails) {
10101011
const agent = (raw.agent && 'metadata' in raw.agent) ? // Check for the new format, ignore entries in the old format
@@ -1292,6 +1293,7 @@ export class ChatModel extends Disposable implements IChatModel {
12921293
vote: r.response?.vote,
12931294
voteDownReason: r.response?.voteDownReason,
12941295
agent: agentJson,
1296+
workingSet: r.workingSet,
12951297
slashCommand: r.response?.slashCommand,
12961298
usedContext: r.response?.usedContext,
12971299
contentReferences: r.response?.contentReferences,

src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize.0.snap

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
slashCommands: [ ],
7979
disambiguation: [ ]
8080
},
81+
workingSet: undefined,
8182
slashCommand: undefined,
8283
usedContext: {
8384
documents: [

src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize_with_response.0.snap

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
slashCommands: [ ],
7979
disambiguation: [ ]
8080
},
81+
workingSet: undefined,
8182
slashCommand: undefined,
8283
usedContext: undefined,
8384
contentReferences: [ ],

src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.1.snap

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
slashCommands: [ ],
8686
disambiguation: [ ]
8787
},
88+
workingSet: undefined,
8889
slashCommand: undefined,
8990
usedContext: {
9091
documents: [
@@ -153,6 +154,7 @@
153154
disambiguation: [ ],
154155
isDefault: true
155156
},
157+
workingSet: undefined,
156158
slashCommand: undefined,
157159
usedContext: undefined,
158160
contentReferences: [ ],

src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_sendRequest_fails.0.snap

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
slashCommands: [ ],
7979
disambiguation: [ ]
8080
},
81+
workingSet: undefined,
8182
slashCommand: undefined,
8283
usedContext: undefined,
8384
contentReferences: [ ],

0 commit comments

Comments
 (0)