feat(seer): Serialize linked pull requests with state on Seer runs#119795
Draft
jshchnz wants to merge 3 commits into
Draft
feat(seer): Serialize linked pull requests with state on Seer runs#119795jshchnz wants to merge 3 commits into
jshchnz wants to merge 3 commits into
Conversation
Add two demo views under issues/autofix/: - /issues/autofix/runs/ lists the organization's recent Seer runs from the seer/runs/ endpoint (with ?expand=questions) and renders each run's one-shot question answers via SeerMarkdown, one collapsible section per run. Sends a hardcoded DEMO_QUESTIONS list via the repeatable `question` param instead of the server-side set, rendering each echoed question text as the answer heading so prompts can be iterated on without a backend change. Requests a small page since expansion can trigger one-shot calls per run on a cold cache. - /issues/autofix/issues/ lists issues Seer has run autofix on (has:issue.seer_last_run) and enriches each with its most recent explorer run and one-shot outputs. Data-fetching lives behind a single paginated useAutofixIssues hook: it queries the issue stream, then makes one group-scoped runs request so we only fetch runs for the issues on the page. Each issue also shows its autofix phase as a colored Status tag (Root cause -> Planning -> Coding -> PR open), derived by reusing getOrderedAutofixSections. Reuses the standard IssueListSearchBar with the required has:issue.seer_last_run filter always applied by the hook. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Send a fixed list of demo questions as repeatable `question` params to the seer runs endpoint instead of the generic `outputs` flag, and render each answer under its echoed-back question text rather than the raw output key. Refs the seer runs demo UI. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/3OId6GAKdIxHX-BkJJm4ZZFHtF_4YouJOyG0ewb-xEQ
The runs list endpoint knew nothing about the PRs a run opened: the
autofix state's repo_pr_states tops out at "PR created", and merge
status only exists on sentry.PullRequest (stamped by the GitHub
webhook), reachable through the SeerRunPullRequest link table. As a
result, UIs listing runs can never show that a fix actually merged --
a merged autofix looks identical to one still awaiting review.
Add a pullRequests field to SeerRunResponse: one bulk query through
SeerRunPullRequest -> PullRequest in get_attrs (no N+1), emitting
{key, state, mergedAt} per linked PR, empty list when a run opened
none. state is null until a provider webhook reports one.
The Autofix overview UI (#119794) already consumes this field
defensively -- its Merged badge, stat card, and quick filter light up
once this deploys.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
chromy
force-pushed
the
chromy/2026-07-01-seer-runs-demo-ui
branch
3 times, most recently
from
July 16, 2026 14:08
c2b28fe to
eb3f45f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The runs list endpoint (
/organizations/{org}/seer/runs/) currently exposes nothing about the PRs a run opened. The autofix state'srepo_pr_states.pr_creation_statustops out at "PR created", while merge status lives onsentry.PullRequest.state(stampedmerged+merged_atby the GitHub webhook,integrations/github/webhook.py), reachable via theSeerRunPullRequestlink table (seer/pull_requests.pycreates one per Seer-opened PR on thepr_createdwebhook).Consequence: any UI listing runs cannot distinguish a merged autofix from one still awaiting review — merged wins are permanently disguised as "needs review". (Merging also doesn't auto-resolve the group, so these rows stay visible forever.)
What
Adds
pullRequeststoSeerRunResponse:SeerRunSerializer.get_attrsthroughSeerRunPullRequest → PullRequest(select_related, no N+1), following the same join pattern asGroupPullRequestsEndpoint.stateis null until a provider webhook reports one.Consumer
The Autofix overview UI (#119794, sibling branch off the same base) already consumes this field defensively: its Merged badge, live "Merged PRs" stat card, and
mergedquick filter activate automatically once this deploys — until then it renders an honest disabled state.Testing
test_pull_requests_serialized_with_stateintests/sentry/seer/endpoints/test_organization_seer_runs.py: a run with a merged PR (state + mergedAt serialized), an open PR with no webhook state (nulls), and a run with no PRs (empty list). Existing serializer tests use key-based assertions and are unaffected by the added field.🤖 Generated with Claude Code