From ccc309cc271c2dfbf15a9a8941e272a8b6a6353c Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Sat, 1 Nov 2025 05:52:55 +0900 Subject: [PATCH 1/3] Safely destructure custom agents response to handle null/undefined --- src/platform/github/common/octoKitServiceImpl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/github/common/octoKitServiceImpl.ts b/src/platform/github/common/octoKitServiceImpl.ts index 127c041735..96832fa82a 100644 --- a/src/platform/github/common/octoKitServiceImpl.ts +++ b/src/platform/github/common/octoKitServiceImpl.ts @@ -148,7 +148,7 @@ export class OctoKitService extends BaseOctoKitService implements IOctoKitServic if (!authToken) { return []; } - const { agents } = await this.getCustomAgentsWithToken(owner, repo, authToken); + const { agents } = { ... await this.getCustomAgentsWithToken(owner, repo, authToken) }; if (!Array.isArray(agents)) { return []; } From cb4f543ec3b95ac501e66b2d5368df664ff74746 Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Sat, 1 Nov 2025 06:13:31 +0900 Subject: [PATCH 2/3] Use nullish coalescing when extracting agents to avoid errors on null/undefined responses --- src/platform/github/common/octoKitServiceImpl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/github/common/octoKitServiceImpl.ts b/src/platform/github/common/octoKitServiceImpl.ts index 96832fa82a..69beb34960 100644 --- a/src/platform/github/common/octoKitServiceImpl.ts +++ b/src/platform/github/common/octoKitServiceImpl.ts @@ -148,7 +148,7 @@ export class OctoKitService extends BaseOctoKitService implements IOctoKitServic if (!authToken) { return []; } - const { agents } = { ... await this.getCustomAgentsWithToken(owner, repo, authToken) }; + const { agents } = (await this.getCustomAgentsWithToken(owner, repo, authToken)) ?? {}; if (!Array.isArray(agents)) { return []; } From d665238d37410c009ce35886daf0b849a45ddd56 Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Thu, 13 Nov 2025 07:19:01 +0900 Subject: [PATCH 3/3] Update getCustomAgentsWithToken to allow undefined response for better error handling --- src/platform/github/common/githubService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/github/common/githubService.ts b/src/platform/github/common/githubService.ts index 83c543facd..67c915b158 100644 --- a/src/platform/github/common/githubService.ts +++ b/src/platform/github/common/githubService.ts @@ -341,7 +341,7 @@ export class BaseOctoKitService { return getPullRequestFromGlobalId(this._fetcherService, this._logService, this._telemetryService, this._capiClientService.dotcomAPIURL, token, globalId); } - protected async getCustomAgentsWithToken(owner: string, repo: string, token: string): Promise { + protected async getCustomAgentsWithToken(owner: string, repo: string, token: string): Promise { const queryParams = '?exclude_invalid_config=true'; return makeGitHubAPIRequest(this._fetcherService, this._logService, this._telemetryService, 'https://api.githubcopilot.com', `agents/swe/custom-agents/${owner}/${repo}${queryParams}`, 'GET', token, undefined, undefined, 'json', 'vscode-copilot-chat'); }