feat(seer): Allow max candidate override on admin night shift trigger#113222
Merged
feat(seer): Allow max candidate override on admin night shift trigger#113222
Conversation
Add a triage strategy registry plus a new `seer.night_shift.default_strategy` option so we can swap strategies (e.g. future `agentic_triage_v3`) without a deploy. The cron resolves strategy and max_candidates from options; the admin trigger endpoint can override both per-call for easier testing. Also fix `seer.night_shift.issues_per_org`, which was dormant and drifting (option default was 5, hardcoded cap was 10). The option is now actually read and defaults to 10. Admin endpoint validates unknown strategies (400) and clamps max_candidates to [1, 50].
The clamp was defensive against accidental huge batches, but this is a staff-only testing surface where silently rewriting the input is more confusing than helpful. Non-integer values still 400.
Swapping the prod default strategy is a code-and-deploy operation in practice; an options-automator knob is overkill for a single-entry registry today. The per-call admin override is enough for testing, and a future strategy change still updates DEFAULT_TRIAGE_STRATEGY.
StrEnum keeps the registry/default wired to a single source of truth so future strategy additions stop being magic-string edits. Values remain plain strings at every boundary (HTTP, DB, logs).
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a626c6a. Configure here.
With a single strategy today, the registry/enum/resolver is scaffolding for a need that doesn't exist. Revert to calling agentic_triage_strategy directly and keep only the max_candidates admin override, which is the actual testing pain point. Multi-strategy support can be added in the same PR that introduces the second strategy.
Mirrors the admin endpoint override so local runs can test with a smaller batch without twiddling the seer.night_shift.issues_per_org option.
Without validation, a negative `max_candidates` hits Python slice semantics in `fixability_score_strategy` (e.g. `candidates[:-1]` returns all but the last), which processes far more candidates than intended. Reject `< 1` at the admin endpoint (400) and in the CLI's argparse type.
`x in (None, "")` doesn't narrow the type, so int(x) was flagged as `Any | None` incompatible. Split into an explicit `is None` check.
JoshFerge
approved these changes
Apr 16, 2026
trevor-e
added a commit
that referenced
this pull request
Apr 16, 2026
Adds a max candidates input to sentry.io/_admin/seer/ so we can test the night shift flow with a smaller batch than the production default. - Number input (min 1). Leave blank to use the backend default. - Value is omitted from the POST body when unset so the backend falls back to `seer.night_shift.issues_per_org`. Depends on backend PR #113222.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Lets staff override the candidate cap from sentry.io/_admin/seer/ so testing the night shift flow no longer forces the full production batch.
run_night_shift_for_organd the admin trigger endpoint accept an optionalmax_candidateskwarg.seer.night_shift.issues_per_org(now 10, was dormant — registered at 5 but the real cap was a hardcoded 10 insimple_triage.py).max_candidatesreturns 400.Frontend PR #113223 adds the input to the admin page.