Skip to content

feat(autofix): Trigger PR iteration runs and surface PR links in prompts#117216

Merged
joseph-sentry merged 4 commits into
masterfrom
joey--autofix-pr-iteration-trigger
Jun 12, 2026
Merged

feat(autofix): Trigger PR iteration runs and surface PR links in prompts#117216
joseph-sentry merged 4 commits into
masterfrom
joey--autofix-pr-iteration-trigger

Conversation

@joseph-sentry

@joseph-sentry joseph-sentry commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Add the autofix-pr-iteration feature flag and wire the trigger path for the
PR_ITERATION step. trigger_autofix_agent now persists the flag value in run
metadata on creation, computes the iteration index (from the insert index on
retry, otherwise the latest + 1), and includes it in the started webhook
payload, prompt metadata, and trigger metric. build_step_prompt threads the
run state into the prompt builders so pr_iteration_prompt can surface the open
pull request links. Adds get_latest_iteration_index, get_iteration_for_insert_index,
and recover_iteration_feedback helpers.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 9, 2026
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from 00707ec to ccbb882 Compare June 9, 2026 19:04
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-types branch from 27bba00 to 1dfa019 Compare June 9, 2026 19:04
Comment thread src/sentry/seer/autofix/autofix_agent.py
Comment thread src/sentry/seer/autofix/autofix_agent.py
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-types branch from 1dfa019 to 46d270f Compare June 10, 2026 20:25
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from ccbb882 to eed3d35 Compare June 10, 2026 20:25
Base automatically changed from joey--autofix-pr-iteration-types to master June 12, 2026 14:10
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from eed3d35 to 651fd65 Compare June 12, 2026 14:10
@joseph-sentry joseph-sentry marked this pull request as ready for review June 12, 2026 14:10
@joseph-sentry joseph-sentry requested a review from a team as a code owner June 12, 2026 14:10
Comment thread src/sentry/seer/autofix/autofix_agent.py Outdated
Comment thread src/sentry/seer/autofix/autofix_agent.py
Comment thread src/sentry/seer/autofix/autofix_agent.py
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from 651fd65 to 2f69801 Compare June 12, 2026 14:48
Comment thread src/sentry/seer/autofix/autofix_agent.py
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from 2f69801 to eed3d35 Compare June 12, 2026 15:21
@joseph-sentry joseph-sentry requested review from a team as code owners June 12, 2026 15:21

@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 eed3d35. Configure here.

Comment thread src/sentry/seer/autofix/on_completion_hook.py
Comment thread src/sentry/seer/autofix/autofix_agent.py
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from eed3d35 to 17c6766 Compare June 12, 2026 16:31
Comment thread tests/sentry/seer/autofix/test_autofix_agent.py
joseph-sentry and others added 3 commits June 12, 2026 13:06
Add the autofix-pr-iteration feature flag and wire the trigger path for the
PR_ITERATION step. trigger_autofix_agent now persists the flag value in run
metadata on creation, computes the iteration index (from the insert index on
retry, otherwise the latest + 1), and includes it in the started webhook
payload, prompt metadata, and trigger metric. build_step_prompt threads the
run state into the prompt builders so pr_iteration_prompt can surface the open
pull request links. Adds get_latest_iteration_index, get_iteration_for_insert_index,
and recover_iteration_feedback helpers.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@joseph-sentry joseph-sentry force-pushed the joey--autofix-pr-iteration-trigger branch from 17c6766 to 3d52218 Compare June 12, 2026 17:06
Replace the loose `Callable[..., str]` type on `StepConfig.prompt_fn`
with a `PromptBuilder` Protocol that captures the exact keyword
signature shared by all four step prompt builders. This lets mypy
verify the STEP_CONFIGS registry and call site, and catches signature
drift in any individual builder. No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@alexsohn1126 alexsohn1126 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@joseph-sentry joseph-sentry merged commit 4250651 into master Jun 12, 2026
85 checks passed
@joseph-sentry joseph-sentry deleted the joey--autofix-pr-iteration-trigger branch June 12, 2026 18:40
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