ref(autofix): Gate manual PR iteration behind its own feature flag - #121180
Merged
alexsohn1126 merged 3 commits intoAug 4, 2026
Merged
Conversation
alexsohn1126
marked this pull request as ready for review
August 4, 2026 16:24
`organizations:autofix-pr-iteration` currently gates both manual and automated CI PR iteration, so the automated flow can't ship without also exposing the manual one. Add `organizations:autofix-pr-iteration-manual` and move the human-triggered entry points onto it: - the `pr_iteration` POST case and the `pr_iteration_enabled` field the drawer reads - `@sentry <feedback>` PR comments and PR review triggers - the "Comment `@sentry ...`" PR description footer - the completion 👀->🎉 reaction swap `trigger_autofix_agent` and the `enable_pr_context_tools` check are shared by both flows — automated CI iteration reaches them via the check_suite listener — so those accept either flag rather than moving. The automated CI entry point keeps using `autofix-pr-iteration`; its sub-features already have their own flags. Frontend follows in a separate PR.
…ated flag The `feature_disabled` tests relied on both flags defaulting off, so they passed even with the manual gate mutated to also accept `autofix-pr-iteration` — i.e. they never verified the decoupling this change is for. Turn the automated flag *on* in each, so the assertion is "automated CI iteration does not grant manual iteration". Verified by mutation: with each manual gate widened to accept either flag, all five of these tests now fail.
The previous commit repointed the `pr_iteration_enabled` response field at the manual flag, silently redefining what an existing API field means for its consumers. Restore its original meaning and add `manual_pr_iteration_enabled` alongside it, so each flow reports its own state. The POST gate for `step="pr_iteration"` stays on the manual flag: it's only reachable from the drawer feedback form, and automated CI iteration enters via the check_suite listener rather than this endpoint. `test_get_reports_iteration_flags_independently` pins all four flag combinations; verified by mutation that it fails if the two fields are sourced from the same flag.
alexsohn1126
force-pushed
the
alexsohn/cw-1778/disable-manual-pr-iteration-by-another-feature-flag-backend
branch
from
August 4, 2026 17:47
daf360a to
5f0ac58
Compare
joseph-sentry
approved these changes
Aug 4, 2026
alexsohn1126
deleted the
alexsohn/cw-1778/disable-manual-pr-iteration-by-another-feature-flag-backend
branch
August 4, 2026 20:22
alexsohn1126
added a commit
that referenced
this pull request
Aug 4, 2026
…#121189) Frontend half of CW-1778. Depends on #121180 (backend) for the new flag registration — land that first. `autofix-pr-iteration` gates both manual and automated CI PR iteration, so automated CI iteration can't ship without also exposing the manual UI. The backend PR added `organizations:autofix-pr-iteration-manual`; this moves the user-driven affordances onto it. current ui when manual feature flag is of -- you can still see the automatic iterations in the form of feedback, but we removed the form to trigger the iteration with a manual feedback. <img width="824" height="632" alt="image" src="https://github.com/user-attachments/assets/f76f7b83-1c48-4584-ac33-a10549135be1" /> with the manual flag -- show manual feedback form again: <img width="823" height="722" alt="image" src="https://github.com/user-attachments/assets/16b13200-d6c2-4342-aad7-0b304f44bc95" /> Fixes [CW-1778](https://linear.app/getsentry/issue/CW-1778/disable-manual-pr-iteration-by-another-feature-flag)
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.
Backend half of CW-1778. Frontend follows in a separate PR (
static/andsrc/aren't atomically deployed); this lands first.Why
organizations:autofix-pr-iterationcurrently gates both manual and automated CI PR iteration. That means we can't roll out automated CI iteration without also exposing the manual flow. This addsorganizations:autofix-pr-iteration-manual(api_expose=True, the frontend needs it) and moves the human-triggered entry points onto it, leaving automated CI iteration on the existing flag.Moved to
-manualgroup_ai_autofix.py:358pr_iterationPOST gate — only reachable from the drawer feedback form; automated CI iteration enters via the check_suite listener, not this endpointpr_iteration/mention.py:88@sentry <feedback>PR comment triggerpr_iteration/listeners/review.py:145autofix_agent.py:887@sentry <feedback>…" PR description footeron_completion_hook.py:252Accepts either flag
Two sites sit on the shared path and would have broken automated CI iteration if moved outright — the check_suite listener reaches both via
trigger_consume_pr_iteration_feedback->trigger_autofix_agent(step=PR_ITERATION):autofix_agent.py:416—pr_iteration_enabled, which raisesPrIterationNotEnabledExceptionfor anyPR_ITERATIONstepagent/client.py:359— theenable_pr_context_toolspermission check, set fromis_iteration_stepfor both flowsNew response field
pr_iteration_enabledkeeps its existing meaning (automated CI iteration). Manual state is reported by a new additive field,manual_pr_iteration_enabled, rather than by redefining the old one — an unread field today is one a future reader would misinterpret.test_get_reports_iteration_flags_independentlypins all four flag combinations.Unchanged
The automated CI entry point (
pr_iteration/listeners/check_suite.py) has noautofix-pr-iterationcheck of its own; its sub-features already use separate flags (-review-request,-cap-assign).Rollout
Orgs currently on
autofix-pr-iterationkeep automated CI iteration and lose manual iteration untilautofix-pr-iteration-manualis enabled for them — enable the new flag for the existing org set before/with this deploy to keep behavior identical. Flagpole YAML lives insentry-options-automator.Tests
Manual-gate tests moved to the new flag. Three things worth calling out, each verified by mutation testing rather than assumed — in every case I widened the gate back to the coupled behavior and confirmed the test fails:
feature_disabledtests were vacuous. They relied on both flags defaulting off, so they passed even with a manual gate mutated to also acceptautofix-pr-iteration. Each now turns the automated flag on while manual is off, so the assertion is "automated CI iteration does not grant manual iteration."test_skips_*tests are load-bearing, not churn. Left on the old flag, the feature check short-circuits ahead of the condition each test targets:test_skips_when_not_iterate_commandstill passes when fed a valid@sentry fix itbody, because the disabled feature is what stops dispatch. Swapping the flag is what keeps those assertions meaningful.New coverage:
test_pr_iteration_enabled_by_either_flag— neither flag raisesPrIterationNotEnabledException; each flag alone enables the step. This exception had no coverage before.test_client_init_succeeds_when_manual_pr_ctx_tools_flag_enabled— PR context tools under the manual flag; the existing old-flag test now pins the automated path.test_get_reports_iteration_flags_independently— all four flag combinations for the two response fields.274 passedacross the touched files. 6 unrelated failures intest_issue_search.py/test_coding_agent_handoffs.pyreproduce identically on a cleanmastertree (verified viagit stash).refs CW-1778