Skip to content

Commit 3e6dd87

Browse files
Copilotalexr00
andauthored
Preserve server sort order when parsing issue search results
Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/ddf9881f-6b22-4386-902f-ffbb389676e4 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent c5aa0f9 commit 3e6dd87

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/@types/vscode.proposed.chatParticipantPrivate.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,17 @@ declare module 'vscode' {
303303
* Unique ID for the subagent invocation, used to group tool calls from the same subagent run together.
304304
*/
305305
subAgentInvocationId?: string;
306+
/**
307+
* W3C trace context `traceparent` header value identifying the active distributed
308+
* tracing span. When provided to a tool implementation backed by an MCP server, this
309+
* value is forwarded as `_meta.traceparent` on the JSON-RPC `tools/call` request so
310+
* downstream servers can correlate their spans (MCP SEP-414).
311+
*/
312+
traceparent?: string;
313+
/**
314+
* Optional W3C trace context `tracestate` header value paired with `traceparent`.
315+
*/
316+
tracestate?: string;
306317
/**
307318
* Pre-tool-use hook result, if the hook was already executed by the caller.
308319
* When provided, the tools service will skip executing its own preToolUse hook

src/github/githubRepository.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,13 +909,17 @@ export class GitHubRepository extends Disposable {
909909
});
910910
Logger.debug(`Fetch issues with query - done`, this.id);
911911

912-
const issues: Issue[] = [];
912+
let issues: Issue[] = [];
913913
if (data && data.search.edges) {
914-
await Promise.all(data.search.edges.map(async raw => {
914+
// Preserve the order returned by the server (e.g. sort:created-desc).
915+
// Using `Promise.all(map(async ... push))` would reorder results by completion time.
916+
const parsed = await Promise.all(data.search.edges.map(async raw => {
915917
if (raw.node.id) {
916-
issues.push(await parseGraphQLIssue(raw.node, this));
918+
return parseGraphQLIssue(raw.node, this);
917919
}
920+
return undefined;
918921
}));
922+
issues = parsed.filter((issue): issue is Issue => issue !== undefined);
919923
}
920924
return {
921925
items: issues,

0 commit comments

Comments
 (0)