Skip to content

fix(seer): Skip the iteration push when the PR is closed - #123831

Open
alexsohn1126 wants to merge 5 commits into
masterfrom
alexsohn/cw-1998-block-push-to-closed-pr
Open

fix(seer): Skip the iteration push when the PR is closed#123831
alexsohn1126 wants to merge 5 commits into
masterfrom
alexsohn/cw-1998-block-push-to-closed-pr

Conversation

@alexsohn1126

@alexsohn1126 alexsohn1126 commented Sep 8, 2026

Copy link
Copy Markdown
Member

previously seer would re-open the PR if the PR was closed:

image

this PR blocks the iteration from even starting if PR is closed and we block the RPC call to Seer to push the changes as well. the latter is for when PR is closed while the iteration is in-flight.

An iteration triggered by a comment on a closed PR pushed its changes anyway,
so a close no longer stopped Seer from writing to the PR. Read the PR state
before pushing and stop when every PR on the run is closed. A PR we cannot
read counts as open, so a transient failure does not drop the changes.

Fixes CW-1998

Claude-Session: https://claude.ai/code/session_017A4BhakBapTmqxiuspM29x
@linear-code

linear-code Bot commented Sep 8, 2026

Copy link
Copy Markdown

CW-1998

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 8, 2026
The completion-hook block still spent a whole agent run before finding the PR
closed. Check at the front of the consume task too, so a closed PR costs one
API read instead of an iteration.

The queue is left intact rather than cleared: if the PR reopens, the feedback
that arrived while it was closed is still worth draining.

Claude-Session: https://claude.ai/code/session_017A4BhakBapTmqxiuspM29x
@alexsohn1126
alexsohn1126 marked this pull request as ready for review September 8, 2026 20:40
@alexsohn1126
alexsohn1126 requested a review from a team as a code owner September 8, 2026 20:40
A push serves every repo on the run at once, so it cannot honor a close on one
PR while still writing to the others. Treat one closed PR as the stop signal
for the run rather than waiting for all of them to close.

Claude-Session: https://claude.ai/code/session_017A4BhakBapTmqxiuspM29x
Comment thread src/sentry/seer/autofix/pr_iteration/pr_state.py
Both gates now write the pause marker, so a closed PR costs one read once
rather than a read on every later trigger. The pause is one-way, as we have no
signal to lift it on: nothing tells us a PR reopened.

Add autofix.pr_iteration.pr_closed, tagged with the gate that caught it, so we
can see how often a close lands mid-iteration versus before one starts.

Claude-Session: https://claude.ai/code/session_017A4BhakBapTmqxiuspM29x
…ock-push-to-closed-pr

# Conflicts:
#	src/sentry/seer/autofix/on_completion_hook.py
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