Skip to content

ref(autofix): Move PR iteration completion handling into pr_iteration - #125495

Merged
joseph-sentry merged 3 commits into
masterfrom
joey--pr-iter-completion-hook
Oct 7, 2026
Merged

joseph-sentry merged 3 commits into
masterfrom
joey--pr-iter-completion-hook

Conversation

@joseph-sentry

@joseph-sentry joseph-sentry commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

The autofix completion hook runs for every autofix step, and it held most of the PR iteration completion logic: failing a paused iteration, reacting to the comments that triggered it, the iteration webhook, pushing the new changes and consuming queued feedback. The hook is reached through Seer's RPC endpoint, so errors raised there had no pr_iteration module anywhere in their stack trace, and a stack.module:pr_iteration search could not find them.

Move that logic into sentry.seer.autofix.pr_iteration.completion and completion_reactions. The hook now does the shared work (fetch the run, resolve the group, find the step), then forks once: a regular autofix step continues the pipeline, and a PR iteration handles its own errored run, webhook, reactions and push. The two branches share the group lookup, the completed check, the timestamps and the webhook sending.

One behavior change: a PR iteration run whose group cannot be found is now recorded with a new missing_group_id outcome and logged as an error, instead of being dropped silently. Log event names, fields and metrics are otherwise unchanged; the log lines moved with the code now come from the new modules' loggers.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 24, 2026
@joseph-sentry
joseph-sentry force-pushed the joey--pr-iter-sweep-retry branch from 4b7397f to 3e3bdf5 Compare September 24, 2026 20:23
@joseph-sentry
joseph-sentry force-pushed the joey--pr-iter-completion-hook branch from ae61921 to b5e1179 Compare September 24, 2026 20:23
@joseph-sentry
joseph-sentry force-pushed the joey--pr-iter-sweep-retry branch from 3e3bdf5 to 1e7d915 Compare September 24, 2026 20:46
@joseph-sentry
joseph-sentry force-pushed the joey--pr-iter-completion-hook branch 3 times, most recently from 5f5d6c3 to 41eb62d Compare September 25, 2026 18:03
Base automatically changed from joey--pr-iter-sweep-retry to master September 25, 2026 20:38
@joseph-sentry
joseph-sentry force-pushed the joey--pr-iter-completion-hook branch from 41eb62d to cdc7642 Compare September 25, 2026 20:38
@joseph-sentry

Copy link
Copy Markdown
Contributor Author

cursor review

@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.

Stale Bugbot comment from a previous run.

@joseph-sentry
joseph-sentry marked this pull request as ready for review September 25, 2026 22:07
@joseph-sentry
joseph-sentry requested review from a team as code owners September 25, 2026 22:07
The autofix completion hook runs for every autofix step, and it held most of the PR iteration completion logic: failing a paused iteration, reacting to the comments that triggered it, the iteration webhook, pushing the new changes and consuming queued feedback. The hook is reached through Seer's RPC endpoint, so errors raised there had no pr_iteration module anywhere in their stack trace, and a stack.module:*pr_iteration* search could not find them.

Move that logic into sentry.seer.autofix.pr_iteration.completion and completion_reactions. The hook now does the shared work (fetch the run, resolve the group, find the step), then forks once: a regular autofix step continues the pipeline, and a PR iteration handles its own errored run, webhook, reactions and push. The two branches share the group lookup, the completed check, the timestamps and the webhook sending.

One behavior change: a PR iteration run whose group cannot be found is now recorded with a new missing_group_id outcome and logged as an error, instead of being dropped silently. Log event names, fields and metrics are otherwise unchanged; the log lines moved with the code now come from the new modules' loggers.
@joseph-sentry
joseph-sentry force-pushed the joey--pr-iter-completion-hook branch from cdc7642 to a2e03f2 Compare September 29, 2026 14:23

@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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a2e03f2. Configure here.

@joseph-sentry
joseph-sentry removed this pull request from stack #125498 October 5, 2026 21:07
…etion-hook

# Conflicts:
#	src/sentry/seer/autofix/on_completion_hook.py
@sentry

sentry Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 612 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

…etion-hook

# Conflicts:
#	src/sentry/seer/autofix/on_completion_hook.py
@joseph-sentry
joseph-sentry merged commit 849b91c into master Oct 7, 2026
70 checks passed
@joseph-sentry
joseph-sentry deleted the joey--pr-iter-completion-hook branch October 7, 2026 16:51

This branch was successfully deployed

1 active deployment
Preview — 80557fcd Deployed Oct 7, 2026 by vercel[bot]
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