diff --git a/changelog.d/fixed-15369-gateway-message.md b/changelog.d/fixed-15369-gateway-message.md new file mode 100644 index 0000000000..8037c209d4 --- /dev/null +++ b/changelog.d/fixed-15369-gateway-message.md @@ -0,0 +1 @@ +- Avoid reporting transient GitHub gateway failures embedded in log messages as repeated runtime errors. diff --git a/src/pkg/fleetreport/fleetreport.go b/src/pkg/fleetreport/fleetreport.go index 4158bd87ee..0d90b6be90 100644 --- a/src/pkg/fleetreport/fleetreport.go +++ b/src/pkg/fleetreport/fleetreport.go @@ -853,7 +853,8 @@ func IsGitHubUpstreamUnavailable(s string) bool { // IsBenignMessage reports whether a raw log message is noise the generic // repeated-error feed must not report: the read/keepalive i/o timeout rule // above applied to the whole line, GitHub rate-limit and pacing refusals -// (IsGitHubRateLimited), every benignSubstrings entry, and the +// (IsGitHubRateLimited), gateway failures (IsGitHubUpstreamUnavailable), +// every benignSubstrings entry, and the // exact-message exclusions matched in the function body below. func IsBenignMessage(msg string) bool { m := strings.ToLower(msg) @@ -886,7 +887,7 @@ func IsBenignMessage(msg string) bool { "[contribute-ws] refusing task: daily rate limit reached": return true } - if benignIOTimeout(m, m) || IsGitHubRateLimited(m) { + if benignIOTimeout(m, m) || IsGitHubRateLimited(m) || IsGitHubUpstreamUnavailable(m) { return true } for _, s := range benignSubstrings { diff --git a/src/pkg/fleetreport/slogfeed/slogfeed_test.go b/src/pkg/fleetreport/slogfeed/slogfeed_test.go index 9b0e9bee16..9e9cd3c283 100644 --- a/src/pkg/fleetreport/slogfeed/slogfeed_test.go +++ b/src/pkg/fleetreport/slogfeed/slogfeed_test.go @@ -571,6 +571,9 @@ func TestGitHubUpstreamUnavailableLogsWithoutFleetReport(t *testing.T) { msg string args []any }{ + {"fetch failed: GET https://api.github.com/repos/o/r/pulls/1336: 503 []", nil}, + {"fetch failed: GET https://api.github.com/repos/o/r: 502 Bad Gateway []", nil}, + {"fetch failed: GET https://api.github.com/repos/o/r: 504 Gateway Timeout []", nil}, {"self-authored automerge sweep skipped PR", []any{"repo", "kubestellar-mcp", "pr", 1336, "reason", "fetch-pr", "error", "GET https://api.github.com/repos/o/r/pulls/1336: 503 []"}}, {"failed to fetch check runs", []any{"error", "GET https://api.github.com/repos/o/r/commits/abc/check-runs: 502 Bad Gateway []"}}, {"failed to fetch check runs", []any{"error", "GET https://api.github.com/repos/o/r/commits/abc/check-runs: 504 Gateway Timeout []"}}, @@ -591,7 +594,9 @@ func TestGitHubUpstreamUnavailableLogsWithoutFleetReport(t *testing.T) { logger, seen, _ := newFeed(t) logger.Warn("self-authored automerge sweep skipped PR", "error", "GET https://api.github.com/repos/o/r/pulls/1336: 500 Internal Server Error []") logger.Warn("self-authored automerge sweep skipped PR", "error", "GET https://api.github.com/repos/o/r/pulls/1336: 403 Resource not accessible by integration") - if len(*seen) != 2 { + logger.Warn("fetch failed: GET https://api.github.com/repos/o/r/pulls/503: 404 Not Found") + logger.Warn("fetch failed: GET https://api.github.com/repos/o/r: 500 Internal Server Error") + if len(*seen) != 4 { t.Fatalf("non-gateway failures must remain reportable: %+v", *seen) } }