Conversation
- Add extract_webhook_context() in utils.py to combine GitHub event info with Sentry-specific context (org, repo, integration, provider) - In handlers.py: call extract_webhook_context() and set tags via sentry_sdk.set_tags() so all downstream logs/errors/spans get context - In task.py: extract context from transformed payload and set sentry_sdk.set_tags() at task start for async execution scope Follows the same pattern used in seer's CodegenStep._invoke() for automatic tag propagation to Sentry errors and traces. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
| integration=integration, | ||
| github_event=github_event.value, | ||
| ) | ||
| sentry_sdk.set_tags(context) |
There was a problem hiding this comment.
None values not filtered before setting Sentry tags
Low Severity
The context dict from extract_webhook_context() is passed directly to sentry_sdk.set_tags() without filtering None values. The extract_github_info() function returns a dict where most fields default to None, and extract_webhook_context() also sets sentry_integration_id to None when no integration is provided. In task.py, None values are explicitly filtered out with a comment stating "Filter out None values to avoid cluttering Sentry tags" - but this filtering is missing in handlers.py, causing inconsistent behavior.


Summary
Applies the same context extraction and Sentry SDK tagging pattern used in the seer repository to Sentry's code_review webhook handlers.
Changes
extract_webhook_context()to combine GitHub event info with Sentry-specific context (org, repo, integration, provider). Returns a dict suitable forsentry_sdk.set_tags().extract_webhook_context()andsentry_sdk.set_tags(context)at webhook entry so all downstream logs, errors, and spans get the context automatically.sentry_sdk.set_tags(context_tags)at the start ofprocess_github_webhook_event()so the async task execution scope also has tags.Pattern (from seer)
In seer's
CodegenStep._invoke():We now do the equivalent in both the webhook handler path and the Celery task path.
Benefits
Made with Cursor