feat(seer): Record agent_handoff analytics in launch_coding_agents_for_run#112516
feat(seer): Record agent_handoff analytics in launch_coding_agents_for_run#112516
Conversation
…r_run The `ai.autofix.agent_handoff` event was only recorded in `trigger_coding_agent_handoff` (the on-completion hook path), missing all user-initiated launches from the API endpoint and seer RPC. This adds the same analytics event to `launch_coding_agents_for_run` with a `referrer` field to distinguish the source (API vs RPC vs automation). Agent transcript: https://claudescope.sentry.dev/share/hW_-LEqInnK9GHAj_un_YXCtlKj-Y12cfuRzNRHNuxQ
Add an `initiator` field to distinguish the source of coding agent launches: "user" (UI click), "seer_agent" (Seer RPC), or "automation" (on-completion hook). Agent transcript: https://claudescope.sentry.dev/share/iT0p1VOOtjyScx7munne1Y55T0mUcGG4E__Fat0cAhg
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 4f76483. Configure here.
| organization_id=organization.id, | ||
| project_id=autofix_state.request.project_id, | ||
| group_id=autofix_state.request.issue["id"], | ||
| referrer=None, |
There was a problem hiding this comment.
Hardcoded referrer=None creates inconsistent analytics data
Medium Severity
The new AiAutofixAgentHandoffEvent in launch_coding_agents_for_run hardcodes referrer=None, while the existing recording site in trigger_coding_agent_handoff populates referrer with a meaningful value (e.g., autofix.on_completion_hook). The callers already know the source — organization_coding_agents passes initiator="user" and seer_rpc passes initiator="seer_agent" — but this information isn't mapped to the referrer field. Any existing BigQuery analytics queries filtering on referrer will silently miss events from these two new code paths.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 4f76483. Configure here.
…unch 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
…r_run (#112516) ## Summary - Adds `ai.autofix.agent_handoff` analytics event to `launch_coding_agents_for_run`, which was previously only recorded in `trigger_coding_agent_handoff` (on-completion hook path) - Adds a `referrer` parameter to distinguish the source: `api.organization_coding_agents` (user-initiated from UI), `seer_rpc.trigger_coding_agent_launch` (seer-initiated), or the existing `autofix.on_completion_hook` (automation) - This ensures all coding agent launches (Cursor, Claude Code, GitHub Copilot) are tracked in BigQuery regardless of trigger path ## Test plan - [ ] Verify existing tests pass - [ ] Confirm `ai.autofix.agent_handoff` events appear in BigQuery with the new referrer values after deploy Agent transcript: https://claudescope.sentry.dev/share/K0dXID_ySuOGsHj7b4N5JYUuP88VYoij1v1UHwMd8CA
…unch 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


Summary
ai.autofix.agent_handoffanalytics event tolaunch_coding_agents_for_run, which was previously only recorded intrigger_coding_agent_handoff(on-completion hook path)referrerparameter to distinguish the source:api.organization_coding_agents(user-initiated from UI),seer_rpc.trigger_coding_agent_launch(seer-initiated), or the existingautofix.on_completion_hook(automation)Test plan
ai.autofix.agent_handoffevents appear in BigQuery with the new referrer values after deployAgent transcript: https://claudescope.sentry.dev/share/K0dXID_ySuOGsHj7b4N5JYUuP88VYoij1v1UHwMd8CA