Skip to content

Conversation

@ajay-sentry
Copy link
Contributor

Creates a helper function that gets instrumented in the webhook handler after we create a pull request, adding a couple RPCs to fetch seer enabled information as well as repo and setting information (lives in 4 different places). Might also need to add seer add-on enabled billing check potentially if that's a separate thing as well.

Also adds another metric so we can see how often we're entering the condition (and if at all)

Closes https://linear.app/getsentry/issue/ENG-5931/create-guard-for-webhook-logic

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.

@ajay-sentry ajay-sentry requested a review from a team as a code owner December 4, 2025 01:34
@linear
Copy link

linear bot commented Dec 4, 2025

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 4, 2025
ENABLE_PR_REVIEW_TEST_GENERATION_DEFAULT,
)

return gen_ai_features or ai_code_review_enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: hide_ai_features option not respected for ai_code_review path

The has_seer_and_ai_features_enabled_for_repo function doesn't check hide_ai_features when evaluating the ai_code_review_enabled path. When an organization sets both sentry:hide_ai_features=True and sentry:enable_pr_review_test_generation=True, the function returns True even though AI features are supposed to be hidden. This contradicts similar logic in _can_use_prevent_ai_features which returns not hide_ai_features and pr_review_test_generation_enabled. The or logic should likely be and with hide_ai_features check, or ai_code_review_enabled needs to include the hide_ai_features check.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/integrations/github/webhook.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           master   #104371       +/-   ##
============================================
+ Coverage   65.82%    80.56%   +14.74%     
============================================
  Files        9340      9346        +6     
  Lines      399248    399696      +448     
  Branches    25597     25597               
============================================
+ Hits       262788    322014    +59226     
+ Misses     136007     77229    -58778     
  Partials      453       453               

"organizations:gen-ai-features", organization
) and not organization.get_option("sentry:hide_ai_features", HIDE_AI_FEATURES_DEFAULT)

ai_code_review_enabled = organization.get_option(
Copy link
Member

@suejung-sentry suejung-sentry Dec 5, 2025

Choose a reason for hiding this comment

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

We can skip this toggle check for the value of the sentry:enable_pr_review_test_generation organization option for the purposes of billing here.

We're going to keep the toggle around only for legacy seer usage based plan people so they have a way to turn on/off code review until they purchase the seat based plan. They will get code review for free if they turn this toggle on. (slack convo).

The value of the option is no longer relevant for any orgs outside of above

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.

3 participants