Skip to content

fix(errors): Log network errors as warnings instead of reporting them to Sentry - #177

Merged
armenzg merged 1 commit into
mainfrom
fix/transient-network-errors
Nov 17, 2026
Merged

armenzg merged 1 commit into
mainfrom
fix/transient-network-errors

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Replaces the ~39 Cursor draft PRs (#76–#116) that each added a different retry loop or try/except for transient failures. They all branch off the March main and conflict with it, and most of what they fix has landed since (#118 timeouts, #163 best-effort revoke, #117 config cache).

What's left in prod over the last 14 days is a few hundred timeouts, connection resets, and TLS errors talking to api.github.com or an org's ingest host (e.g. SENTRY-GITHUB-ACTIONS-APP-85, -6P, -80, -25, -7A, -84, -4E). We can't fix those on our end, and the trace is lost either way, so this handles them like #173 handles 403s: log a warning, count a network_error metric tagged with owner and host, and return 200.

Retries aren't in here on purpose. GitHub gives up on a webhook delivery after 10s and our read timeout is already 10s, so a retry can't save the delivery. It would only hold one of gunicorn's few threads longer while GitHub is having a bad time.

It also stops _get_extra_metadata from crashing when a run has head_commit: null, the way the commit-trace path already handles it (what #99/#100 were after).

Open question: 5xx responses still propagate, as #173's test_other_http_errors_propagate intends. SENTRY-GITHUB-ACTIONS-APP-8D (GitHub 503s on one repo's run metadata, ~32k events in 14 days) is the biggest error left after the 403s. Should 5xx get the same warning treatment?

via @armenzg.

--

View Session [Sentry]

… to Sentry

Timeouts, connection resets, and TLS failures talking to GitHub or an org's
Sentry project are transient and not ours to fix, so count them like 403s.
Also stop crashing on workflow runs whose head_commit is null.

Co-Authored-By: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
@armenzg
armenzg marked this pull request as ready for review November 17, 2026 13:54
@armenzg
armenzg requested a review from a team as a code owner November 17, 2026 13:54
@sentry-junior
sentry-junior Bot requested a review from armenzg November 17, 2026 13:54
@armenzg
armenzg merged commit a21fb5e into main Nov 17, 2026
16 checks passed
@armenzg
armenzg deleted the fix/transient-network-errors branch November 17, 2026 13:54

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 790a9c6. Configure here.

Comment thread src/web_app_handler.py
host = urlsplit(url or "").hostname or ""
logger.warning("%s hit a network error talking to %s: %s", org, host, e)
metrics.count("network_error", 1, attributes={"owner": org, "host": host})
return f"The request to {host} failed with a network error.", 200

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connection resets during body still error

Medium Severity

The new handler treats connection resets as ConnectionError, but a reset while reading the response body is raised as ChunkedEncodingError, a sibling of ConnectionError, not a subclass. Those failures still bubble out as 500s to Sentry, which is the noise this change is trying to drop for GitHub and ingest hosts.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 790a9c6. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant