Use product/version format and sanitize orchestration ID

Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]andTingluoHuang committed 2026-01-06 16:26:29 +00:00
1 parent 4d32a94174
commit 9cc24ce294
2 files changed
+24 -2

No files matched your search

+4 -1
View File
@@ -820,7 +820,10 @@ export class HttpClient {
private _getUserAgentWithOrchestrationId(userAgent: string): string {
const orchId = process.env['ACTIONS_ORCHESTRATION_ID']
if (orchId) {
return `${userAgent} (gh_orch_id:${orchId})`
// Sanitize the orchestration ID to ensure it contains only valid token characters
// Valid characters: alphanumeric, !, #, $, %, &, ', *, +, -, ., ^, _, `, |, ~
const sanitizedId = orchId.replace(/[^a-zA-Z0-9!#$%&'*+\-.^_`|~]/g, '_')
return `${userAgent} github_orchestration_id/${sanitizedId}`
}
return userAgent
}