Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): lock a scout's pause, resume, and delete to its owner (#106109)

posthog[bot]7633cf0b7ef4
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ae2870b75b8f..acc2421e3159 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -11443,33 +11443,33 @@ snapshots:
scenes-app-inbox-scout-trials-setup--unsaved-rubric--light:
hash: v1.k794b7964.64c0d8ac04bb10ab54ff05a9c7d2efd237b622b116771aee794fa1c7af421bcc.XeqOuTw49vlR0b-89jf7K-rnc7FjBV6h-EJZoDc8Su8
scenes-app-inbox-scoutconfigform--custom-cron-schedule--dark:
- hash: v1.k794b7964.ab3f7494ddcba983ce8fa85f9bd0af8b28d6d562506795e0da265111e639f08f.M2nWzd5IXAX-0IBWrnYcHKxzMHdEx9sPYBaOpwGC6ug
+ hash: v1.k794b7964.5f16b2a4d04e486778e91d4eb789a1bd3319e5294eab554ea710100988486d8c._Dc-7uDt2LVj8PfUYrbi-vTgD2vyGpcUPlNLMrk93pI
scenes-app-inbox-scoutconfigform--custom-cron-schedule--light:
- hash: v1.k794b7964.35ad471badfaf551e64ed3a29f59c39ee4f603071ed85b834c553257772c896c.IpmDODICE3hfY6uGLDOJ4uSrtZBpUKfugh4-TZrs4sA
+ hash: v1.k794b7964.e02082db90ce9a28a66d8705e886039e49702371189084bcc1cbcc62e3f5271e.T1si3RYLe1SVK7BoeeAp5H8-zIjDmwM_0UYiYhY7PFw
scenes-app-inbox-scoutconfigform--disabled--dark:
- hash: v1.k794b7964.d476592dfe48521d83c78056e6f5e44dd9834d435244251a60b16512c7c558ab.AP0aSzZ2NfvCvD4y9STmgkZDF6990u_uqfIvahDUxFg
+ hash: v1.k794b7964.776b29163ec6e8ca08cfbd11e0d522ec3f5acbd0d311f6ce80b22cb7031989ca.4WKzemD9Lqb-USdSgAGO-7z-NkM9to10Esw5URgNbWE
scenes-app-inbox-scoutconfigform--disabled--light:
- hash: v1.k794b7964.c8d5c2be6aafeb5cb3a6855a23bd2c228689419f269a1e0c087646b4fcd4ad56.hFSJBS4WcfxWTXkzEvE0gwYP-frlke5WjXubZ1v4-aA
+ hash: v1.k794b7964.c1cb396fd505a988a78a3d995f8daae80575130eefe03490f1098f65ff3a83b3.lSMVMwfMCT_jtzaOVv6Hr8pM5mzCjU3D8OKHie_Ho7k
scenes-app-inbox-scoutconfigform--dry-run--dark:
- hash: v1.k794b7964.c18945886af43aeab5d10edb47bbb0539287388adba6a9e687284175bc1680b8.uEKjsHUynj5Q8CszhxE8xYOPC09tTSscOUzztGJyWrU
+ hash: v1.k794b7964.e6d52e09d6ffd72d86c84d8032cf8ab47c87e1a3b81e8a518db40195be1174c9.gIoJfjKmsFzEyu2P2ReCtcGOUr5Ig4RySSO4mKA3d_E
scenes-app-inbox-scoutconfigform--dry-run--light:
- hash: v1.k794b7964.e1fbf749c58c5da186f85e360c573184ef1a22a6554985676be1539b5157a868.vEJ5eWEzDFh-MebvKEdhqUhVIVfA2B_DO0UW4NJSx_Y
+ hash: v1.k794b7964.db15686714921ee32dcd9777565cbd1b692eadc5b48b3fb6852a7bf881fa7a54.1gwqOVvQefzSHxW1RQnf6NVMZqiKt5kXn831FWW4Q0g
scenes-app-inbox-scoutconfigform--live--dark:
- hash: v1.k794b7964.ce68b3b3f8153c3354f10a93ddfba752b4878bfdd601dcf464b7b29686c2cf62.GRDUSgrlQfd_zE3EOncvLpTjPoYyD57EhbsOSkkhJQY
+ hash: v1.k794b7964.d1222c0d9dce2ceea9df8b0cd8bb81be32948f107c9f10157d02edfb059ab738.RyMXcVNaZwb8Qne2Xy7viSaIWjbcOAnFjLzW3C0YQ20
scenes-app-inbox-scoutconfigform--live--light:
- hash: v1.k794b7964.324a750319e93297c10c9702087b804118f42fc4aaac49eab7dec6e7916cb9cb.lgjOHq03pb3aWwaMXGU5mXnkFWCPS7jEG1Yy6WobV7Y
+ hash: v1.k794b7964.0cb359a23c3fcbbd4cdcdaa8dc139d2d9501c4d14287ec209bb213ad0eb3a07a.H4gWFstRwwMf7dttwqfKJzPkK_njc7U77S_5yATThf4
scenes-app-inbox-scoutconfigform--slack-channel-destination--dark:
- hash: v1.k794b7964.501849958aba23ee74fc31fc55ef64487a04d21edde1a016a4874996ca113d9d.8ysgIdI7MznI26_BvWfQDUxa0y8wlZW4IZ98CFa0k04
+ hash: v1.k794b7964.f9997ddd1d470ef8fb91af92eaa17de675014831ca6046aa90628dbe89351799.3IIPPxVLzyynVQcdm1eRkB7SDMtTtzqb67aCkqUwQ-o
scenes-app-inbox-scoutconfigform--slack-channel-destination--light:
- hash: v1.k794b7964.209e7a64caf9c1d92dfffbe6d5a40b341773ed7d11497016ca0f150a460c2cab.aYOtIcBt3WkoVzuHpV2Mp4dkNRA3dHxhq7t9W8Pv2p4
+ hash: v1.k794b7964.9f6140ccbbc8b55bd07afafbf7735f77370ec35479af55c530e85a622d150141.sB6puQ6eggmTME--95tzVd1naeEOVWEGMbnaS-m1hTU
scenes-app-inbox-scoutconfigform--structured-output--dark:
- hash: v1.k794b7964.a93a2720478eb53493d559c56823b6f8aff4ad664193718d082798a126d1dc41.GKQxYjrYDo5NHBUELfUd4bYl2MMmS798-S-lk2ytJIk
+ hash: v1.k794b7964.1a197c92ab09bf0a19f35564d683fa1cc81d993451c99af1bea01a229a927b20.lfxIe4U4zVEsZr2iBXA0KYeIQwmTm3o97hUa1m7M4dA
scenes-app-inbox-scoutconfigform--structured-output--light:
- hash: v1.k794b7964.5425d38bc69b3bee0ce0ecd3699d9f8d572636f7bccee404d65281b681b72118.8SrWlOoByk1CUeYw9GEEdLJs-eebXKwtuZVnPTyueIA
+ hash: v1.k794b7964.ed3286cfb9dcd72b546458c178750237966b54b073e4ff8a5c752c208a1271b8.T-mnEkll4xTFPB8X2P9D31UcBjUxzFjnd3g3lTo8KNc
scenes-app-inbox-scoutconfigform--weekly-schedule--dark:
- hash: v1.k794b7964.fa1801a0181ef8935e9982d7c19e73f637c4fc4258f32fc3592374ade35bc055.gBTGuqpe7zj7lvtMhMSDzF1lHgrmDTuc1FiF6tuX42A
+ hash: v1.k794b7964.9b976054979f9537937ff8d76c4a9bbeaae6e35130155b092c176adc3dd759b5.XhNq5OvOC09jhiXQ2YVEj-7weqIJ2cgxrKgVoXBemf4
scenes-app-inbox-scoutconfigform--weekly-schedule--light:
- hash: v1.k794b7964.fbfb3c3846b1de0b08195046499e8fa469ee22c120e7076430316bddf367673d.YOCg2GpEsuT0bSiL57V1OD-gUp4mR1Zud2DOaE6YbJU
+ hash: v1.k794b7964.d02dc7a4dcd70d3a59ae10c83a68703bcb63c94b9cb0e74fdec82797c1ef6ba2.oUca34huG-Mr0y45QaNPzlxIcIDR1kAqxGKwyWv2lMg
scenes-app-inbox-scoutdetailview--scout-page--dark:
hash: v1.k794b7964.7994cd307f5adb384df6008caa4d535248e8e10ba5505840e7b2661704cfa054.HD73lbCqzK0mXr4mcQ7lZJdj5J5aGTd_5LtbP3TDbLU
scenes-app-inbox-scoutdetailview--scout-page--light:
diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.py
index 7827ab8eb85a..9b1878c041b7 100644
--- a/posthog/models/activity_logging/activity_log.py
+++ b/posthog/models/activity_logging/activity_log.py
@@ -474,6 +474,7 @@ field_name_overrides: dict[AuditableScope, dict[str, str]] = {
"managed_by": "managed by",
"auto_pause_exempt": "never pause for inactivity",
"write_scopes": "write access",
+ "lifecycle_locked": "owner-only pause, resume, and delete",
"allowed_mcp_tools": "allowed MCP tools",
"tool_preset": "tool preset",
},
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.ts
index e8de503abff1..68362a05bd4a 100644
--- a/products/replay_vision/frontend/generated/api.schemas.ts
+++ b/products/replay_vision/frontend/generated/api.schemas.ts
@@ -1917,6 +1917,8 @@ export interface SignalScoutConfigOptionsApi {
* @maxItems 10
*/
write_scopes?: string[]
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -2186,6 +2188,8 @@ export interface SignalScoutConfigApi {
* @maxItems 10
*/
readonly write_scopes: readonly string[]
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ readonly lifecycle_locked: boolean
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
diff --git a/products/replay_vision/frontend/generated/api.zod.ts b/products/replay_vision/frontend/generated/api.zod.ts
index 93d2937c28d5..02213e3db815 100644
--- a/products/replay_vision/frontend/generated/api.zod.ts
+++ b/products/replay_vision/frontend/generated/api.zod.ts
@@ -1034,6 +1034,12 @@ export const VisionScannersScoutsCreateBody = /* @__PURE__ */ zod
.describe(
"Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
diff --git a/products/signals/backend/apps.py b/products/signals/backend/apps.py
index c74c87f59318..523699942863 100644
--- a/products/signals/backend/apps.py
+++ b/products/signals/backend/apps.py
@@ -1,5 +1,11 @@
+from typing import TYPE_CHECKING
+
from django.apps import AppConfig
+if TYPE_CHECKING:
+ from posthog.models.team.team import Team
+ from posthog.models.user import User
+
class SignalsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
@@ -18,6 +24,7 @@ class SignalsConfig(AppConfig):
receivers.connect_task_run_assignment_sync()
self._register_signal_emission_gate()
+ self._register_scout_skill_archive_guard()
def _register_signal_emission_gate(self) -> None:
"""Let the data-import pipeline ask whether to emit signals for a source without
@@ -32,3 +39,24 @@ class SignalsConfig(AppConfig):
return emit_signals_enabled(team_id, source_type, schema_name, ai_data_processing_approved)
register_emit_signals_gate(_gate)
+
+ def _register_scout_skill_archive_guard(self) -> None:
+ """Let the skills product refuse to archive a locked scout's skill without importing this
+ one (the dependency runs the other way). Archiving is how a custom scout is removed, so a
+ lock that guarded only the config would still let a non-owner stop the scout for good.
+ The check is imported lazily so the harness stays off the django.setup() path.
+ """
+ from products.skills.backend.api.archive_guards import SkillArchiveRefused, register_skill_archive_guard
+
+ def _guard(team: "Team", skill_name: str, user: "User", authenticator: object) -> None:
+ from products.signals.backend.scout_harness.lifecycle_lock import ( # noqa: PLC0415
+ ScoutLifecycleLocked,
+ assert_can_archive_scout_skill,
+ )
+
+ try:
+ assert_can_archive_scout_skill(team=team, skill_name=skill_name, user=user, authenticator=authenticator)
+ except ScoutLifecycleLocked as err:
+ raise SkillArchiveRefused(str(err)) from err
+
+ register_skill_archive_guard(_guard)
diff --git a/products/signals/backend/facade/api.py b/products/signals/backend/facade/api.py
index 306838f8110e..ef9565bd1e97 100644
--- a/products/signals/backend/facade/api.py
+++ b/products/signals/backend/facade/api.py
@@ -1226,7 +1226,9 @@ def delete_scout_for_source(*, team: "Team", source_product: str, config_id: str
return False
with transaction.atomic():
try:
- archive_skill(team, config.skill_name)
+ # No acting user: the owning product retires its own object's scout and has already
+ # authorized that against the object, so the per-scout lifecycle lock does not apply.
+ archive_skill(team, config.skill_name, acting_user=None)
except LLMSkillNotFoundError:
pass # Already archived; the config is the orphan being cleaned up.
config.delete()
diff --git a/products/signals/backend/migrations/0170_signalscoutconfig_lifecycle_locked.py b/products/signals/backend/migrations/0170_signalscoutconfig_lifecycle_locked.py
new file mode 100644
index 000000000000..7603a4222812
--- /dev/null
+++ b/products/signals/backend/migrations/0170_signalscoutconfig_lifecycle_locked.py
@@ -0,0 +1,17 @@
+# Generated by Django 5.2.17 on 2026-09-24 16:17
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("signals", "0169_signalscoutconfig_background_backoff_level"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="signalscoutconfig",
+ name="lifecycle_locked",
+ field=models.BooleanField(db_default=False, default=False),
+ ),
+ ]
diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txt
index ad0064a5dee9..c68715458e59 100644
--- a/products/signals/backend/migrations/max_migration.txt
+++ b/products/signals/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0169_signalscoutconfig_background_backoff_level
+0170_signalscoutconfig_lifecycle_locked
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index d345e78a07b6..99c8627621f5 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -2727,6 +2727,15 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
# scout's acting user and project admins: this field decides what an unattended agent may change
# in the project. A dry run (`emit=False`) ignores it, so a preview never mutates the project.
write_scopes = models.JSONField(default=list, db_default=[])
+ # Opt-in guard on the lifecycle fields (`enabled`, `emit`, deletion, and this flag). Off by
+ # default, so the fleet keeps the plain `signal_scout:write` bar. On, only the scout's
+ # resolved acting user or a project admin may pause, resume, switch to dry run, or delete it
+ # — the same bar `write_scopes` clears, and for the same reason: a project-wide scope is held
+ # by people and by unattended agents alike, and pausing is unbounded while resuming passes
+ # the enabled-scout cap, so one bulk write can silence a fleet that cannot be restored in one
+ # step. It never blocks a system transition: an inactivity sweep or the failure breaker still
+ # pauses a locked scout.
+ lifecycle_locked = models.BooleanField(default=False, db_default=False)
allowed_mcp_tools = models.JSONField(null=True, blank=True)
tool_preset = models.CharField(max_length=64, null=True, blank=True)
# Optional five-field cron expression anchoring runs to wall-clock slots (e.g. "30 9 * * *",
diff --git a/products/signals/backend/scout_harness/lifecycle_lock.py b/products/signals/backend/scout_harness/lifecycle_lock.py
new file mode 100644
index 000000000000..66474c2e07ae
--- /dev/null
+++ b/products/signals/backend/scout_harness/lifecycle_lock.py
@@ -0,0 +1,161 @@
+"""The per-scout lifecycle lock: who may pause, silence, or remove one scout.
+
+`signal_scout:write` is project-wide, and an unattended agent holding a member's credential
+carries it exactly as a person does. That is the right bar for tuning a schedule, and too weak
+for the lifecycle: one bulk pause silences a project's whole fleet, and a resume has to pass the
+enabled-scout maximum that a pause does not, so the fleet does not come back in one step.
+
+A scout that opts in (`SignalScoutConfig.lifecycle_locked`) therefore asks for the same claim
+`write_scopes` asks for, resolved the same way: the person the runs act as, or a project admin.
+
+This module holds the parts two products share. The signals config API reads them for its own
+write paths, and the skills product reads them through the signals facade, because archiving a
+scout's skill stops the scout just as surely as deleting its config does.
+"""
+
+from collections.abc import Mapping
+
+import structlog
+from prometheus_client import Counter
+
+from posthog.auth import OAuthAccessTokenAuthentication, PersonalAPIKeyAuthentication, SessionAuthentication
+from posthog.models.organization import OrganizationMembership
+from posthog.models.team.team import Team
+from posthog.models.user import User
+from posthog.user_permissions import UserPermissions
+
+from products.signals.backend.models import SignalScoutConfig
+from products.signals.backend.scout_harness.skill_loader import resolve_scout_acting_user_id
+
+logger = structlog.get_logger(__name__)
+
+LIFECYCLE_WRITES_REFUSED = Counter(
+ "signals_scout_lifecycle_writes_refused",
+ "Writes to a locked scout's lifecycle refused by the owner gate",
+ labelnames=["action", "auth_kind"],
+)
+
+# The fields the lock protects, alongside removing the scout. `enabled` stops the scout running
+# and `emit` stops it reporting, so either one silences it.
+LOCK_PROTECTED_FIELDS = ("enabled", "emit", "lifecycle_locked")
+
+
+class ScoutLifecycleLocked(Exception):
+ """A locked scout refused a lifecycle write. Carries the message to show the caller.
+
+ A plain exception rather than a DRF error, because the skills product raises it from an MCP
+ tool as well as from an endpoint, and each entrypoint renders it its own way.
+ """
+
+
+def resolve_auth_kind(authenticator: object) -> str:
+ """How a caller authenticated, as a bounded metric label.
+
+ A refusal matters most when it comes from an unattended agent holding a member's credential,
+ so the counter has to separate a token from a person at a browser.
+ """
+ if isinstance(authenticator, OAuthAccessTokenAuthentication):
+ return "oauth"
+ if isinstance(authenticator, PersonalAPIKeyAuthentication):
+ return "personal_api_key"
+ if isinstance(authenticator, SessionAuthentication):
+ return "session"
+ return "other"
+
+
+def canonical_team(team: Team) -> Team:
+ """The team a scout config lives under. A child environment resolves to its parent."""
+ return team.parent_team or team
+
+
+def lock_protected_changes(requested: object, *, config: SignalScoutConfig | None) -> list[str]:
+ """Which protected fields a write body would actually change on an existing scout.
+
+ Only a change counts: clients resend whole config objects, so a body repeating the current
+ `enabled` must not be refused as a pause. A malformed value counts as an attempt to change the
+ field — the serializer rejects it afterwards, and the gate must not be the thing that lets it
+ through. Nothing is protected while the scout is unlocked, except the lock itself: turning it
+ on decides who may turn it off, so it asks for the same claim from the start.
+ """
+ if config is None or not isinstance(requested, Mapping):
+ return []
+ changed = [
+ field for field in LOCK_PROTECTED_FIELDS if field in requested and requested[field] != getattr(config, field)
+ ]
+ if not changed:
+ return []
+ return changed if config.lifecycle_locked or "lifecycle_locked" in changed else []
+
+
+def user_holds_scout_lifecycle_claim(
+ *,
+ team: Team,
+ skill_name: str,
+ config: SignalScoutConfig,
+ user: User,
+) -> bool:
+ """Whether this person may move a locked scout's lifecycle.
+
+ The acting user comes from `resolve_scout_acting_user_id`, never `LLMSkillOwner`: any skill
+ editor can rewrite that owner list, so reading it here would let an editor appoint themselves
+ and pass the gate.
+ """
+ level = UserPermissions(user=user, team=team).current_team.effective_membership_level
+ if level is not None and level >= OrganizationMembership.Level.ADMIN:
+ return True
+ return resolve_scout_acting_user_id(team, skill_name, config) == user.pk
+
+
+def record_lifecycle_refusal(
+ *,
+ team: Team,
+ skill_name: str,
+ action: str,
+ auth_kind: str,
+ user_id: int | None,
+ fields: list[str] | None = None,
+) -> None:
+ """Count and log a refused lifecycle write, so the rate is visible per action and auth kind."""
+ LIFECYCLE_WRITES_REFUSED.labels(action=action, auth_kind=auth_kind).inc()
+ logger.warning(
+ "signals_scout: locked lifecycle write refused",
+ team_id=team.id,
+ skill_name=skill_name,
+ action=action,
+ fields=sorted(fields or []),
+ user_id=user_id,
+ auth_kind=auth_kind,
+ )
+
+
+def assert_can_archive_scout_skill(
+ *,
+ team: Team,
+ skill_name: str,
+ user: User,
+ authenticator: object = None,
+) -> None:
+ """Refuse to archive the skill behind a locked scout unless the caller owns it.
+
+ Archiving is how the product removes a custom scout: the delete flow tombstones the skill
+ first, and only then deletes the config. So a lock that guarded the config alone would still
+ let a non-owner stop a locked scout for good, and there is no way to unarchive a skill.
+
+ A no-op for a skill that is not a scout, or whose scout never opted in.
+ """
+ scoped_team = canonical_team(team)
+ config = SignalScoutConfig.objects.for_team(scoped_team.id).filter(skill_name=skill_name).first()
+ if config is None or not config.lifecycle_locked:
+ return
+ if user_holds_scout_lifecycle_claim(team=scoped_team, skill_name=skill_name, config=config, user=user):
+ return
+ record_lifecycle_refusal(
+ team=scoped_team,
+ skill_name=skill_name,
+ action="archive_skill",
+ auth_kind=resolve_auth_kind(authenticator),
+ user_id=user.pk,
+ )
+ raise ScoutLifecycleLocked(
+ "This scout is locked, so only the person its runs act as or a project admin can delete it."
+ )
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 74195538d4f9..67c44b8509ed 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -3075,6 +3075,17 @@ class StructuredOutputSchemaField(serializers.JSONField):
it's a schema-about-data, so its own shape is only bounded by JSON Schema itself."""
+_LIFECYCLE_LOCKED_HELP = (
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access "
+ "may pause, resume, switch the scout to dry run, or delete it. On, only the person the "
+ "scout's runs act as or a project admin may do any of those, or change this flag. Use it on "
+ "a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by "
+ "people and by unattended agents alike, and a resume has to pass the project's enabled-scout "
+ "maximum that a pause does not, so a bulk pause is not undone in one step. The lock never "
+ "stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+)
+
+
_STRUCTURED_OUTPUT_SCHEMA_HELP = (
"Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces "
"via `scout-record-output` — e.g. a per-report quality judgment "
@@ -3607,6 +3618,7 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
# `readonly string[]`, which a client cannot hand straight back to the patch call.
repositories = _scout_repositories_field()
write_scopes = _write_scopes_field(read_only=True)
+ lifecycle_locked = serializers.BooleanField(read_only=True, help_text=_LIFECYCLE_LOCKED_HELP)
allowed_mcp_tools = _allowed_mcp_tools_field(read_only=True)
tool_preset = serializers.CharField(
read_only=True,
@@ -3685,6 +3697,7 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
"mcp_gateway_server_ids",
"repositories",
"write_scopes",
+ "lifecycle_locked",
"allowed_mcp_tools",
"tool_preset",
"precheck_query",
@@ -3770,6 +3783,7 @@ class _ScoutConfigCapabilityFieldsMixin(serializers.Serializer):
mcp_gateway_server_ids = _mcp_gateway_server_ids_field()
repositories = _scout_repositories_field()
write_scopes = _write_scopes_field()
+ lifecycle_locked = serializers.BooleanField(required=False, help_text=_LIFECYCLE_LOCKED_HELP)
allowed_mcp_tools = _allowed_mcp_tools_field()
tool_preset = serializers.ChoiceField(
choices=ToolPreset.choices,
@@ -4025,6 +4039,7 @@ class SignalScoutConfigUpdateSerializer(_ScoutConfigCapabilityFieldsMixin, seria
"write_scopes",
"precheck_query",
"suggestion_id",
+ "lifecycle_locked",
"allowed_mcp_tools",
"tool_preset",
]
diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.py
index 139ec9cf2309..2c76c7d90da3 100644
--- a/products/signals/backend/scout_harness/views.py
+++ b/products/signals/backend/scout_harness/views.py
@@ -93,6 +93,12 @@ from products.signals.backend.scout_harness.lazy_seed import (
is_operational_scout,
scout_skill_origin,
)
+from products.signals.backend.scout_harness.lifecycle_lock import (
+ lock_protected_changes,
+ record_lifecycle_refusal,
+ resolve_auth_kind,
+ user_holds_scout_lifecycle_claim,
+)
from products.signals.backend.scout_harness.precheck import dry_run_scout_precheck
from products.signals.backend.scout_harness.run_costs import scout_run_token_costs
from products.signals.backend.scout_harness.run_gates import (
@@ -2786,6 +2792,21 @@ def create_scout_for_source(
# Only when one was given: the upsert applies every tunable to a row that already
# exists, and a blank would clear a label the existing scout was renamed to.
tunables["display_name"] = display_name
+ if not skill_created:
+ # Reusing a name adopts someone else's scout, and the tunables apply to its config as
+ # an edit — so a locked scout keeps its lifecycle gate on this route too. A scout
+ # authored in this request has no other owner to protect it from.
+ adopted_config = (
+ SignalScoutConfig.objects.for_team(team.id).select_for_update().filter(skill_name=name).first()
+ )
+ guard_scout_lifecycle_fields(
+ request=request,
+ team=team,
+ skill_name=name,
+ config=adopted_config,
+ requested=tunables,
+ action="create_scout",
+ )
if source_product and source_id:
# Reusing a name adopts the existing config, and the source pair is what the owning
# product's report route trusts — so adopting an unowned scout would expose everything it
@@ -3122,6 +3143,58 @@ def _resolve_scout_config_grants(
return resolved
+def guard_scout_lifecycle_fields(
+ *,
+ request: Request,
+ team: Team,
+ skill_name: str,
+ config: SignalScoutConfig | None,
+ requested: object,
+ action: str,
+) -> None:
+ """Apply the lock gate to a write body. A no-op unless the body changes a protected field."""
+ fields = lock_protected_changes(requested, config=config)
+ if config is None or not fields:
+ return
+ assert_can_change_scout_lifecycle(
+ request=request, team=team, skill_name=skill_name, config=config, action=action, fields=fields
+ )
+
+
+def assert_can_change_scout_lifecycle(
+ *,
+ request: Request,
+ team: Team,
+ skill_name: str,
+ config: SignalScoutConfig,
+ action: str,
+ fields: list[str] | None = None,
+) -> None:
+ """Gate on pausing, silencing, deleting, or unlocking a scout that opted into the lock.
+
+ The claim it asks for, and why, is documented on `lifecycle_lock`. The lock is off by default
+ and guards only human write paths: a system transition keeps its own rules, so the inactivity
+ sweep and the failure breaker still pause a locked scout.
+ """
+ user = cast(User, request.user)
+ if user_holds_scout_lifecycle_claim(team=team, skill_name=skill_name, config=config, user=user):
+ return
+ record_lifecycle_refusal(
+ team=team,
+ skill_name=skill_name,
+ action=action,
+ auth_kind=resolve_auth_kind(request.successful_authenticator),
+ user_id=user.pk,
+ fields=fields,
+ )
+ if config.lifecycle_locked:
+ raise exceptions.PermissionDenied(
+ "This scout is locked, so only the person its runs act as or a project admin can "
+ "pause, resume, or delete it."
+ )
+ raise exceptions.PermissionDenied("Only the person this scout's runs act as or a project admin can lock it.")
+
+
def scout_config_context(team: Team, skill_names: list[str], request: Request) -> dict[str, Any]:
"""Serializer context for `SignalScoutConfigSerializer`: skill metadata plus skill owners.
@@ -3459,6 +3532,22 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, vi
# from the comparison to the save, so a grant revoked in between cannot be written back by
# a request that compared against the old value.
with transaction.atomic():
+ existing = (
+ SignalScoutConfig.objects.unscoped()
+ .select_for_update()
+ .filter(team_id=team_id, skill_name=skill_name)
+ .first()
+ )
+ # This endpoint upserts, so a create body lands on an existing row as an edit — and
+ # `enabled` / `emit` are among the fields it applies.
+ guard_scout_lifecycle_fields(
+ request=request,
+ team=team,
+ skill_name=skill_name,
+ config=existing,
+ requested=request.data,
+ action="create",
+ )
if not LLMSkill.objects.filter(team_id=team_id, name=skill_name, is_latest=True, deleted=False).exists():
raise exceptions.ValidationError(
{"skill_name": "No skill with this name exists on this project. Author the skill first."}
@@ -3518,6 +3607,16 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, vi
)
if config is None:
raise exceptions.NotFound()
+ # Read off the raw body under the row lock: the serializer has not run yet, and a lock
+ # cleared between the check and the save would otherwise let the same request pause the scout.
+ guard_scout_lifecycle_fields(
+ request=request,
+ team=team,
+ skill_name=config.skill_name,
+ config=config,
+ requested=request.data,
+ action="partial_update",
+ )
serializer = SignalScoutConfigUpdateSerializer(
config,
data=request.data,
@@ -3750,6 +3849,14 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, vi
"This scout watches the self-driving system itself, so it can't be deleted. "
"Switch it off in its settings if you need it to stop running."
)
+ if config.lifecycle_locked:
+ assert_can_change_scout_lifecycle(
+ request=request,
+ team=_canonical_team(self),
+ skill_name=config.skill_name,
+ config=config,
+ action="destroy",
+ )
capture_background_scout_opted_out(
config=config, user=request.user if isinstance(request.user, User) else None, action=OPT_OUT_DELETED
)
diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.py
index e2854e79e9c9..1f2ccca19355 100644
--- a/products/signals/backend/test/test_scout_harness_api.py
+++ b/products/signals/backend/test/test_scout_harness_api.py
@@ -1782,6 +1782,215 @@ class TestScoutHarnessConfigWriteScopesAPI(APIBaseTest):
assert config.allowed_mcp_tools == ["dashboard-create"]
+class TestScoutHarnessConfigLifecycleLockAPI(APIBaseTest):
+ def _list_url(self) -> str:
+ return f"/api/projects/{self.team.id}/signals/scout/configs/"
+
+ def _detail_url(self, config_id: str) -> str:
+ return f"{self._list_url()}{config_id}/"
+
+ def _config(self, **kwargs) -> SignalScoutConfig:
+ return SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-hygiene", **kwargs)
+
+ def _authored_by(self, user: User) -> None:
+ LLMSkill.objects.create(team=self.team, name="signals-scout-hygiene", description="", body="", created_by=user)
+
+ def _other_member(self) -> User:
+ return User.objects.create_and_join(self.organization, "[email protected]", None)
+
+ def _become_admin(self) -> None:
+ self.organization_membership.level = OrganizationMembership.Level.ADMIN
+ self.organization_membership.save()
+
+ @parameterized.expand(
+ [
+ ("pause", {"enabled": False}),
+ ("stop_emitting", {"emit": False}),
+ ]
+ )
+ def test_a_locked_scout_refuses_a_lifecycle_write_from_another_member(self, _name: str, body: dict) -> None:
+ # The gap this closes: `signal_scout:write` is project-wide, so anyone holding it — a
+ # teammate, or an agent running on their credential — could silence any scout in the
+ # fleet. Resuming passes the enabled-scout maximum, so the pause does not undo in one step.
+ config = self._config(lifecycle_locked=True)
+ self._authored_by(self._other_member())
+
+ response = self.client.patch(self._detail_url(str(config.id)), data=body, format="json")
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN
+ config.refresh_from_db()
+ assert config.enabled is True
+ assert config.emit is True
+
+ @parameterized.expand(
+ [
+ # The runs act as whoever authored the scout body, so that person keeps the lifecycle.
+ ("scout_author", True, False, status.HTTP_200_OK),
+ ("project_admin", False, True, status.HTTP_200_OK),
+ ("plain_member", False, False, status.HTTP_403_FORBIDDEN),
+ ]
+ )
+ def test_pausing_a_locked_scout_needs_the_acting_user_or_an_admin(
+ self, _name: str, is_author: bool, is_admin: bool, expected: int
+ ) -> None:
+ config = self._config(lifecycle_locked=True)
+ self._authored_by(self.user if is_author else self._other_member())
+ if is_admin:
+ self._become_admin()
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"enabled": False}, format="json")
+
+ assert response.status_code == expected, response.json()
+ config.refresh_from_db()
+ assert config.enabled is (expected != status.HTTP_200_OK)
+
+ def test_an_unlocked_scout_keeps_the_plain_scope_bar(self) -> None:
+ # The lock is opt-in: without it the fleet must behave exactly as before, or every project
+ # that never asked for the guard loses its own pause button.
+ config = self._config()
+ self._authored_by(self._other_member())
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"enabled": False}, format="json")
+
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ config.refresh_from_db()
+ assert config.enabled is False
+
+ def test_a_locked_scout_still_takes_an_ordinary_edit_that_resends_its_lifecycle(self) -> None:
+ # Clients resend whole config objects, so an unchanged `enabled` must not turn a schedule
+ # edit into a permission error.
+ config = self._config(lifecycle_locked=True)
+ self._authored_by(self._other_member())
+
+ response = self.client.patch(
+ self._detail_url(str(config.id)),
+ data={"enabled": True, "emit": True, "lifecycle_locked": True, "run_interval_minutes": 720},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ config.refresh_from_db()
+ assert config.run_interval_minutes == 720
+
+ @parameterized.expand(
+ [
+ # Turning the lock on decides who may turn it off, so it asks for the claim from the
+ # start — otherwise a member locks a scout out from under its author.
+ ("locking", False, True),
+ ("unlocking", True, False),
+ ]
+ )
+ def test_changing_the_lock_needs_the_acting_user_or_an_admin(self, _name: str, current: bool, requested: bool):
+ config = self._config(lifecycle_locked=current)
+ self._authored_by(self._other_member())
+
+ response = self.client.patch(
+ self._detail_url(str(config.id)), data={"lifecycle_locked": requested}, format="json"
+ )
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN
+ config.refresh_from_db()
+ assert config.lifecycle_locked is current
+
+ def test_deleting_a_locked_scout_needs_the_acting_user_or_an_admin(self) -> None:
+ # Deletion is the one lifecycle action no cap or status can undo.
+ config = self._config(lifecycle_locked=True)
+ self._authored_by(self._other_member())
+
+ response = self.client.delete(self._detail_url(str(config.id)))
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN
+ assert SignalScoutConfig.objects.filter(id=config.id).exists()
+
+ def test_the_create_upsert_cannot_pause_a_locked_scout(self) -> None:
+ # The create endpoint upserts, so a create body lands on the existing row as an edit —
+ # a gate only on PATCH would leave the same pause one POST away.
+ config = self._config(lifecycle_locked=True)
+ self._authored_by(self._other_member())
+
+ response = self.client.post(
+ self._list_url(),
+ data={"skill_name": "signals-scout-hygiene", "enabled": False},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN
+ config.refresh_from_db()
+ assert config.enabled is True
+
+ def _archive_url(self) -> str:
+ return f"/api/projects/{self.team.id}/llm_skills/name/signals-scout-hygiene/archive"
+
+ def test_archiving_the_skill_cannot_delete_a_locked_scout_behind_the_lock(self) -> None:
+ # The delete flow archives the scout's skill first and only then deletes its config, so a
+ # gate on the config alone still let a non-owner stop a locked scout for good — and there
+ # is no unarchive. The archive has to refuse before it tombstones anything.
+ config = self._config(lifecycle_locked=True)
+ self._authored_by(self._other_member())
+
+ response = self.client.post(self._archive_url())
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN
+ assert LLMSkill.objects.filter(name="signals-scout-hygiene", deleted=False).exists()
+ config.refresh_from_db()
+ assert config.enabled is True
+
+ @parameterized.expand(
+ [
+ ("scout_author", True, False, status.HTTP_204_NO_CONTENT),
+ ("project_admin", False, True, status.HTTP_204_NO_CONTENT),
+ ("plain_member", False, False, status.HTTP_403_FORBIDDEN),
+ ]
+ )
+ def test_archiving_a_locked_scouts_skill_needs_the_acting_user_or_an_admin(
+ self, _name: str, is_author: bool, is_admin: bool, expected: int
+ ) -> None:
+ self._config(lifecycle_locked=True)
+ self._authored_by(self.user if is_author else self._other_member())
+ if is_admin:
+ self._become_admin()
+
+ response = self.client.post(self._archive_url())
+
+ assert response.status_code == expected, response.content
+ archived = not LLMSkill.objects.filter(name="signals-scout-hygiene", deleted=False).exists()
+ assert archived is (expected == status.HTTP_204_NO_CONTENT)
+
+ def test_archiving_an_unlocked_scouts_skill_keeps_the_plain_bar(self) -> None:
+ # The lock is opt-in, so a project that never turned it on must keep deleting scouts the
+ # way it always did.
+ self._config()
+ self._authored_by(self._other_member())
+
+ response = self.client.post(self._archive_url())
+
+ assert response.status_code == status.HTTP_204_NO_CONTENT, response.content
+ assert not LLMSkill.objects.filter(name="signals-scout-hygiene", deleted=False).exists()
+
+ def test_archiving_an_ordinary_skill_is_untouched_by_the_guard(self) -> None:
+ # The guard runs on every archive in the project, so a skill that is not a scout at all
+ # must not pay for it.
+ LLMSkill.objects.create(team=self.team, name="not-a-scout", description="", body="")
+
+ response = self.client.post(f"/api/projects/{self.team.id}/llm_skills/name/not-a-scout/archive")
+
+ assert response.status_code == status.HTTP_204_NO_CONTENT, response.content
+ assert not LLMSkill.objects.filter(name="not-a-scout", deleted=False).exists()
+
+ def test_the_owner_locks_the_scout_and_the_read_surfaces_it(self) -> None:
+ # Wiring guard: the flag has to round-trip through the update serializer and the read
+ # shape, or the settings UI cannot show or set the lock at all.
+ config = self._config()
+ self._authored_by(self.user)
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"lifecycle_locked": True}, format="json")
+
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ assert response.json()["lifecycle_locked"] is True
+ config.refresh_from_db()
+ assert config.lifecycle_locked is True
+
+
class TestWriteScopesValidation(SimpleTestCase):
@parameterized.expand(
[
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 5688308105b3..ae90eec3b4d9 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -3432,6 +3432,8 @@ export interface SignalScoutConfigOptionsApi {
* @maxItems 10
*/
write_scopes?: string[]
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -3768,6 +3770,8 @@ export interface SignalScoutConfigApi {
* @maxItems 10
*/
readonly write_scopes: readonly string[]
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ readonly lifecycle_locked: boolean
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -3905,6 +3909,8 @@ export interface SignalScoutConfigCreateApi {
* @maxItems 10
*/
write_scopes?: string[]
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -4073,6 +4079,8 @@ export interface PatchedSignalScoutConfigUpdateApi {
* @maxLength 64
*/
suggestion_id?: string
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index 5098be4e7898..2d8fd8d45725 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -832,6 +832,12 @@ export const SignalsScoutCreateBody = /* @__PURE__ */ zod
.describe(
"Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
@@ -1085,6 +1091,12 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.describe(
"Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
@@ -1420,6 +1432,12 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.describe(
"Optional id of the canonical scout suggestion this request turns on. It records that the scout came from that suggestion. An id this project's batch does not hold is ignored."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
diff --git a/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts b/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts
index bb7f656147b5..51e95d834a13 100644
--- a/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts
+++ b/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts
@@ -53,6 +53,7 @@ function makeMockScout(overrides: MockScoutOverrides): SignalScoutConfigApi {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
tags: [],
mcp_gateway_server_ids: [],
write_scopes: [],
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx
index ac658546d669..0bf010c6a560 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx
@@ -32,6 +32,7 @@ const config: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx
index 4dd588f2e774..4e19b21542b3 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx
@@ -38,6 +38,7 @@ const config: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
@@ -80,15 +81,18 @@ describe('ScoutConfigForm', () => {
expect(onUpdate).toHaveBeenCalledWith('config-1', { emit: expectedPatch })
})
- // Settable while the scout is off, so a dry-run posture can be chosen before the enable
- // sends the first run out.
- it('leaves the dry-run switch editable while the scout is disabled', () => {
+ // Settable while the scout is off: a dry-run posture has to be chosen before the enable sends
+ // the first run out, and the lock decides who may resume a paused scout.
+ it.each([
+ ['dry-run', emitSwitchLabel],
+ ['owner lock', 'signals-scout-general only the owner can pause or delete'],
+ ])('leaves the %s switch editable while the scout is disabled', (_name, label) => {
const onUpdate = jest.fn()
const { getByLabelText } = render(
<ScoutConfigForm config={{ ...config, enabled: false }} onUpdate={onUpdate} />
)
- expect(getByLabelText(emitSwitchLabel)).not.toBeDisabled()
+ expect(getByLabelText(label)).not.toBeDisabled()
})
it('saves the daily run time on blur and never clears the schedule from an empty input', () => {
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx
index 4b4d83ca8b84..29d66a19b465 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx
@@ -310,6 +310,25 @@ export function ScoutConfigForm({
aria-label={`${config.skill_name} opt out of auto-pause`}
/>
</div>
+ <div className="flex items-center justify-between gap-4">
+ <div className="flex flex-col min-w-0">
+ <span className="text-xs text-default">Only the owner can pause or delete</span>
+ <span className="text-[11.5px] text-muted">
+ Turn this on for a scout people rely on. Anyone with scout access can still change its other
+ settings, but only the person it runs as, or a project admin, can pause it, put it in dry run,
+ or delete it.
+ </span>
+ </div>
+ <LemonSwitch
+ size="small"
+ checked={config.lifecycle_locked}
+ // Editable while the scout is disabled, because the lock decides who may resume
+ // a paused scout.
+ disabledReason={updating ? 'Saving scout settings' : undefined}
+ onChange={(checked) => onUpdate(config.id, { lifecycle_locked: checked })}
+ aria-label={`${config.skill_name} only the owner can pause or delete`}
+ />
+ </div>
<div className="flex flex-col gap-1">
<div className="flex flex-col min-w-0">
<span className="text-xs text-default">Tags</span>
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx
index 463b42ee83eb..59a0e6a2b663 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx
@@ -34,6 +34,7 @@ const config: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx
index fb5f9859420c..184087679e49 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx
@@ -41,6 +41,7 @@ const config: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
tags: ['on-call', 'revenue'],
source_product: null,
source_id: null,
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx
index eb21004af73d..0b35189a72b8 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx
@@ -34,6 +34,7 @@ const CONFIG: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
diff --git a/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts b/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts
index d10737b9025d..097f9e8d4cea 100644
--- a/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts
+++ b/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts
@@ -41,6 +41,7 @@ export const trialFixtureConfig: SignalScoutConfigApi = {
write_scopes: [],
allowed_mcp_tools: null,
tool_preset: null,
+ lifecycle_locked: false,
source_product: null,
source_id: null,
created_at: '2026-01-01T09:00:00Z',
diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
index 566c90e7b17a..e8d0f0de5709 100644
--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
@@ -61,6 +61,7 @@ const CREATED_SCOUT: SignalScoutCreateResponseApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts
index ce13c8b27664..02fd78c318df 100644
--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts
@@ -88,6 +88,7 @@ const BASE_CONFIG: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
diff --git a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts
index 93262cf4569a..d5297e90e685 100644
--- a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts
@@ -117,6 +117,7 @@ const CONFIG: SignalScoutConfigApi = {
status_changed_at: null,
status_changed_by: null,
auto_pause_exempt: false,
+ lifecycle_locked: false,
network_access: 'trusted',
model: null,
precheck_query: null,
diff --git a/products/skills/backend/api/archive_guards.py b/products/skills/backend/api/archive_guards.py
new file mode 100644
index 000000000000..9b6f33a43fff
--- /dev/null
+++ b/products/skills/backend/api/archive_guards.py
@@ -0,0 +1,49 @@
+"""Hook inversion for skill archival, so another product can refuse one.
+
+Archiving is permanent — there is no unarchive endpoint — and a skill can be the definition
+another product runs. That product knows when removing it is not the caller's call to make, but
+this one cannot import it: the dependency runs the other way. So it offers a registry instead,
+which siblings fill during ``django.setup()`` (in ``AppConfig.ready()``).
+
+Signals registers the only guard today: a scout that locked its lifecycle refuses to be archived
+by anyone but the person its runs act as, or a project admin.
+"""
+
+from collections.abc import Callable
+
+from posthog.models.team.team import Team
+from posthog.models.user import User
+
+
+class SkillArchiveRefused(Exception):
+ """A registered guard refused this archive. Carries the message to show the caller."""
+
+
+# (team, skill_name, user, authenticator) -> None, raising SkillArchiveRefused to refuse.
+# The authenticator is the DRF one when the call came through an endpoint, so a guard can record
+# whether a token or a person at a browser tried; None everywhere else.
+SkillArchiveGuard = Callable[[Team, str, User, object], None]
+
+_archive_guards: list[SkillArchiveGuard] = []
+
+
+def register_skill_archive_guard(fn: SkillArchiveGuard) -> None:
+ _archive_guards.append(fn)
+
+
+def assert_skill_archive_allowed(
+ *,
+ team: Team,
+ skill_name: str,
+ user: User | None,
+ authenticator: object = None,
+) -> None:
+ """Run every registered guard, raising `SkillArchiveRefused` on the first refusal.
+
+ A caller with no acting user is a system path (seeding, a management command, a test fixture)
+ rather than someone asking to remove a skill, so it is not gated.
+ """
+ if user is None:
+ return
+ for guard in _archive_guards:
+ guard(team, skill_name, user, authenticator)
diff --git a/products/skills/backend/api/skill_services.py b/products/skills/backend/api/skill_services.py
index 5e9cbaaad826..adb44c04d44c 100644
--- a/products/skills/backend/api/skill_services.py
+++ b/products/skills/backend/api/skill_services.py
@@ -20,6 +20,7 @@ from ..models.skills import (
annotate_llm_skill_version_history_metadata,
category_for_skill_name,
)
+from .archive_guards import assert_skill_archive_allowed
_DigestModel = TypeVar("_DigestModel", LLMSkill, LLMSkillFile)
@@ -897,8 +898,16 @@ def rename_skill_file(
return _refresh_with_annotations(team, next_skill)
-def archive_skill(team: Team, skill_name: str) -> list[int]:
+def archive_skill(team: Team, skill_name: str, *, acting_user: User | None) -> list[int]:
+ """Tombstone every version of a logical skill.
+
+ `acting_user` is the person asking, or None for a system path. It is keyword-only and has no
+ default so a new caller has to say which it is: a guard can refuse the archive (see
+ `archive_guards`), and a silent default would let a fresh entrypoint skip that.
+ """
with transaction.atomic():
+ # Before the select_for_update below, so a refusal costs no row locks.
+ assert_skill_archive_allowed(team=team, skill_name=skill_name, user=acting_user)
skill_versions = list(
LLMSkill.objects.select_for_update()
.filter(team=team, name=skill_name, deleted=False)
diff --git a/products/skills/backend/api/skills.py b/products/skills/backend/api/skills.py
index c78b3ea03f82..1de72c093f4e 100644
--- a/products/skills/backend/api/skills.py
+++ b/products/skills/backend/api/skills.py
@@ -76,6 +76,7 @@ from ..marketplace.packaging import (
)
from ..models.community_skills import CommunitySkillKind
from ..models.skills import SCOUT_SKILL_CATEGORY, LLMSkill, LLMSkillFile
+from .archive_guards import SkillArchiveRefused
from .community_publish_services import (
CommunitySkillPublishError,
CommunitySkillPublishNotConfiguredError,
@@ -1625,7 +1626,15 @@ class LLMSkillViewSet(
result = self._marketplace_command_payload(request, issued.key, issued.token, issued.status)
return Response(LLMSkillMarketplaceCommandSerializer(result).data)
- @extend_schema(request=None, responses={204: None})
+ @extend_schema(
+ request=None,
+ responses={
+ 204: None,
+ 403: OpenApiResponse(
+ description="Another product owns what this skill runs and refuses this caller's archive."
+ ),
+ },
+ )
@action(
methods=["POST"],
detail=False,
@@ -1644,7 +1653,10 @@ class LLMSkillViewSet(
return access_error
try:
- skill_versions = archive_skill(self.team, skill_name)
+ skill_versions = archive_skill(self.team, skill_name, acting_user=cast(User, request.user))
+ except SkillArchiveRefused as err:
+ # A sibling product owns what this skill runs and says this caller may not remove it.
+ return Response({"detail": str(err)}, status=status.HTTP_403_FORBIDDEN)
except LLMSkillNotFoundError:
return self._skill_not_found_response(skill_name)
diff --git a/products/skills/backend/api/test/test_marketplace_endpoints.py b/products/skills/backend/api/test/test_marketplace_endpoints.py
index d035f6776195..ce07c5e7f1d5 100644
--- a/products/skills/backend/api/test/test_marketplace_endpoints.py
+++ b/products/skills/backend/api/test/test_marketplace_endpoints.py
@@ -124,7 +124,7 @@ class TestSkillZipExport(APIBaseTest):
zip_bytes = export.content
# Free the name so the re-import recreates it cleanly.
- archive_skill(self.team, "round-trip")
+ archive_skill(self.team, "round-trip", acting_user=None)
upload = SimpleUploadedFile("round-trip.zip", zip_bytes, content_type="application/zip")
imported = self.client.post(
@@ -793,7 +793,7 @@ class TestMarketplaceVersion(APIBaseTest):
LLMSkill.objects.filter(pk=newest.pk).update(updated_at=now)
before = self._plugin_version_epoch()
- archive_skill(self.team, "skill-new")
+ archive_skill(self.team, "skill-new", acting_user=None)
after = self._plugin_version_epoch()
# Without the archive bumping updated_at, the version would drop back to the older
diff --git a/products/skills/backend/api/test/test_skills.py b/products/skills/backend/api/test/test_skills.py
index 7b621af79539..924cb07b86c9 100644
--- a/products/skills/backend/api/test/test_skills.py
+++ b/products/skills/backend/api/test/test_skills.py
@@ -484,7 +484,7 @@ class TestLLMSkillAPI(APIBaseTest):
self.team, user=self.user, skill_name="skill-a", path="notes.md", content="x"
),
),
- ("archive", lambda self: archive_skill(self.team, "skill-a")),
+ ("archive", lambda self: archive_skill(self.team, "skill-a", acting_user=None)),
# Owners are keyed on the skill name, so an owner-only change touches no skill row. The
# skills version alone cannot see it, and the list serializes owners.
(
@@ -2246,7 +2246,7 @@ class TestLLMSkillAPI(APIBaseTest):
@patch("products.skills.backend.api.skills.publish_skill_to_community")
def test_publish_to_community_rejects_a_recreated_skill_with_the_same_version(self, mock_publish, _mock_flag):
reviewed_skill = self.create_skill(name="make-pr")
- archive_skill(self.team, "make-pr")
+ archive_skill(self.team, "make-pr", acting_user=None)
replacement_skill = self.create_skill(name="make-pr")
response = self.client.post(
@@ -3055,7 +3055,7 @@ class TestLLMSkillOwners(APIBaseTest):
create_skill(self.team, user=old_owner, name="reused", description="d", body="# v1")
assert [o.email for o in resolve_skill_owners(self.team, "reused")] == [old_owner.email]
- archive_skill(self.team, "reused")
+ archive_skill(self.team, "reused", acting_user=None)
create_skill(self.team, user=self.user, name="reused", description="d", body="# fresh")
assert [o.email for o in resolve_skill_owners(self.team, "reused")] == [self.user.email]
diff --git a/products/skills/backend/tools/skills.py b/products/skills/backend/tools/skills.py
index 68d3bf498a6b..0f58eaafee11 100644
--- a/products/skills/backend/tools/skills.py
+++ b/products/skills/backend/tools/skills.py
@@ -11,6 +11,7 @@ from posthog.scopes import APIScopeObject
from posthog.sync import database_sync_to_async
from products.access_control.backend.facade.user_access_control import AccessControlLevel
+from products.skills.backend.api.archive_guards import SkillArchiveRefused
from products.skills.backend.api.skill_serializers import RESERVED_SKILL_NAMES, SPEC_DESCRIPTION_MAX_LENGTH
from products.skills.backend.api.skill_services import (
LLMSkillDescriptionTooLongError,
@@ -507,7 +508,9 @@ class ArchiveLLMSkillTool(MaxTool):
async def _arun_impl(self, skill_name: str) -> tuple[str, None]:
try:
- versions = await database_sync_to_async(archive_skill)(self._team, skill_name)
+ versions = await database_sync_to_async(archive_skill)(self._team, skill_name, acting_user=self._user)
+ except SkillArchiveRefused as err:
+ raise MaxToolFatalError(str(err))
except LLMSkillNotFoundError:
raise MaxToolFatalError(
f"Skill '{skill_name}' was not found. Use `list_llm_skills` to discover available skills."
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 413b030f96e7..ad9a0a3a8703 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -83657,6 +83657,8 @@ export namespace Schemas {
* @maxLength 64
*/
suggestion_id?: string;
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean;
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -97079,6 +97081,8 @@ export namespace Schemas {
* @maxItems 10
*/
write_scopes?: string[];
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean;
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -97350,6 +97354,8 @@ export namespace Schemas {
* @maxItems 10
*/
readonly write_scopes: readonly string[];
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ readonly lifecycle_locked: boolean;
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
@@ -100256,6 +100262,8 @@ export namespace Schemas {
* @maxItems 10
*/
write_scopes?: string[];
+ /** Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker. */
+ lifecycle_locked?: boolean;
/**
* Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.
* @nullable
diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.ts
index a191105ef693..a4ca2e8d6195 100644
--- a/services/mcp/src/generated/replay_vision/api.ts
+++ b/services/mcp/src/generated/replay_vision/api.ts
@@ -1750,6 +1750,12 @@ export const VisionScannersScoutsCreateBody = () => zod
.describe(
"Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index 023c66c9d468..8332528ec60f 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -880,6 +880,12 @@ export const SignalsScoutCreateBody = () => zod
.describe(
"Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
@@ -1130,6 +1136,12 @@ export const SignalsScoutConfigCreateBody = () => zod
.describe(
"Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
@@ -1474,6 +1486,12 @@ export const SignalsScoutConfigUpdateBody = () => zod
.describe(
"Optional id of the canonical scout suggestion this request turns on. It records that the scout came from that suggestion. An id this project's batch does not hold is ignored."
),
+ lifecycle_locked: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
+ ),
allowed_mcp_tools: zod
.array(zod.string())
.nullish()
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index f18daa28bcca..2350105c2b1a 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -852,6 +852,9 @@ const scoutConfigCreate = (): ToolBase<ReturnType<typeof ScoutConfigCreateSchema
if (params.write_scopes !== undefined) {
body['write_scopes'] = params.write_scopes
}
+ if (params.lifecycle_locked !== undefined) {
+ body['lifecycle_locked'] = params.lifecycle_locked
+ }
if (params.allowed_mcp_tools !== undefined) {
body['allowed_mcp_tools'] = params.allowed_mcp_tools
}
@@ -1056,6 +1059,9 @@ const scoutConfigUpdate = (): ToolBase<
if (params.suggestion_id !== undefined) {
body['suggestion_id'] = params.suggestion_id
}
+ if (params.lifecycle_locked !== undefined) {
+ body['lifecycle_locked'] = params.lifecycle_locked
+ }
if (params.allowed_mcp_tools !== undefined) {
body['allowed_mcp_tools'] = params.allowed_mcp_tools
}
@@ -1963,6 +1969,9 @@ const signalsScoutConfigCreate = (): ToolBase<
if (params.write_scopes !== undefined) {
body['write_scopes'] = params.write_scopes
}
+ if (params.lifecycle_locked !== undefined) {
+ body['lifecycle_locked'] = params.lifecycle_locked
+ }
if (params.allowed_mcp_tools !== undefined) {
body['allowed_mcp_tools'] = params.allowed_mcp_tools
}
@@ -2138,6 +2147,9 @@ const signalsScoutConfigUpdate = (): ToolBase<
if (params.suggestion_id !== undefined) {
body['suggestion_id'] = params.suggestion_id
}
+ if (params.lifecycle_locked !== undefined) {
+ body['lifecycle_locked'] = params.lifecycle_locked
+ }
if (params.allowed_mcp_tools !== undefined) {
body['allowed_mcp_tools'] = params.allowed_mcp_tools
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
index ddd2f626fcaa..9756deec16bb 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
@@ -33,6 +33,10 @@
"description": "Whether this scout runs on its schedule. Defaults to true.",
"type": "boolean"
},
+ "lifecycle_locked": {
+ "description": "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker.",
+ "type": "boolean"
+ },
"mcp_gateway_server_ids": {
"description": "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run.",
"items": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
index 0ab30043f25f..084d1a28df04 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
@@ -36,6 +36,10 @@
"description": "A UUID string identifying this Signal scout config.",
"type": "string"
},
+ "lifecycle_locked": {
+ "description": "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker.",
+ "type": "boolean"
+ },
"mcp_gateway_server_ids": {
"description": "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run.",
"items": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json
index 652539a104cf..a49003579123 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json
@@ -35,6 +35,10 @@
"description": "Whether this scout runs on its schedule. Defaults to true.",
"type": "boolean"
},
+ "lifecycle_locked": {
+ "description": "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker.",
+ "type": "boolean"
+ },
"mcp_gateway_server_ids": {
"description": "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run.",
"items": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
index ddd2f626fcaa..9756deec16bb 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
@@ -33,6 +33,10 @@
"description": "Whether this scout runs on its schedule. Defaults to true.",
"type": "boolean"
},
+ "lifecycle_locked": {
+ "description": "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker.",
+ "type": "boolean"
+ },
"mcp_gateway_server_ids": {
"description": "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run.",
"items": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
index 0ab30043f25f..084d1a28df04 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
@@ -36,6 +36,10 @@
"description": "A UUID string identifying this Signal scout config.",
"type": "string"
},
+ "lifecycle_locked": {
+ "description": "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker.",
+ "type": "boolean"
+ },
"mcp_gateway_server_ids": {
"description": "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run.",
"items": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json
index 96da2983c42a..9595eaf909e2 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json
@@ -34,6 +34,10 @@
"description": "Whether this scout runs on its schedule. Defaults to true.",
"type": "boolean"
},
+ "lifecycle_locked": {
+ "description": "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker.",
+ "type": "boolean"
+ },
"mcp_gateway_server_ids": {
"description": "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run.",
"items": {