Skip to content

ref(pr-metrics): Add webhook name to webhook-triggered PR logs#118597

Open
vaind wants to merge 1 commit into
masterfrom
vaind/ref-pr-metrics-webhook-name-in-logs
Open

ref(pr-metrics): Add webhook name to webhook-triggered PR logs#118597
vaind wants to merge 1 commit into
masterfrom
vaind/ref-pr-metrics-webhook-name-in-logs

Conversation

@vaind

@vaind vaind commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Webhook-triggered pr_metrics logs now carry the GitHub webhook event name (github_event) in their context, but only where that value actually disambiguates the log.

The pr_metrics.pull_request.unresolved and pr_metrics.pull_request.stub_created logs are emitted from the shared resolve-or-stub helper, which is reached from seven distinct webhook event typespull_request, issue_comment, the three pull_request_review* variants, check_suite, and check_run. These logs fire when a comment/review/check delivery races ahead of the pull_request (opened) delivery that writes the PR row; without the triggering event in context, you can't tell which delivery raced.

This threads github_event (already present on every webhook handler) down through _get_pull_request / _resolve_or_stub_pull_request / _prs_from_check_payload and into that shared log context.

Scope

The webhook name is added only where it varies. Paths reached solely from the pull_request close webhook — select_verdict and the judge-forward logs (pr_metrics.emit.needs_judge, pr_metrics.judge.enqueue_failed) — would log a constant pull_request, so they were deliberately left unchanged. The log key already pins those to the close path.

Out of scope (not a GitHub webhook trigger, so no webhook name to capture): the Seer RPC callback path (judge.py, update_pr_metrics), the async forward task (tasks.py), and the attribution paths (Seer event / Cursor webhook / agent polling).

Behavior change

Pure observability: the only functional effect is an added github_event field on the two PR-resolution logs. No change to pipeline logic, emission, or verdicts.

The pr_metrics.pull_request.unresolved and pr_metrics.pull_request.stub_created
logs fire from the PR resolve-or-stub helper, which is reached from seven
distinct GitHub webhook event types (pull_request, issue_comment, the three
pull_request_review variants, check_suite, check_run). Without the triggering
event in context, these logs can't tell you which delivery raced ahead of the
PR row.

Thread the github_event name into the resolution helpers so both logs carry it.
The value is only added where it varies: paths reached solely from the
pull_request close webhook (select_verdict, the judge-forward logs) would log a
constant and are left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 26, 2026
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.

1 participant