Skip to content

feat(seer): Record agent_handoff analytics in launch_coding_agents_for_run#112516

Merged
JoshFerge merged 2 commits intomasterfrom
jferg/feat/coding-agent-launch-analytics
Apr 8, 2026
Merged

feat(seer): Record agent_handoff analytics in launch_coding_agents_for_run#112516
JoshFerge merged 2 commits intomasterfrom
jferg/feat/coding-agent-launch-analytics

Conversation

@JoshFerge
Copy link
Copy Markdown
Member

@JoshFerge JoshFerge commented Apr 8, 2026

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

…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
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 8, 2026
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
@JoshFerge JoshFerge marked this pull request as ready for review April 8, 2026 20:29
@JoshFerge JoshFerge requested review from a team as code owners April 8, 2026 20:29
@JoshFerge JoshFerge enabled auto-merge (squash) April 8, 2026 20:30
Copy link
Copy Markdown
Member

@sehr-m sehr-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be so helpful!

@JoshFerge JoshFerge merged commit 79c3e10 into master Apr 8, 2026
57 checks passed
@JoshFerge JoshFerge deleted the jferg/feat/coding-agent-launch-analytics branch April 8, 2026 20:34
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 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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4f76483. Configure here.

JoshFerge added a commit that referenced this pull request Apr 8, 2026
…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
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…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
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…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
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