Skip to content

ref(autofix): Remove the organizations:autofix-on-explorer feature flag#116165

Open
chromy wants to merge 2 commits into
masterfrom
chromy/2026-05-26-remove-autofix-on-explorer-flag
Open

ref(autofix): Remove the organizations:autofix-on-explorer feature flag#116165
chromy wants to merge 2 commits into
masterfrom
chromy/2026-05-26-remove-autofix-on-explorer-flag

Conversation

@chromy
Copy link
Copy Markdown
Contributor

@chromy chromy commented May 26, 2026

Summary

Third in a stack (follow-up to #116162 and #116164). The organizations:autofix-on-explorer flag is now true everywhere, so this PR removes it.

  • Drop the flag registration from temporary.py.
  • Collapse every features.has("organizations:autofix-on-explorer", ...) check to the True branch:
    • search/snuba/backend.py — always use the seer_explorer_autofix_last_triggered column
    • seer/autofix/issue_summary.py — always route to trigger_autofix_agent; remove the legacy fallback
    • seer/agent/client_utils.py — gate only on organizations:seer-explorer (collapse the dual-flag batch_has to a single features.has)
    • seer/entrypoints/operator.pytrigger_autofix always calls the agent path; trigger_handoff always fetches via fetch_run_status
  • Delete the trigger_autofix_legacy method on SeerAutofixOperator (no callers remain) and its dead legacy imports.
  • Tests: drop the legacy-path tests in test_operator.py, rename the no-longer-distinguished explorer tests, and de-flag the remaining tests.

Net: 9 files changed, 42 insertions, 667 deletions.

Agent transcript: https://claudescope.sentry.dev/share/XIAoRxeHQ-AT-i3eUi_fVXryk-kKsNjn_0qaxBkUXqE

@chromy chromy requested review from a team as code owners May 26, 2026 10:59
Comment on lines 208 to 214
if not has_access:
return False, error

feature_names = [
# Access to seer agent
"organizations:seer-explorer",
# Access to seer agent powered autofix
"organizations:autofix-on-explorer",
]

batch_features = features.batch_has(
feature_names,
organization=organization,
actor=actor,
)

if batch_features is None:
return False, "Feature flag not enabled"

org_features = batch_features.get(f"organization:{organization.id}", {})
if not any(bool(org_features.get(feature_name)) for feature_name in feature_names):
if not features.has("organizations:seer-explorer", organization, actor=actor):
return False, "Feature flag not enabled"

# Check open team membership (the agent requires this for context)
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.

Bug: Removing the organizations:autofix-on-explorer flag check will revoke Seer agent access for organizations that don't also have the organizations:seer-explorer flag enabled.
Severity: HIGH

Suggested Fix

Before removing the check for the organizations:autofix-on-explorer flag, verify that all organizations with this flag also have the organizations:seer-explorer flag enabled. Alternatively, run a migration script to enable seer-explorer for all organizations that currently have autofix-on-explorer set to true.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/seer/agent/client_utils.py#L208-L214

Potential issue: The function `has_seer_agent_access_with_detail()` is being changed to
only check for the `organizations:seer-explorer` feature flag, removing a check for the
`organizations:autofix-on-explorer` flag. Previously, access was granted if either flag
was enabled. This change will cause a regression for any organization that has
`autofix-on-explorer=True` but `seer-explorer=False`. These organizations will lose
access to Seer agent functionality, including autofix via Slack and direct API
endpoints, because the access check will now incorrectly return `False`.

Did we get this right? 👍 / 👎 to inform future reviews.

@chromy chromy force-pushed the chromy/2026-05-26-autofix-remove-legacy-deadcode branch from eace939 to 20264c4 Compare May 26, 2026 14:16
Base automatically changed from chromy/2026-05-26-autofix-remove-legacy-deadcode to master May 26, 2026 15:01
This flag is now fully rolled out. Remove the flag registration and
collapse all call sites to take the True branch:

- `search/snuba/backend.py`: always use `seer_explorer_autofix_last_triggered`
- `seer/autofix/issue_summary.py`: always route to `trigger_autofix_agent`
- `seer/agent/client_utils.py`: gate only on `organizations:seer-explorer`
- `seer/entrypoints/operator.py`: `trigger_autofix` always calls the agent
  path; the legacy handoff branch in `trigger_handoff` is removed

Drop the now-dead `trigger_autofix_legacy` method and its legacy autofix
imports. Remove the tests that exercised those dead code paths; the
remaining explorer-path tests are de-flagged and their helpers cleaned
up.

Agent transcript: https://claudescope.sentry.dev/share/4xBciP_4JyKS5m-3OPFGifbPT2RgHiyfmeiyXOGZjAo
@chromy chromy force-pushed the chromy/2026-05-26-remove-autofix-on-explorer-flag branch from 61cb923 to 2bf272c Compare May 27, 2026 10:12
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 27, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 2bf272c. Configure here.

Comment thread src/sentry/seer/entrypoints/operator.py
After removing `trigger_autofix_legacy`, `get_stopping_point_status`,
`get_latest_cause_id`, and `AUTOFIX_FALLBACK_CAUSE_ID` no longer have
any callers. Drop them along with the now-unused `AutofixState` import.

Co-Authored-By: Claude <[email protected]>

Agent transcript: https://claudescope.sentry.dev/share/lVRsatFnt9RUCKag81CcEOLGLMmYq-sL0yPvuoLgmZk
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