fix: validate copilotTelemetryURL in GitHub telemetry sender (fixes #321454) (#321459)

* fix: validate copilotTelemetryURL in GitHub telemetry sender (fixes #321454)

The applicationinsights Sender throws TypeError: Invalid URL when the
copilotTelemetryURL from @vscode/copilot-api is a malformed URL string.
The new vscode-extension-telemetry reporter (introduced in #3331) passed
it to AppInsightsClientOptions.endpointUrl without validation, unlike the
old AzureInsightReporter which guards with URL.canParse(). Mirror that
guard so the default endpoint is kept when the URL is invalid.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: use ChatResponsePart action for task_complete summary

Co-authored-by: vijayupadya <41652029+vijayupadya@users.noreply.github.com>

---------

Co-authored-by: vs-code-engineering[bot] <122617954+vs-code-engineering[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vijayupadya <41652029+vijayupadya@users.noreply.github.com>
This commit is contained in:
vs-code-engineering[bot]
2026-06-15 20:41:50 +00:00
committed by GitHub
parent 9c9181c14c
commit da43e2c55d

View File

@@ -179,7 +179,6 @@ function createGitHubTelemetryReporter(
};
const appInsightsOptions: AppInsightsClientOptions = {
endpointUrl: capiClientService.copilotTelemetryURL,
commonProperties: commonProps,
// Static tag overrides (set once, applied to all events)
tagOverrides: {
@@ -188,6 +187,14 @@ function createGitHubTelemetryReporter(
}
};
// Only override the default endpoint when the telemetry URL is a valid URL. The
// applicationinsights Sender calls `new URL(endpointUrl)` and throws "Invalid URL"
// for malformed values; mirror AzureInsightReporter's guard and keep the default.
const telemetryURL = capiClientService.copilotTelemetryURL;
if (telemetryURL && URL.canParse(telemetryURL)) {
appInsightsOptions.endpointUrl = telemetryURL;
}
// Pass customFetcher to use the extension's fetcher service (handles proxy/cert/fallbacks)
const newReporter = new TelemetryReporter(
key,