From bb3642ae31fb8769778c02457befea3d4f591358 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 16 Jul 2026 19:44:45 -0700 Subject: [PATCH] fix(github): avoid false outage attribution --- src/shared/github-api-availability.test.ts | 6 ++++++ src/shared/github-api-availability.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/github-api-availability.test.ts b/src/shared/github-api-availability.test.ts index 1b104525e46..df34de85940 100644 --- a/src/shared/github-api-availability.test.ts +++ b/src/shared/github-api-availability.test.ts @@ -20,6 +20,7 @@ describe('classifyGitHubUnavailable', () => { 'connect ETIMEDOUT 140.82.112.5:443', 'TimeoutError: request aborted', 'NetworkError when attempting to fetch resource', + 'network unavailable', 'fetch failed', 'socket hang up', 'could not resolve host: api.github.com', @@ -41,6 +42,11 @@ describe('classifyGitHubUnavailable', () => { expect(classifyGitHubUnavailable('HTTP 403: Resource not accessible by integration')).toBeNull() expect(classifyGitHubUnavailable('HTTP 404: Not Found')).toBeNull() expect(classifyGitHubUnavailable('could not resolve to a Repository with the name')).toBeNull() + expect( + classifyGitHubUnavailable( + "GraphQL: Could not resolve to a Repository with the name 'network'." + ) + ).toBeNull() expect(classifyGitHubUnavailable('gh auth login required')).toBeNull() expect(classifyGitHubUnavailable('')).toBeNull() }) diff --git a/src/shared/github-api-availability.ts b/src/shared/github-api-availability.ts index b44b1ea4d47..83d59ae9fed 100644 --- a/src/shared/github-api-availability.ts +++ b/src/shared/github-api-availability.ts @@ -23,7 +23,7 @@ const SERVER_ERROR_PATTERN = // both Node (ENOTFOUND/ECONNRESET) and the gh Go client ("dial tcp", "i/o // timeout", "no such host") shapes. const NETWORK_PATTERN = - /timeout|\btimed out\b|\bno such host\b|could not resolve host|could not resolve to a host|network|\bconnection (?:refused|reset)\b|\bdial tcp\b|\bi\/o timeout\b|\bfetch failed\b|\bsocket hang up\b|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH/i + /timeout|\btimed out\b|\bno such host\b|could not resolve host|could not resolve to a host|\bnetwork(?:error| (?:error|unavailable|unreachable|request failed))\b|\bconnection (?:refused|reset)\b|\bdial tcp\b|\bi\/o timeout\b|\bfetch failed\b|\bsocket hang up\b|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH/i /** * Classify a gh/Octokit error message as a GitHub-reachability problem, or