From e4f73025c7eca4b0d9afca8961c4ee6187db3abe Mon Sep 17 00:00:00 2001 From: Rohan Agarwal <47861399+roaga@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:17:50 -0700 Subject: [PATCH] chore(autofix+copilot) Allow autofix without FF if gen AI consent given (#79361) This allows orgs who we're giving access to the Copilot extension to call Autofix as long as they have given us Gen AI consent, even if they are not feature flagged into our LA. In the autofix start endpoint, we allow it if either they have the FF or have gen AI consent. In the setup endpoint, we remove the FF check so that we can check set up status regardless. --- src/sentry/api/endpoints/group_ai_autofix.py | 1 + src/sentry/api/endpoints/group_autofix_setup_check.py | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/sentry/api/endpoints/group_ai_autofix.py b/src/sentry/api/endpoints/group_ai_autofix.py index 74a1a07e816770..780946cd7000d8 100644 --- a/src/sentry/api/endpoints/group_ai_autofix.py +++ b/src/sentry/api/endpoints/group_ai_autofix.py @@ -163,6 +163,7 @@ def post(self, request: Request, group: Group) -> Response: if not ( features.has("projects:ai-autofix", group.project) or features.has("organizations:autofix", group.organization) + or group.organization.get_option("sentry:gen_ai_consent", False) ): return self._respond_with_error("AI Autofix is not enabled for this project.", 403) diff --git a/src/sentry/api/endpoints/group_autofix_setup_check.py b/src/sentry/api/endpoints/group_autofix_setup_check.py index 6f0d2e05a53476..96f1d5c20ee123 100644 --- a/src/sentry/api/endpoints/group_autofix_setup_check.py +++ b/src/sentry/api/endpoints/group_autofix_setup_check.py @@ -108,12 +108,6 @@ def get(self, request: Request, group: Group) -> Response: """ Checks if we are able to run Autofix on the given group. """ - if not ( - features.has("projects:ai-autofix", group.project) - or features.has("organizations:autofix", group.organization) - ): - return Response({"detail": "Feature not enabled for project"}, status=403) - org: Organization = request.organization has_gen_ai_consent = org.get_option("sentry:gen_ai_consent", False)