Skip to content

fix(autofix): Check preference repositories instead of tuning for Seer autofix onboarding check#112726

Merged
srest2021 merged 5 commits intomasterfrom
srest2021/onboarding-check
Apr 10, 2026
Merged

fix(autofix): Check preference repositories instead of tuning for Seer autofix onboarding check#112726
srest2021 merged 5 commits intomasterfrom
srest2021/onboarding-check

Conversation

@srest2021
Copy link
Copy Markdown
Member

@srest2021 srest2021 commented Apr 10, 2026

Change is_autofix_enabled to check whether any project in the org has repositories configured in Seer preferences, rather than checking autofix_automation_tuning project options.

Endpoint returns 500 if Seer API errors.

srest2021 and others added 2 commits April 10, 2026 12:28
…ofix_enabled

Change is_autofix_enabled to check whether any project in the org has
repositories configured in Seer preferences, rather than checking
autofix_automation_tuning project options.

Under the dual-read feature flag, query SeerProjectRepository directly.
Otherwise, call the Seer API per active project and check
preference.repositories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 10, 2026
.exists()
if features.has("organizations:seer-project-settings-read-from-sentry", organization):
return SeerProjectRepository.objects.filter(
project__organization_id=organization.id, project__status=ObjectStatus.ACTIVE
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If repo is disabled/hidden its SeerProjectRepositoryRow will be deleted, so we don't need to filter by repo status here.

@srest2021 srest2021 changed the title ref(seer): Check preference repositories instead of tuning for Seer autofix onboarding check fix(autofix): Check preference repositories instead of tuning for Seer autofix onboarding check Apr 10, 2026
@srest2021 srest2021 marked this pull request as ready for review April 10, 2026 19:47
@srest2021 srest2021 requested a review from a team as a code owner April 10, 2026 19:47
@srest2021 srest2021 requested a review from ryan953 April 10, 2026 19:47
Comment thread src/sentry/seer/endpoints/organization_seer_onboarding_check.py Outdated
Comment on lines +72 to +80
for project_id in project_ids:
try:
preference = get_project_seer_preferences(project_id).preference
if preference and preference.repositories:
return True
except (SeerApiError, SeerApiResponseValidationError):
pass

return False
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ahh, this is probably why we looked at ProjectOption before, because all the data in seer is a bigger hop to fetch.

Just for documentation sake, what's the current estimate on how long we'll have the two codepaths for seer-project-settings-read-from-sentry in here? like days, weeks, months?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I want to finish up the read paths and start rolling out the flag next week. So probably for the next couple weeks!

And I forgot there is a bulk endpoint available 😭 Will be a quick fix and only one API call.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a couple weeks isn't too bad at all. eligible users should make their first request to the endpoint on pageload, where speed of the endpoint won't really be visible, then when they get to an interactive area like Issue Details the response should be cached already.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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 8c5d166. Configure here.

Comment thread src/sentry/seer/endpoints/organization_seer_onboarding_check.py Outdated
@srest2021 srest2021 marked this pull request as draft April 10, 2026 19:58
@srest2021 srest2021 marked this pull request as ready for review April 10, 2026 20:05
Comment thread src/sentry/seer/endpoints/organization_seer_onboarding_check.py Outdated
Comment thread src/sentry/seer/endpoints/organization_seer_onboarding_check.py Outdated
@srest2021 srest2021 requested review from a team and removed request for a team April 10, 2026 20:36
… of false

When the Seer API fails, return a 500 error instead of silently returning
isAutofixEnabled=false. This prevents the frontend from caching a stale
false value and showing incorrect "configure Seer" prompts on transient
API failures.
@srest2021 srest2021 merged commit 7b31e0a into master Apr 10, 2026
56 checks passed
@srest2021 srest2021 deleted the srest2021/onboarding-check branch April 10, 2026 22:11
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.

2 participants