Skip to content

Commit 664daea

Browse files
JoshFergegeorge-sentry
authored andcommitted
fix(seer): Populate referrer field in agent_handoff analytics from launch path (#112523)
## Summary - The `ai.autofix.agent_handoff` event added in #112516 hardcoded `referrer=None` in `launch_coding_agents_for_run`, causing BigQuery queries filtering on `referrer` to miss these events - Adds a `referrer` parameter and passes meaningful values from each caller: `api.organization_coding_agents` (UI) and `seer_rpc.trigger_coding_agent_launch` (Seer RPC) ## Test plan - [ ] Verify existing tests pass - [ ] Confirm `referrer` is populated in BigQuery after deploy Agent transcript: https://claudescope.sentry.dev/share/UfJcQt8YPjsSgB02byVDpbig1RWMFUY4oBpF9MbQjRI
1 parent 2655cbe commit 664daea

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/sentry/integrations/api/endpoints/organization_coding_agents.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def post(self, request: Request, organization: Organization) -> Response:
154154
instruction=instruction,
155155
user_id=request.user.id,
156156
initiator="user",
157+
referrer="api.organization_coding_agents",
157158
)
158159

159160
successes = results["successes"]

src/sentry/seer/autofix/coding_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ def launch_coding_agents_for_run(
421421
instruction: str | None = None,
422422
user_id: int | None = None,
423423
initiator: str | None = None,
424+
referrer: str | None = None,
424425
) -> dict[str, list]:
425426
"""
426427
Launch coding agents for an autofix run.
@@ -521,7 +522,7 @@ def launch_coding_agents_for_run(
521522
organization_id=organization.id,
522523
project_id=autofix_state.request.project_id,
523524
group_id=autofix_state.request.issue["id"],
524-
referrer=None,
525+
referrer=referrer,
525526
coding_agent=coding_agent_name,
526527
initiator=initiator,
527528
)

src/sentry/seer/endpoints/seer_rpc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ def trigger_coding_agent_launch(
602602
run_id=run_id,
603603
trigger_source=AutofixTriggerSource(trigger_source),
604604
initiator="seer_agent",
605+
referrer="seer_rpc.trigger_coding_agent_launch",
605606
)
606607
return {"success": True}
607608
except IntegrationNotFound:

0 commit comments

Comments
 (0)