Skip to content

fix(seer): Capture GitLab webhook validation failures as exceptions#117969

Merged
billyvg merged 6 commits into
masterfrom
billy/escalate-gitlab-webhook-validation-failures
Jun 18, 2026
Merged

fix(seer): Capture GitLab webhook validation failures as exceptions#117969
billyvg merged 6 commits into
masterfrom
billy/escalate-gitlab-webhook-validation-failures

Conversation

@billyvg

@billyvg billyvg commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

When a GitLab merge_request or note webhook payload fails SeerCodeReviewTaskRequest validation, _schedule_task drops the review entirely — it never reaches Seer, yet GitLab still receives a 200. Today this is only a debug_log at WARNING level, so the silent drops are effectively invisible.

This replaces the validation_failed / note.validation_failed debug logs with sentry_sdk.capture_exception, so a dropped review surfaces as a Sentry issue and can be triaged.

Changes

  • Both except ValidationError blocks (MR-event path and @sentry review note path) now capture_exception(e) inside a scope that carries the validation_errors and seer_path (or mr_iid) as context for triage.
  • record_webhook_filtered(..., INVALID_PAYLOAD) is retained — the metric is still useful.

Why

A validation failure is not a benign "filtered" event — it means we accepted the webhook but never ran the review the customer expected. That deserves escalation, not a debug log. (This is the same failure mode behind the trigger_at datetime bug; see related PR.)

Tests

  • test_validation_failure_is_captured_and_review_dropped — forces a ValidationError, asserts capture_exception is called with it and the Seer task is not enqueued.

Note

Independent of (not stacked on) the trigger_at normalization PR — they touch different code paths in the same file and can merge in any order.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 17, 2026
@billyvg billyvg changed the title fix(seer): Escalate GitLab webhook validation failures to Sentry fix(seer): Capture GitLab webhook validation failures as exceptions Jun 18, 2026
@billyvg billyvg marked this pull request as ready for review June 18, 2026 00:15
@billyvg billyvg requested a review from a team as a code owner June 18, 2026 00:15
@billyvg billyvg requested a review from a team June 18, 2026 00:15
@billyvg billyvg marked this pull request as draft June 18, 2026 17:28
Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@billyvg billyvg force-pushed the billy/escalate-gitlab-webhook-validation-failures branch from a7936a4 to 84e762c Compare June 18, 2026 17:35
Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@billyvg billyvg marked this pull request as ready for review June 18, 2026 17:49
Comment thread src/sentry/seer/code_review/webhooks/merge_request.py Outdated
Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>

@cursor cursor Bot left a comment

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.

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 8555892. Configure here.

Comment thread tests/sentry/seer/code_review/webhooks/test_merge_request.py Outdated
Comment thread tests/sentry/seer/code_review/webhooks/test_merge_request.py Outdated
Comment thread tests/sentry/seer/code_review/webhooks/test_merge_request.py Outdated
@billyvg billyvg merged commit 56e1f95 into master Jun 18, 2026
64 checks passed
@billyvg billyvg deleted the billy/escalate-gitlab-webhook-validation-failures branch June 18, 2026 18:51
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