Skip to content

ref(seer): Move seer automation guards into the task - #121462

Open
chromy wants to merge 2 commits into
masterfrom
chromy/2026-08-06-move-seer-automation-guards-into-task
Open

ref(seer): Move seer automation guards into the task#121462
chromy wants to merge 2 commits into
masterfrom
chromy/2026-08-06-move-seer-automation-guards-into-task

Conversation

@chromy

@chromy chromy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Currently the post process step: kick_off_seer_automation:

  • Does some work to decide if an issue is eligible
  • If it is, spawns a task to do some of that work

This reorganizes the code to:

  • Always spawn the task.
  • The first thing the task does is check if it is eligible and early out if not.

We trade "always doing some work" in the hot path for "always spawning a task" in the hot path.

This came up as part of inc-2410. It seems like is_seer_seat_based_tier_enabled (which is called to
check eligibility) slowed down - this broke ingestion.

The killswitch is left in the initial call.

chromy added 2 commits August 6, 2026 17:46
`kick_off_seer_automation` runs inline in post-process for every event, so
all of its eligibility work (org tier lookup, group fields, cache read,
lock check, rate limiting) was on the hot path. Move that into
`generate_summary_and_run_automation` and leave only the killswitch check
plus the task dispatch in post-process.

The killswitch previously only guarded the seat-based path; it now short
circuits the whole step, which is the only thing left outside the task.

`kick_off_seer_automation` is the sole caller of the task, so no other
entry point picks up the new guards.
The moved guards' imports don't need to be function-local, so lift the whole set of sentry.seer.autofix imports (including the ones the other tasks in this module were importing locally) to the top of the file. Retargets the one test patch that relied on the late binding.
@chromy
chromy marked this pull request as ready for review August 6, 2026 17:01
@chromy
chromy requested review from a team as code owners August 6, 2026 17:01
@linear-code

linear-code Bot commented Aug 6, 2026

Copy link
Copy Markdown

INC-2410

@cursor cursor Bot left a comment

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.

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 700cc3a. Configure here.

bulk_read_preferences_from_sentry_db,
get_org_default_seer_automation_handoff,
get_seer_seat_based_tier_cache_key,
is_seer_seat_based_tier_enabled,

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.

Seat-based guard tests patch stale target

Low Severity

The seat-based guards moved out of kick_off_seer_automation, but the tests covering them still patch sentry.seer.autofix.utils.is_seer_seat_based_tier_enabled and exercise post-process. Since sentry.tasks.seer.autofix binds that name at import time, the patch no longer reaches the relocated logic, so those tests pass without validating the guards, leaving the new task-side behavior uncovered.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 700cc3a. Configure here.

@Mihir-Mavalankar Mihir-Mavalankar left a comment

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.

We need to just find a way to remove issue summary and fiability from this hot path. I think that is the better long term solution.

return

generate_summary_and_run_automation.delay(group.id, trigger_path="old_seer_automation")
generate_summary_and_run_automation.delay(

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.

This will break taskbroker. AFAIK this line of code is called for every event in every issue and so it will spawn a task for every event in every issue.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 6, 2026
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