Skip to content

fix(seer): Branch trigger_handoff on autofix-on-explorer flag#114360

Merged
leeandher merged 3 commits intomasterfrom
leander/fix-trigger-handoff-explorer-state-mismatch
Apr 30, 2026
Merged

fix(seer): Branch trigger_handoff on autofix-on-explorer flag#114360
leeandher merged 3 commits intomasterfrom
leander/fix-trigger-handoff-explorer-state-mismatch

Conversation

@leeandher
Copy link
Copy Markdown
Member

@leeandher leeandher commented Apr 29, 2026

  • trigger_handoff always called get_autofix_state (autofix endpoint), but when autofix-on-explorer is enabled the cached run_id is an explorer-type run, causing a StateTypeMismatchError and 500 from seer.
  • this branches on the feature flag to use fetch_run_status (explorer endpoint) when enabled, matching how trigger_autofix already works, and adds test coverage for the explorer path.

Fixes SENTRY-5P7A

image

trigger_handoff always called get_autofix_state which hits the autofix
state endpoint. When autofix-on-explorer is enabled, the run_id is an
Explorer-type run, causing a StateTypeMismatchError from Seer.

Branch on the organizations:autofix-on-explorer flag to use
fetch_run_status (explorer endpoint) when enabled, matching how
trigger_autofix already branches. The dedup check works for both
state types since they share the same status values.

Fixes SENTRY-5P7A
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 29, 2026
@leeandher leeandher marked this pull request as ready for review April 29, 2026 20:26
@leeandher leeandher requested a review from a team as a code owner April 29, 2026 20:26
@leeandher leeandher requested a review from alexsohn1126 April 29, 2026 20:27
Comment thread tests/sentry/seer/entrypoints/test_operator.py Outdated
cursor[bot]

This comment was marked as outdated.

The multiline @patch decorator with side_effect was missed by the
earlier replace_all, leaving it patching the source module instead of
the import site in operator.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@alexsohn1126 alexsohn1126 left a comment

Choose a reason for hiding this comment

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

✅️

SeerOperatorCompletionHook.execute had its own local import of
fetch_run_status, bypassing the module-level import. Tests mock at the
module level, so the local import caused them to hit the real endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@leeandher leeandher merged commit ad3e889 into master Apr 30, 2026
61 checks passed
@leeandher leeandher deleted the leander/fix-trigger-handoff-explorer-state-mismatch branch April 30, 2026 14:35
cleptric pushed a commit that referenced this pull request May 5, 2026
- `trigger_handoff` always called `get_autofix_state` (autofix
endpoint), but when `autofix-on-explorer` is enabled the cached `run_id`
is an explorer-type run, causing a `StateTypeMismatchError` and 500 from
seer.
- this branches on the feature flag to use `fetch_run_status` (explorer
endpoint) when enabled, matching how `trigger_autofix` already works,
and adds test coverage for the explorer path.

Fixes SENTRY-5P7A

<img width="452" height="171" alt="image"
src="https://github.com/user-attachments/assets/08d99008-91fc-4955-a3cf-eb5aad08d955"
/>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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