Skip to content

fix(seer): Handle enum deserialization in autofix tasks#110959

Draft
sentry[bot] wants to merge 2 commits intomasterfrom
seer/fix/seer-autofix-enum-deserialization
Draft

fix(seer): Handle enum deserialization in autofix tasks#110959
sentry[bot] wants to merge 2 commits intomasterfrom
seer/fix/seer-autofix-enum-deserialization

Conversation

@sentry
Copy link
Contributor

@sentry sentry bot commented Mar 18, 2026

This PR addresses the NoRetriesRemainingError occurring in sentry.tasks.autofix.trigger_autofix_from_issue_summary, which was caused by an AttributeError: 'str' object has no attribute 'value'.

Problem:
When AutofixStoppingPoint and AutofixReferrer enum instances are passed as parameters to the _trigger_autofix_task Celery task, the Celery serialization process converts these enums into their string representations (e.g., 'root_cause'). Upon deserialization, the task receives these parameters as plain strings, not as StrEnum objects. Downstream functions, such as trigger_autofix_explorer, then attempt to access the .value attribute on these string objects, leading to an AttributeError.

Solution:

  1. Updated _trigger_autofix_task signature: Modified the type annotations for stopping_point and referrer parameters in src/sentry/seer/autofix/issue_summary.py to AutofixStoppingPoint | str | None and AutofixReferrer | str respectively. This clarifies that the task can receive these parameters as either enum instances or their string values after deserialization.
  2. Enum Reconstruction: Added logic at the beginning of the _trigger_autofix_task function to explicitly convert stopping_point and referrer back into their respective StrEnum types if they are received as strings. This ensures that by the time these parameters are used by downstream functions, they are always proper enum instances.

This fix ensures that the task correctly handles the deserialization of enum parameters, preventing the AttributeError and the subsequent task retry exhaustion.

Fixes SENTRY-5AYM

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 Mar 18, 2026
@Zylphrex Zylphrex added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Mar 18, 2026
@Mihir-Mavalankar
Copy link
Contributor

Mihir-Mavalankar commented Mar 18, 2026

Not sure why this only affects automations you org though.

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 Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants