Skip to content

feat(assisted-query): Add metrics search feature flag and forward options#112240

Open
isaacwang-sentry wants to merge 2 commits intomasterfrom
isaac/feat/metrics-ai-search-backend
Open

feat(assisted-query): Add metrics search feature flag and forward options#112240
isaacwang-sentry wants to merge 2 commits intomasterfrom
isaac/feat/metrics-ai-search-backend

Conversation

@isaacwang-sentry
Copy link
Copy Markdown
Member

Summary

  • Register gen-ai-explore-metrics-search feature flag to gate the metrics AI search bar independently
  • Update SearchAgentStartEndpoint to accept the new flag when strategy is "Metrics"
  • Forward the full options dict to Seer instead of extracting only model_name, so strategy-specific context (like metric_context) passes through

Test plan

  • Verify the gen-ai-explore-metrics-search flag is registered and exposed to the frontend
  • Verify the endpoint accepts requests with strategy: "Metrics" when the new flag is enabled
  • Verify the full options dict is forwarded to Seer

…ions

Register gen-ai-explore-metrics-search feature flag to gate the metrics
AI search bar independently from the shared gen-ai-search-agent-translate
flag. Forward the full options dict to Seer instead of extracting only
model_name, so strategy-specific context like metric_context can pass
through.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@isaacwang-sentry isaacwang-sentry requested a review from a team as a code owner April 3, 2026 22:23
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 3, 2026
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 prepared a fix for the issue found in the latest run.

  • ✅ Fixed: State endpoint missing new metrics feature flag check
    • Added gen-ai-explore-metrics-search flag check to state endpoint to match the start endpoint's feature flag logic, allowing users with only the metrics flag to poll for search agent state.

Create PR

Or push these changes by commenting:

@cursor push 1df9d6d530
Preview (1df9d6d530)
diff --git a/src/sentry/seer/endpoints/search_agent_state.py b/src/sentry/seer/endpoints/search_agent_state.py
--- a/src/sentry/seer/endpoints/search_agent_state.py
+++ b/src/sentry/seer/endpoints/search_agent_state.py
@@ -81,9 +81,12 @@
                 }
             }
         """
-        if not features.has(
+        has_feature = features.has(
             "organizations:gen-ai-search-agent-translate", organization, actor=request.user
-        ):
+        ) or features.has(
+            "organizations:gen-ai-explore-metrics-search", organization, actor=request.user
+        )
+        if not has_feature:
             return Response(
                 {"detail": "Feature flag not enabled"},
                 status=status.HTTP_403_FORBIDDEN,

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 80e14c4. Configure here.

…oint

The start endpoint allows access with either gen-ai-search-agent-translate
or gen-ai-explore-metrics-search flag when strategy is Metrics, but the
state endpoint only checked gen-ai-search-agent-translate. This caused
users with only the metrics flag to successfully start a search agent
but get 403 errors when polling for state.

Since the state endpoint doesn't know which strategy was used, it now
accepts either flag to match the start endpoint's behavior.

Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>

Applied via @cursor push command
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