Skip to content

Conversation

@armenzg
Copy link
Member

@armenzg armenzg commented Jan 9, 2026

We have regressed the re-run case and we're debugging why Seer is not triggering the check runs on issue_comment and pull_request via Seer (new approach).

Changes included:

  • More logging
  • sample_rate of 1 for all metrics
  • Minor refactor
  • Test to catch check_run regression

We're debugging why Seer is not triggering the check runs.

Changes included:
* More logging
* sample_rate of 1 for all metrics
* Minor refactor
* Test to catch check_run regression
@armenzg armenzg self-assigned this Jan 9, 2026
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 9, 2026
@armenzg armenzg changed the title chore(code_review): More logging & sample_rate=1.0 fix(code_review): Fix and more debugging Jan 9, 2026
*,
github_event: GithubWebhookType,
event: Mapping[str, Any],
organization: Organization,
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't really use organization.


logger = logging.getLogger(__name__)

METRICS_PREFIX = "seer.code_review.webhook"
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have anymore metrics in this module.

from .config import get_direct_to_seer_gh_orgs

gh_orgs_to_only_send_to_seer = get_direct_to_seer_gh_orgs()
logger.info("gh_orgs_to_only_send_to_seer: %s", gh_orgs_to_only_send_to_seer)
Copy link
Member Author

Choose a reason for hiding this comment

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

Debugging purposes. We will remove it.

metrics.incr(
Metrics.ERROR.value,
tags={"error_status": ErrorStatus.MISSING_INTEGRATION.value},
sample_rate=1.0,
Copy link
Member Author

Choose a reason for hiding this comment

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

We want to have certainty of events happening while debugging.

Copy link
Member

Choose a reason for hiding this comment

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

Nice, I missed this. I'll add it to my other metrics pr

return

if pull_request.get("draft") is True:
_warn_and_increment_metric(ErrorStatus.DRAFT_PR, action=action_value, extra=extra)
Copy link
Member Author

Choose a reason for hiding this comment

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

This unnecessarily shows up in the logs.

if option_key and options.get(option_key):
return
# Skip this check for CHECK_RUN events (always go to Seer)
if github_event != GithubWebhookType.CHECK_RUN:
Copy link
Member Author

Choose a reason for hiding this comment

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

The bypassing system is only for issue_comment and pull_request. This is a regression.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, though I'm confused when the regression occurred because the last spot I updated it here would have retained the logic for everyone except our 2 test orgs if I did that correctly.

I feel like this additional spot checking the feature flag may just be able to remove completely since we're doing the checks upstream already? Anyway we can just leave it in since it will be temporary

# Check if repo owner is in the whitelist (always send to Seer for these orgs)
# Otherwise, check option key to see if Overwatch should handle this
repo_owner = event_payload.get("data", {}).get("repo", {}).get("owner")
if repo_owner not in get_direct_to_seer_gh_orgs():
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that once we're migrated we will remove this bypassing system.

This verifies the bug fix: CHECK_RUN events should bypass the org whitelist
check because they are user-initiated reruns from GitHub UI.
"""
mock_get_orgs.return_value = []
Copy link
Member Author

Choose a reason for hiding this comment

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

Even if the re-run comes from a non-whitelisted org it will work.

@armenzg armenzg marked this pull request as ready for review January 9, 2026 15:26
@armenzg armenzg requested a review from a team as a code owner January 9, 2026 15:26
@armenzg armenzg requested a review from suejung-sentry January 9, 2026 15:26
from ..preflight import CodeReviewPreflightService

if TYPE_CHECKING:
from sentry.integrations.github.webhook import WebhookProcessor
Copy link
Member Author

Choose a reason for hiding this comment

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

I will explain below.



EVENT_TYPE_TO_HANDLER: dict[GithubWebhookType, WebhookProcessor] = {
EVENT_TYPE_TO_HANDLER: dict[GithubWebhookType, Callable[..., None]] = {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a more sensible signature.

The only function that needs to follow WebhookProcessor is handle_webhook_event since it's the one called by the GitHub processors system.

github_org=github_org,
repo=repo,
integration=integration,
**kwargs,
Copy link
Member Author

Choose a reason for hiding this comment

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

Not needed anymore.

@armenzg armenzg enabled auto-merge (squash) January 9, 2026 15:56
@armenzg armenzg merged commit 6b57ba2 into master Jan 9, 2026
66 checks passed
@armenzg armenzg deleted the 1_9/code_review/more_logging/armenzg branch January 9, 2026 16:14
Copy link
Member

@suejung-sentry suejung-sentry left a comment

Choose a reason for hiding this comment

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

retroactive ✅ lgtm

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.

4 participants