Skip to content

Commit 151c18f

Browse files
ref(assisted-query): Extract known options fields explicitly
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>
1 parent 77da5a6 commit 151c18f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/sentry/seer/endpoints/search_agent_start.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def send_search_agent_start_request(
6666
strategy: str = "Traces",
6767
user_email: str | None = None,
6868
timezone: str | None = None,
69-
options: dict[str, Any] | None = None,
69+
model_name: str | None = None,
70+
metric_context: dict[str, Any] | None = None,
7071
viewer_context: SeerViewerContext | None = None,
7172
) -> dict[str, Any]:
7273
"""
@@ -83,6 +84,12 @@ def send_search_agent_start_request(
8384
body["user_email"] = user_email
8485
if timezone:
8586
body["timezone"] = timezone
87+
88+
options: dict[str, Any] = {}
89+
if model_name is not None:
90+
options["model_name"] = model_name
91+
if metric_context is not None:
92+
options["metric_context"] = metric_context
8693
if options:
8794
body["options"] = options
8895

@@ -124,6 +131,8 @@ def post(self, request: Request, organization: Organization) -> Response:
124131
natural_language_query = validated_data["natural_language_query"]
125132
strategy = validated_data.get("strategy", "Traces")
126133
options = validated_data.get("options") or {}
134+
model_name = options.get("model_name")
135+
metric_context = options.get("metric_context")
127136

128137
projects = self.get_projects(
129138
request, organization, project_ids=set(validated_data["project_ids"])
@@ -175,7 +184,8 @@ def post(self, request: Request, organization: Organization) -> Response:
175184
strategy=strategy,
176185
user_email=user_email,
177186
timezone=timezone,
178-
options=options if options else None,
187+
model_name=model_name,
188+
metric_context=metric_context,
179189
viewer_context=viewer_context,
180190
)
181191

0 commit comments

Comments
 (0)