Skip to content

feat(autofix): Trigger process autofix updates in explorer autofix#108389

Merged
Zylphrex merged 3 commits intomasterfrom
txiao/feat/trigger-process-autofix-updates-in-explorer-autofix
Feb 18, 2026
Merged

feat(autofix): Trigger process autofix updates in explorer autofix#108389
Zylphrex merged 3 commits intomasterfrom
txiao/feat/trigger-process-autofix-updates-in-explorer-autofix

Conversation

@Zylphrex
Copy link
Copy Markdown
Member

This ensures that process_autofix_updates is properly called so that the slack integration will continue to work. More work is needed to properly handle the changes but this is the starting point.

This ensures that process_autofix_updates is properly called so that the slack
integration will continue to work. More work is needed to properly handle the
changes but this is the starting point.
@Zylphrex Zylphrex requested a review from leeandher February 17, 2026 21:50
@Zylphrex Zylphrex requested a review from a team as a code owner February 17, 2026 21:50
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 17, 2026
logger.exception(
"autofix.on_completion_hook.webhook_invalid_event_type",
extra={"event_type": event_type},
)
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.

Narrow exception handler can crash pipeline on async failures

High Severity

The except ValueError only catches enum conversion errors, but SeerOperator.has_access() and process_autofix_updates.apply_async() are also inside the same try block and can raise other exceptions (e.g., broker connection errors, database errors). In on_completion_hook.py, an uncaught exception propagates out of _send_step_webhook, which is called without a try/except in execute(), preventing _maybe_continue_pipeline and _maybe_trigger_supergroups_embedding from running — stalling the entire autofix pipeline. In autofix_agent.py, it prevents return run_id from executing.

Additional Locations (1)

Fix in Cursor Fix in Web

group_id = state.metadata.get("group_id") if state.metadata else None
if group_id is not None:
webhook_payload["group_id"] = group_id

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.

Schema mismatch for Slack webhook payloads

High Severity

The Explorer autofix completion hook sends artifact data using Explorer schemas (e.g., root_cause with one_line_description, five_whys, reproduction_steps) but the Slack integration expects different schemas (description and steps with title fields). This causes the Slack integration to receive empty or incorrectly structured data, breaking the autofix updates mentioned in the PR description.

Fix in Cursor Fix in Web

group_id = state.metadata.get("group_id") if state.metadata else None
if group_id is not None:
webhook_payload["group_id"] = group_id

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.

Slack integration crashes on None artifact data

High Severity

When an artifact has data=None, line 117 adds None to the webhook payload. The Slack entrypoint expects a dict and calls .get() on it (e.g., root_cause.get("description", "")). Since dict.get(key, default) returns the actual value when the key exists (even if None), not the default, this causes AttributeError: 'NoneType' object has no attribute 'get', crashing the Slack integration webhook processing.

Fix in Cursor Fix in Web


group.update(seer_autofix_last_triggered=timezone.now())

# Send "started" webhook after we have the run_id
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.

Missing group_id for manual runs breaks Slack integration

High Severity

When trigger_autofix_explorer is called with stopping_point=None (manual runs), group_id is not stored in metadata. The "started" webhook includes group_id directly from the group object, but "completed" webhooks from on_completion_hook try to extract group_id from metadata. When missing, process_autofix_updates receives a payload without group_id, fails the if not run_id or not group_id check, and records "missing_identifiers", breaking the Slack integration for manual autofix runs.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment on lines +209 to +216
if SeerOperator.has_access(organization=group.organization):
process_autofix_updates.apply_async(
kwargs={
"event_type": sentry_app_event_type,
"event_payload": payload,
"organization_id": group.organization.id,
}
)
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: The call to process_autofix_updates is gated by SeerOperator.has_access(), which intentionally returns False for explorer autofix organizations, preventing the new functionality from ever running.
Severity: HIGH

Suggested Fix

Remove the if SeerOperator.has_access(organization=group.organization): check that wraps the process_autofix_updates.apply_async() call. This check is designed for the legacy autofix system and incorrectly blocks the new explorer autofix pipeline from using this function.

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/autofix/autofix_agent.py#L209-L216

Potential issue: The functions `trigger_autofix_explorer` and `on_completion_hook` are
intended to support the explorer autofix pipeline. They now call
`process_autofix_updates` to enable Slack integrations for this pipeline. However, this
call is gated by `SeerOperator.has_access()`, which is explicitly designed to return
`False` for any organization with the `organizations:autofix-on-explorer` feature flag
enabled. As a result, `process_autofix_updates` will never be executed for the intended
explorer autofix use case, causing the feature to fail silently for all targeted
organizations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is correct but will be addressed in a future PR

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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

"event_payload": payload,
"organization_id": group.organization.id,
}
)
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.

has_access guard blocks explorer autofix updates entirely

High Severity

SeerOperator.has_access explicitly returns False when the organizations:autofix-on-explorer feature flag is enabled (see operator.py line 84). Since trigger_autofix_explorer is only called for organizations with that flag, the process_autofix_updates.apply_async call is unreachable dead code for its intended use case. The Slack integration this PR aims to enable will never fire for explorer autofix organizations.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is correct but will be addressed in a future PR

@Zylphrex Zylphrex merged commit b14309f into master Feb 18, 2026
77 checks passed
@Zylphrex Zylphrex deleted the txiao/feat/trigger-process-autofix-updates-in-explorer-autofix branch February 18, 2026 16:52
mchen-sentry pushed a commit that referenced this pull request Feb 24, 2026
…108389)

This ensures that process_autofix_updates is properly called so that the
slack integration will continue to work. More work is needed to properly
handle the changes but this is the starting point.
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

claude-code-assisted 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