feat(assisted-query): Add metrics search feature flag and forward options#112240
feat(assisted-query): Add metrics search feature flag and forward options#112240isaacwang-sentry merged 5 commits intomasterfrom
Conversation
…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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
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.
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.
…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
aliu39
left a comment
There was a problem hiding this comment.
what's the reason for the options param change, is it necessary? We're not using any options besides model_name right?
There's nothing wrong w it per se, but validator could let through a random dict of unused options
We did this so metric_context could pass through to Seer without the sentry endpoint needing to know about every field, if we want we can explicitly extract model_name + metric_context and only forward those. |
…itch Change the state endpoint feature flag check from OR to AND so that gen-ai-search-agent-translate must always be enabled for access. This lets the translate flag serve as a global killswitch for all search agent functionality. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Start endpoint: change OR to AND so gen-ai-search-agent-translate acts as a global killswitch — metrics search requires both flags. State endpoint: change AND to OR since it is strategy-agnostic and only takes a run_id. Traces users with only the translate flag must still be able to poll for results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 77da5a6. Configure here.
| ): | ||
| ) or features.has( | ||
| "organizations:gen-ai-explore-metrics-search", organization, actor=request.user | ||
| ) |
There was a problem hiding this comment.
State endpoint OR logic defeats global killswitch intent
Medium Severity
The state endpoint uses or to combine the two feature flags, while the start endpoint uses and (per reviewer request) so gen-ai-search-agent-translate acts as a global killswitch. The or in the state endpoint undermines that intent — disabling gen-ai-search-agent-translate won't block state polling for orgs that only have gen-ai-explore-metrics-search enabled.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 77da5a6. Configure here.
|
Is there validation on Seer side? If so that's fine, otherwise I'd prefer extracting the fields here |
Instead of forwarding the raw options dict to Seer, extract only model_name and metric_context. This prevents unknown fields from passing through the unvalidated DictField serializer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>



Summary
gen-ai-explore-metrics-searchfeature flag to gate the metrics AI search bar independentlySearchAgentStartEndpointto accept the new flag when strategy is "Metrics"optionsdict to Seer instead of extracting onlymodel_name, so strategy-specific context (likemetric_context) passes throughTest plan
gen-ai-explore-metrics-searchflag is registered and exposed to the frontendstrategy: "Metrics"when the new flag is enabledoptionsdict is forwarded to Seer