Skip to content

Commit 6839918

Browse files
committed
fix(autofix): Skip code-changes-completed event when PR is created
When webhook_action_type is PR_CREATED, the on_completion_hook was firing AiAutofixCodeChangesCompletedEvent (from STEP_CONFIGS) alongside AiAutofixPrCreatedCompletedEvent. This inflated code-changes-completed analytics counts because the hook also fires after PR creation via push_changes' on_completion_hook payload. Gate the STEP_CONFIGS completed_event recording on webhook_action_type != PR_CREATED so only the PR-created event fires in that path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/pZN9EjD2NnKcBxKbvdo8ab42Yrd8eKMf_wauRcylSb0
1 parent 0a63227 commit 6839918

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/sentry/seer/autofix/on_completion_hook.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ def _send_step_webhook(
238238
"autofix.explorer.complete", tags={"step": current_step.value, "referrer": referrer}
239239
)
240240
completed_event_cls = STEP_CONFIGS[current_step].completed_event
241-
if completed_event_cls is not None and referrer is not None:
241+
if (
242+
completed_event_cls is not None
243+
and referrer is not None
244+
and webhook_action_type != SeerActionType.PR_CREATED
245+
):
242246
analytics.record(
243247
completed_event_cls(
244248
organization_id=organization.id,

0 commit comments

Comments
 (0)