Skip to content

fix(seer): Handle 404 from Seer in get_agent_state_from_pr_id gracefully#120605

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix-seer-404-pr-state
Draft

fix(seer): Handle 404 from Seer in get_agent_state_from_pr_id gracefully#120605
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix-seer-404-pr-state

Conversation

@sentry

@sentry sentry Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the NoRetriesRemainingError in sentry.tasks.autofix.trigger_pr_iteration_from_review.

Previously, when get_agent_state_from_pr_id called the Seer API for a PR not managed by Seer, Seer would correctly return an HTTP 404 Not Found. However, get_agent_state_from_pr_id treated any HTTP status code >= 400 as a fatal SeerApiError.

This caused the trigger_pr_iteration_from_review task to repeatedly fail and retry until all Celery retries were exhausted, leading to the NoRetriesRemainingError.

This fix modifies src/sentry/seer/agent/client_utils.py to explicitly check for a 404 status code in get_agent_state_from_pr_id. If a 404 is received, it now returns None gracefully, allowing the calling task to proceed without error when a PR is not managed by Seer.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-5RXF

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants