Skip to content

Commit 29ec1c5

Browse files
committed
Fall back to canary when prod returns an unsuccessful response
1 parent 7e03908 commit 29ec1c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

shell/agents/Microsoft.Azure.Agent/ChatSession.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ private async Task<string> SetupNewChat(IStatusContext context, CancellationToke
141141
private async Task CheckAuthorizationAsync(CancellationToken cancellationToken)
142142
{
143143
HttpResponseMessage response = await SendRequestAsync(PROD_ACCESS_URL);
144-
if (response.StatusCode is System.Net.HttpStatusCode.Forbidden)
144+
if (response.StatusCode is not System.Net.HttpStatusCode.OK)
145145
{
146146
// We fall back to the test endpoint when the prod endpoint is unavailable.
147147
response = await SendRequestAsync(TEST_ACCESS_URL);
148-
Telemetry.Trace(AzTrace.Exception("Prod access endpoint not working. Fall back to canary endpoint."));
148+
Telemetry.Trace(AzTrace.Exception($"Prod access endpoint unavailable. HTTP status: {response.StatusCode}. Fall back to canary endpoint."));
149149
}
150150
await response.EnsureSuccessStatusCodeForTokenRequest("Failed to check Copilot authorization.");
151151

0 commit comments

Comments
 (0)