Repository navigation
Conversation
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
…tion-schedule-schema
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sentry/sentry into claude/project-thread-m5jbyn
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
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # migrations_lockfile.txt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This PR has a migration; here is the generated SQL for for --
-- Add field source to seerworkflowrun
--
ALTER TABLE "seer_nightshiftrun" ADD COLUMN "source" varchar(256) NULL;for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
…iage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No configs use agentic_triage_v2, so the rename needs no data migration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
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>
decision-model-linterapi
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") |
There was a problem hiding this comment.
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>

Renames the
agentic_triage_v2strategy toscheduled_investigation, so one strategy covers every cron automation. Migration 0050 renames existing configs, including theirseeded_defaultmarker.