Skip to content

feat(seer): Rename agentic_triage_v2 to scheduled_investigation - #132182

Draft
trevor-e wants to merge 47 commits into
masterfrom
claude/project-thread-m5jbyn
Draft

trevor-e wants to merge 47 commits into
masterfrom
claude/project-thread-m5jbyn

Conversation

@trevor-e

@trevor-e trevor-e commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Renames the agentic_triage_v2 strategy to scheduled_investigation, so one strategy covers every cron automation. Migration 0050 renames existing configs, including their seeded_default marker.

trevor-e and others added 30 commits November 6, 2026 12:03
Add a schedule spec and a run definition to automation configs, a table that records each saved version of a config, and source and version columns on runs. A post-deployment migration adds a unique index allowing one active scheduled or manual run per config, and an index on active runs.
Seer automations were built on a SeerWorkflow base class with a subclass per kind. Each subclass mixed how runs start, which projects they cover and what Seer does, and each had its own copy of run admission, with its own config locking.

Replace the subclasses with composition. A WorkflowDefinition pairs a trigger with an action, and a config's strategy picks the pairing. Admission (dedupe, quota, run creation) lives once on the definition and takes the config lock once. Each trigger's code, including the entry point that receives its firings, is in one module: metric_alert.py and schedule.py.

Triggers and actions declare the settings they take, validated on create and update. Settings are kept in the config's extras for now. Runs are created through SeerWorkflowRunLifecycle.

Remove the monitor cleanup test automation, its trigger endpoint, and the older run helpers that only it used.
_create_config was shared by two creation paths. With a single create it only added indirection.
Restore the monitor cleanup automation and the run helpers it uses so their removal can be reviewed as its own change.
A metric automation created with no monitors had no backing alert workflow until a monitor selection was first saved. Create it with the automation so every metric automation has one.
Leave the cadence task and its tests in their existing files so the refactor does not also move them.
…ow-trigger-action

# Conflicts:
#	tests/sentry/seer/workflows/test_scheduled.py
Leave the metric alert trigger in breached_metrics.py so the refactor shows as edits to the existing file.
Overload create per strategy so a project selection on a metric automation, or a monitor selection on a scheduled one, is a type error. The configs endpoint branches on the strategy it was sent so each call matches an overload.
…tion' into claude/rebase-pr-130257-composition-722423
…columns

The composition structure already stores the schedule and prompt in the
config's trigger and action settings, so drop the schedule_spec and
definition columns and snapshot those settings in each version instead.
Schedule settings gain a timezone, which the cron schedule is evaluated in.
The run constraints follow the precedent of 0031, which added a partial
unique constraint on this table in a normal migration.
Adding SeerWorkflowConfigVersion.config after CreateModel made it a NOT NULL column added to an existing table, which the migration safety check rejects. Define it and the (config, version) constraint in CreateModel instead.
WorkflowTrigger, WorkflowAction and WorkflowDefinition read as workflow engine models next to the Workflow and Action imports they sit beside. They are in-memory interfaces for Seer automations, so name them AutomationTrigger, AutomationAction and AutomationDefinition.
A disabled metric automation left its backing alert workflow enabled, so the workflow kept firing and the handler ignored each breach. Sync the workflow's enabled state to the config's on every save.

Also reword the monitor selection error so it no longer names a specific automation type.
Also note the open question of recording a rejected run per trigger while an automation stays over quota.
A trigger that reached a paused automation was ignored with the same reason as a deleted or mismatched config. Give it its own reason on both the scheduled and metric breach paths.
schedule.py and scheduled.py were easy to confuse. Keep the scheduled automation's trigger, action and cadence task in one module, as breached_metrics.py does for metric automations.
…sentry/sentry into telkins/seer-automation-schedule-schema

# Conflicts:
#	src/sentry/seer/workflows/schedule.py
#	tests/sentry/seer/workflows/test_schedule.py
# Conflicts:
#	src/sentry/seer/endpoints/organization_seer_workflow_configs.py
#	src/sentry/seer/endpoints/organization_seer_workflow_runs.py
#	src/sentry/seer/workflows/base.py
#	src/sentry/seer/workflows/breached_metrics.py
#	src/sentry/seer/workflows/scheduled.py
#	src/sentry/seer/workflows/workflow.py
#	tests/sentry/seer/endpoints/test_organization_seer_workflow_configs.py
#	tests/sentry/seer/workflows/test_breached_metrics.py
#	tests/sentry/seer/workflows/test_scheduled.py
#	tests/sentry/seer/workflows/test_workflow.py
…r-automation-schedule-schema

# Conflicts:
#	migrations_lockfile.txt
…r-automation-schedule-schema

# Conflicts:
#	migrations_lockfile.txt
#	src/sentry/seer/models/workflow.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scheduled investigations run a user's prompt or a Seer skill on their own
cron, and the config API reads and writes those trigger and action settings.
The seeded default runs the night shift skill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NeY8PoZQQx27YxJCzBdZam
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 23, 2026

@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.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/seer/workflows/scheduled.py Resolved
Scheduled runs never started, so no run snapshot records it, and 0050
renames every config that used it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	tests/sentry/seer/workflows/test_scheduled.py
#	tests/sentry/seer/workflows/test_workflow.py
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/seer/migrations/0049_add_seerworkflowrun_source.py src/sentry/seer/migrations/0050_rename_agentic_triage_v2.py

for 0049_add_seerworkflowrun_source in seer

--
-- Add field source to seerworkflowrun
--
ALTER TABLE "seer_nightshiftrun" ADD COLUMN "source" varchar(256) NULL;

for 0050_rename_agentic_triage_v2 in seer

--
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL

…iage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from telkins/seer-automation-schedule-schema to master November 23, 2026 19:43
No configs use agentic_triage_v2, so the rename needs no data migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 using default effort 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 7128742. Configure here.

Comment thread src/sentry/seer/models/workflow.py Resolved
Prompt and skill settings and the config API's settings fields move to their own PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

decision-model-linter

api

src/sentry/seer/workflows/workflow.py

  • warn makesExistingInputStricter = TRUE (0.88): Rejecting input an endpoint accepted before, or changing a field's default, breaks existing callers, and the API spec often doesn't show it. Make the change backward compatible (keep the field optional, accept the old values, or keep the old default), or treat it as a breaking change and coordinate it.

decision-model-linter: 27 calls on 6 files, 57,072 input tokens, $0.0024, model typesafe/jev-1.13-20260917

…estigation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


def rename_agentic_triage_v2(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
SeerWorkflowConfig = apps.get_model("seer", "SeerWorkflowConfig")

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.

There was only 1 active right now but figured would do a data migration anyway since it's trivial.

…tion test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active (outdated) deployment
Preview — 7128742f Deployed Nov 23, 2026 by vercel[bot]
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