Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1c812c2
feat(seer): Add schema for scheduled and versioned automations
trevor-e Nov 6, 2026
ea9cf1f
ref(seer): Compose automations from a trigger and an action
trevor-e Nov 11, 2026
8ad24a6
ref(seer): Inline config creation into SeerWorkflow.create
trevor-e Nov 11, 2026
3d1f2f9
ref(seer): Keep monitor cleanup out of the automation refactor
trevor-e Nov 11, 2026
8cbe112
ref(seer): Always create a metric automation's backing workflow
trevor-e Nov 11, 2026
9f11752
ref(seer): Keep the scheduled entry point in scheduled.py
trevor-e Nov 11, 2026
edd7789
Merge remote-tracking branch 'origin/master' into telkins/seer-workfl…
trevor-e Nov 11, 2026
ed68b1a
ref(seer): Keep the breached_metrics module name
trevor-e Nov 11, 2026
3d1d9c9
ref(seer): Trim comments and simplify the scheduled entry point
trevor-e Nov 12, 2026
a0a94a8
ref(seer): Tie each strategy to its scope type in SeerWorkflow.create
trevor-e Nov 12, 2026
fd5be74
Merge remote-tracking branch 'origin/telkins/seer-workflow-trigger-ac…
trevor-e Nov 12, 2026
4efcd11
ref(seer): Version trigger and action settings instead of new config …
trevor-e Nov 12, 2026
b910825
ref(seer): Combine the automation schema migrations into one
trevor-e Nov 12, 2026
d97da22
fix(seer): Create the config version foreign key with its table
trevor-e Nov 12, 2026
4f7a0ce
ref(seer): Rename trigger and action interfaces to Automation*
trevor-e Nov 12, 2026
bacd1b0
fix(seer): Pause a metric automation's alert workflow with it
trevor-e Nov 12, 2026
b55b4ef
ref(seer): Return parsed settings from validate_settings
trevor-e Nov 12, 2026
0264fe7
ref(seer): Report a disabled automation as config_disabled
trevor-e Nov 13, 2026
39008ad
ref(seer): Merge the schedule trigger into scheduled.py
trevor-e Nov 13, 2026
c5832ea
Merge branch 'telkins/seer-workflow-trigger-action' of github.com:get…
trevor-e Nov 13, 2026
2c6e190
Merge commit 'f4d4dce3fe5' into telkins/seer-automation-schedule-schema
trevor-e Nov 13, 2026
4461a35
Merge branch 'master' of github.com:getsentry/sentry into telkins/see…
trevor-e Nov 18, 2026
6b95fab
Merge branch 'master' of github.com:getsentry/sentry into telkins/see…
trevor-e Nov 19, 2026
f0a5003
Merge remote-tracking branch 'origin/master' into telkins/seer-automa…
trevor-e Nov 19, 2026
9f3202e
feat(seer): Add schema for scheduled and versioned automations
claude Nov 23, 2026
38f9ed5
feat(seer): Add schema for scheduled and versioned automations
claude Nov 23, 2026
a01c4d8
Merge branch 'claude/project-thread-m5jbyn' of https://github.com/get…
claude Nov 23, 2026
5dd47b3
feat(seer): Rename agentic_triage_v2 to scheduled_investigation
claude Nov 23, 2026
913e509
Merge remote-tracking branch 'origin/master' into schema-update
claude Nov 23, 2026
e60a26c
Merge the schema branch
claude Nov 23, 2026
3316912
ref(seer): Drop the agentic_triage_v2 strategy value
claude Nov 23, 2026
f414a7d
ref(seer): Leave the one-active-run constraint for a follow-up
claude Nov 23, 2026
a30a6fd
ref(seer): Leave cron timezones for a follow-up
claude Nov 23, 2026
648e232
Merge branch 'schema-update' into claude/project-thread-m5jbyn
claude Nov 23, 2026
8b9dbae
ref(seer): Leave automation config versions for later
claude Nov 23, 2026
eda8589
Merge branch 'schema-update' into claude/project-thread-m5jbyn
claude Nov 23, 2026
9125665
ref(seer): Use the standard CharField length for run source
claude Nov 23, 2026
6a5277e
Merge branch 'schema-update' into claude/project-thread-m5jbyn
claude Nov 23, 2026
4e9d304
ref(seer): Name the seeded scheduled investigation's skill agentic_tr…
claude Nov 23, 2026
d395bb5
ref(seer): Trim comments in the scheduled investigation rename
trevor-e Nov 23, 2026
d41b5d7
Merge remote-tracking branch 'origin/master' into claude/project-thre…
claude Nov 23, 2026
abe2cc3
ref(seer): Drop the agentic_triage_v2 rename migration
claude Nov 23, 2026
7128742
Merge remote-tracking branch 'origin/master' into claude/project-thre…
claude Nov 23, 2026
5545485
ref(seer): Keep the rename PR to the strategy rename
claude Nov 23, 2026
8d361c5
ref(seer): Rename existing agentic_triage_v2 configs to scheduled_inv…
claude Nov 23, 2026
143ff2d
test(seer): Cover the agentic_triage_v2 rename migration
claude Nov 23, 2026
3a70485
test(seer): Use updated_by as the untouched extra in the rename migra…
claude Nov 23, 2026
a8ad1e4
test(seer): Skip the 0050 migration test now that it has passed
claude Nov 23, 2026
f74bc0c
test(seer): Drop the 0050 migration test after verifying it
claude Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ releases: 0004_cleanup_failed_safe_deletes

replays: 0001_squashed_0007_organizationmember_replay_access

seer: 0049_add_seerworkflowrun_source
seer: 0050_rename_agentic_triage_v2

seer_workflow_outputs: 0001_initial

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def post(self, request: Request, organization: Organization) -> Response:
created_by_id=acting_user_id(request.user),
service_account_grant=grant,
)
elif strategy is SeerWorkflowStrategy.AGENTIC_TRIAGE_V2:
elif strategy is SeerWorkflowStrategy.SCHEDULED_INVESTIGATION:
workflow = SeerWorkflow.create(
organization_id=organization.id,
strategy=strategy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ class MonitorTriggerResponse(TypedDict):


class CronTriggerResponse(TypedDict):
# TODO: Include triggeredAt (parsed from trigger_key) once cron strategies such as
# AGENTIC_TRIAGE_V2 start creating runs.
# TODO: Include triggeredAt (parsed from trigger_key) once scheduled investigations
# start creating runs.
type: Literal["cron"]


Expand Down
48 changes: 48 additions & 0 deletions src/sentry/seer/migrations/0050_rename_agentic_triage_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from django.db import migrations
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.migrations.state import StateApps

from sentry.new_migrations.migrations import CheckedMigration
from sentry.utils.query import RangeQuerySetWrapperWithProgressBar

OLD_STRATEGY = "agentic_triage_v2"
NEW_STRATEGY = "scheduled_investigation"


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.

for config in RangeQuerySetWrapperWithProgressBar(
SeerWorkflowConfig.objects.filter(strategy=OLD_STRATEGY)
):
config.strategy = NEW_STRATEGY
if config.extras.get("seeded_default") == OLD_STRATEGY:
config.extras["seeded_default"] = NEW_STRATEGY
config.save(update_fields=["strategy", "extras"])


class Migration(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# of a table.
# Here are some things that make sense to mark as post deployment:
# - Large data migrations. Typically we want these to be run manually so that they can be
# monitored and not block the deploy for a long period of time while they run.
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
# run this outside deployments so that we don't block them. Note that while adding an index
# is a schema change, it's completely safe to run the operation after the code has deployed.
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment

is_post_deployment = False

dependencies = [
("seer", "0049_add_seerworkflowrun_source"),
]

operations = [
migrations.RunPython(
rename_agentic_triage_v2,
reverse_code=migrations.RunPython.noop,
hints={"tables": ["seer_workflowconfig"]},
),
]
7 changes: 5 additions & 2 deletions src/sentry/seer/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
class SeerWorkflowStrategy(models.TextChoices):
AGENTIC_TRIAGE = "agentic_triage"
DUPLICATE_MONITORS = "duplicate_monitors"
AGENTIC_TRIAGE_V2 = "agentic_triage_v2"
BREACHED_METRIC_INVESTIGATION = "breached_metric_investigation"
SCHEDULED_INVESTIGATION = "scheduled_investigation"


# Strategies with one config per organization, found or created by get_or_create_for_strategy.
Expand All @@ -31,7 +31,10 @@ class SeerWorkflowStrategy(models.TextChoices):

# Strategies with any number of configs per organization. Each config is looked up by its id.
SEER_CONFIGURABLE_WORKFLOW_STRATEGIES = frozenset(
{SeerWorkflowStrategy.AGENTIC_TRIAGE_V2, SeerWorkflowStrategy.BREACHED_METRIC_INVESTIGATION}
{
SeerWorkflowStrategy.BREACHED_METRIC_INVESTIGATION,
SeerWorkflowStrategy.SCHEDULED_INVESTIGATION,
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
)

# Soft bound on configs per organization. Actual count could go over a bit from concurrent writes.
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/seer/workflows/scheduled.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def sync_schedule(config: SeerWorkflowConfig) -> None:
class ScheduleDefinition(AutomationDefinition[ScheduledRunInputs]):
"""Runs on the config's schedule, over the projects the config selects."""

strategy = SeerWorkflowStrategy.AGENTIC_TRIAGE_V2
strategy = SeerWorkflowStrategy.SCHEDULED_INVESTIGATION
inputs_type = ScheduledRunInputs
settings_type = ScheduleSettings
scoped_by: Literal["projects", "monitors"] = "projects"
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/seer/workflows/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

logger = logging.getLogger(__name__)

SEER_DEFAULT_WORKFLOW_STRATEGIES = (SeerWorkflowStrategy.AGENTIC_TRIAGE_V2,)
SEER_DEFAULT_WORKFLOW_STRATEGIES = (SeerWorkflowStrategy.SCHEDULED_INVESTIGATION,)


@dataclass(frozen=True, kw_only=True)
Expand Down Expand Up @@ -121,7 +121,7 @@ def create(
cls,
*,
organization_id: int,
strategy: Literal[SeerWorkflowStrategy.AGENTIC_TRIAGE_V2],
strategy: Literal[SeerWorkflowStrategy.SCHEDULED_INVESTIGATION],
enabled: bool = ...,
schedule: SeerWorkflowSchedule = ...,
scope: ProjectSelection,
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/testutils/helpers/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def create_exhaustive_organization(
seer_workflow_config = Factories.create_seer_workflow_config(
org,
service_account_id=service_account.id,
strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE_V2,
strategy=SeerWorkflowStrategy.SCHEDULED_INVESTIGATION,
filters={"environments": ["production"]},
)
Factories.create_seer_workflow_config_project(seer_workflow_config, project)
Expand Down
4 changes: 3 additions & 1 deletion tests/sentry/backup/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,9 @@ def test_export_workflow_with_service_account(self) -> None:
replica = ServiceAccountReplica.objects.get(service_account_id=account.id)
assert replica.id != account.id
config = Factories.create_seer_workflow_config(
org, strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE_V2, service_account_id=account.id
org,
strategy=SeerWorkflowStrategy.SCHEDULED_INVESTIGATION,
service_account_id=account.id,
)
Factories.create_seer_workflow_config_project(config, project)

Expand Down
14 changes: 9 additions & 5 deletions tests/sentry/backup/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,10 @@ def verify_model_inclusion(scope: ImportScope) -> None:
lambda mr: len(mr.get_possible_relocation_scopes() & scope.value) > 0
)
excluded_models = get_matching_exportable_models(
lambda mr: mr.get_possible_relocation_scopes() != {RelocationScope.Excluded}
and not (mr.get_possible_relocation_scopes() & scope.value)
lambda mr: (
mr.get_possible_relocation_scopes() != {RelocationScope.Excluded}
and not (mr.get_possible_relocation_scopes() & scope.value)
)
)

for model in included_models:
Expand Down Expand Up @@ -2536,7 +2538,7 @@ def create_workflows(self) -> SeerWorkflowConfig:
assert ServiceAccountReplica.objects.get(service_account_id=account.id).id != account.id
config = Factories.create_seer_workflow_config(
org,
strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE_V2,
strategy=SeerWorkflowStrategy.SCHEDULED_INVESTIGATION,
service_account_id=account.id,
enabled=True,
filters={"environments": ["production"]},
Expand All @@ -2546,10 +2548,12 @@ def create_workflows(self) -> SeerWorkflowConfig:
Factories.create_seer_workflow_config_project(config, project)
Factories.create_seer_workflow_config(
org,
strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE_V2,
strategy=SeerWorkflowStrategy.SCHEDULED_INVESTIGATION,
service_account_id=inactive.id,
)
Factories.create_seer_workflow_config(org, strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE_V2)
Factories.create_seer_workflow_config(
org, strategy=SeerWorkflowStrategy.SCHEDULED_INVESTIGATION
)
return config

def test_account_identity_remapped_before_replication(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def test_list_filters_by_trigger(self) -> None:
breached = self.create_notebook(organization=self.organization, title="Breached")
self.link_to_automation_run(breached)
triage = self.create_notebook(organization=self.organization, title="Triage")
self.link_to_automation_run(triage, SeerWorkflowStrategy.AGENTIC_TRIAGE_V2)
self.link_to_automation_run(triage, SeerWorkflowStrategy.SCHEDULED_INVESTIGATION)
# An automation reusing an investigation a user started doesn't make it automation-triggered.
reused = self.create_notebook(
organization=self.organization, created_by=self.user, title="Reused"
Expand All @@ -436,14 +436,16 @@ def test_list_filters_by_trigger(self) -> None:
assert self.list_titles(trigger="user") == ["Mine", "Reused", "Theirs"]
assert self.list_titles(trigger="automation") == ["Breached", "Triage"]
assert self.list_titles(strategy="breached_metric_investigation") == ["Breached"]
assert self.list_titles(trigger="automation", strategy="agentic_triage_v2") == ["Triage"]
assert self.list_titles(trigger="automation", strategy="scheduled_investigation") == [
"Triage"
]
assert len(self.list_titles()) == 6

def test_automation_trigger_uses_the_first_run_in_this_organization(self) -> None:
notebook = self.create_notebook(organization=self.organization, title="Breached")
other_organization = self.create_organization()
other_config = Factories.create_seer_workflow_config(
other_organization, strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE_V2
other_organization, strategy=SeerWorkflowStrategy.SCHEDULED_INVESTIGATION
)
Factories.create_seer_workflow_output_link(
Factories.create_seer_workflow_run_execution(
Expand All @@ -452,10 +454,10 @@ def test_automation_trigger_uses_the_first_run_in_this_organization(self) -> Non
notebook=notebook,
)
self.link_to_automation_run(notebook)
self.link_to_automation_run(notebook, SeerWorkflowStrategy.AGENTIC_TRIAGE_V2)
self.link_to_automation_run(notebook, SeerWorkflowStrategy.SCHEDULED_INVESTIGATION)

assert self.list_titles(strategy="breached_metric_investigation") == ["Breached"]
assert self.list_titles(strategy="agentic_triage_v2") == []
assert self.list_titles(strategy="scheduled_investigation") == []

def test_list_filters_by_run_status(self) -> None:
for title, run_status in (
Expand Down
Loading
Loading