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): wire signals_credits quota plumbing end-to-end (#61845)

Joshua Snyder8d0436c47a18
diff --git a/ee/billing/billing_manager.py b/ee/billing/billing_manager.py
index a1e3a0e81143..ee223547d56b 100644
--- a/ee/billing/billing_manager.py
+++ b/ee/billing/billing_manager.py
@@ -430,6 +430,7 @@ class BillingManager:
api_queries_read_bytes=usage_summary.get("api_queries_read_bytes", {}),
llm_events=usage_summary.get("llm_events", {}),
ai_credits=usage_summary.get("ai_credits", {}),
+ signals_credits=usage_summary.get("signals_credits", {}),
workflow_emails=usage_summary.get("workflow_emails", {}),
workflow_destinations_dispatched=usage_summary.get("workflow_destinations_dispatched", {}),
logs_mb_ingested=usage_summary.get("logs_mb_ingested", {}),
diff --git a/ee/billing/quota_limiting.py b/ee/billing/quota_limiting.py
index 7b24f4cfaf35..aaa35c87f0c2 100644
--- a/ee/billing/quota_limiting.py
+++ b/ee/billing/quota_limiting.py
@@ -37,6 +37,7 @@ from posthog.tasks.usage_report import (
get_teams_with_recording_count_in_period,
get_teams_with_rows_exported_in_period,
get_teams_with_rows_synced_in_period,
+ get_teams_with_signals_credits_used_in_period,
get_teams_with_survey_responses_count_in_period,
get_teams_with_workflow_billable_invocations_in_period,
get_teams_with_workflow_emails_sent_in_period,
@@ -82,6 +83,7 @@ class QuotaResource(Enum):
CDP_TRIGGER_EVENTS = "cdp_trigger_events"
ROWS_EXPORTED = "rows_exported"
AI_CREDITS = "ai_credits"
+ SIGNALS_CREDITS = "signals_credits"
WORKFLOW_EMAILS = "workflow_emails"
WORKFLOW_DESTINATIONS = "workflow_destinations_dispatched"
LOGS_MB_INGESTED = "logs_mb_ingested"
@@ -104,6 +106,7 @@ OVERAGE_BUFFER = {
QuotaResource.CDP_TRIGGER_EVENTS: 0,
QuotaResource.ROWS_EXPORTED: 0,
QuotaResource.AI_CREDITS: 0,
+ QuotaResource.SIGNALS_CREDITS: 0,
QuotaResource.WORKFLOW_EMAILS: 0,
QuotaResource.WORKFLOW_DESTINATIONS: 0,
QuotaResource.LOGS_MB_INGESTED: 0,
@@ -112,6 +115,7 @@ OVERAGE_BUFFER = {
# These resources are exempt from any grace periods, whether trust-based or never_drop_data
GRACE_PERIOD_EXEMPT_RESOURCES: set[QuotaResource] = {
QuotaResource.AI_CREDITS,
+ QuotaResource.SIGNALS_CREDITS,
}
@@ -128,6 +132,7 @@ class UsageCounters(TypedDict):
cdp_trigger_events: int
rows_exported: int
ai_credits: int
+ signals_credits: int
workflow_emails: int
workflow_destinations_dispatched: int
logs_mb_ingested: int
@@ -885,6 +890,9 @@ def update_all_orgs_billing_quotas(
"teams_with_ai_credits_used_in_period": convert_team_usage_rows_to_dict(
_timed_query("ai_credits", get_teams_with_ai_credits_used_in_period, period_start, period_end)
),
+ "teams_with_signals_credits_used_in_period": convert_team_usage_rows_to_dict(
+ _timed_query("signals_credits", get_teams_with_signals_credits_used_in_period, period_start, period_end)
+ ),
"teams_with_workflow_emails_sent_in_period": convert_team_usage_rows_to_dict(
_timed_query("workflow_emails", get_teams_with_workflow_emails_sent_in_period, period_start, period_end)
),
@@ -947,6 +955,7 @@ def update_all_orgs_billing_quotas(
survey_responses=all_data["teams_with_survey_responses_count_in_period"].get(team.id, 0),
llm_events=all_data["teams_with_ai_event_count_in_period"].get(team.id, 0),
ai_credits=all_data["teams_with_ai_credits_used_in_period"].get(team.id, 0),
+ signals_credits=all_data["teams_with_signals_credits_used_in_period"].get(team.id, 0),
cdp_trigger_events=all_data["teams_with_cdp_trigger_events_metrics"].get(team.id, 0),
rows_exported=all_data["teams_with_rows_exported_in_period"].get(team.id, 0),
workflow_emails=all_data["teams_with_workflow_emails_sent_in_period"].get(team.id, 0),
diff --git a/ee/billing/test/test_billing_manager.py b/ee/billing/test/test_billing_manager.py
index 7f40af46cb6d..1b4d8aa9a045 100644
--- a/ee/billing/test/test_billing_manager.py
+++ b/ee/billing/test/test_billing_manager.py
@@ -174,6 +174,7 @@ class TestBillingManager(BaseTest):
"api_queries_read_bytes": {"usage": 1000, "limit": 1000000, "todays_usage": 500},
"llm_events": {"usage": 50, "limit": 1000, "todays_usage": 2},
"ai_credits": {"usage": 1200, "limit": 20000, "todays_usage": 150},
+ "signals_credits": {},
"cdp_trigger_events": {"usage": 10, "limit": 100, "todays_usage": 5},
"workflow_emails": {"usage": 100, "limit": 10000, "todays_usage": 10},
"workflow_destinations_dispatched": {"usage": 50, "limit": 10000, "todays_usage": 5},
@@ -246,6 +247,7 @@ class TestBillingManager(BaseTest):
"feature_flag_requests": {"usage": 25, "limit": 300, "todays_usage": 5},
"llm_events": {"usage": 50, "limit": 1000, "todays_usage": 2},
"ai_credits": {"usage": 1200, "limit": 20000, "todays_usage": 150},
+ "signals_credits": {},
"workflow_emails": {"usage": 100, "limit": 10000, "todays_usage": 10},
"workflow_destinations_dispatched": {"usage": 50, "limit": 10000, "todays_usage": 5},
"logs_mb_ingested": {"usage": 5500, "limit": 50000, "todays_usage": 500},
diff --git a/ee/billing/test/test_quota_limiting.py b/ee/billing/test/test_quota_limiting.py
index f791369d11e3..cbcf52f2ea17 100644
--- a/ee/billing/test/test_quota_limiting.py
+++ b/ee/billing/test/test_quota_limiting.py
@@ -226,7 +226,7 @@ class TestQuotaLimiting(BaseTest):
self.organization.save()
time.sleep(1)
- with self.assertNumQueries(FuzzyInt(3, 7)):
+ with self.assertNumQueries(FuzzyInt(3, 9)):
quota_limited_orgs, quota_limiting_suspended_orgs, _stats = update_all_orgs_billing_quotas()
assert patch_capture.call_count == 0 # No events should be captured since org won't be limited
assert quota_limited_orgs["events"] == {}
@@ -2235,6 +2235,7 @@ def _full_usage_counters(**overrides: int) -> UsageCounters:
survey_responses=0,
llm_events=0,
ai_credits=0,
+ signals_credits=0,
cdp_trigger_events=0,
rows_exported=0,
workflow_emails=0,
diff --git a/posthog/models/organization.py b/posthog/models/organization.py
index a64b821683ef..c064a68db8c9 100644
--- a/posthog/models/organization.py
+++ b/posthog/models/organization.py
@@ -54,6 +54,7 @@ class OrganizationUsageInfo(TypedDict):
api_queries_read_bytes: OrganizationUsageResource | None
llm_events: OrganizationUsageResource | None
ai_credits: OrganizationUsageResource | None
+ signals_credits: OrganizationUsageResource | None
workflow_emails: OrganizationUsageResource | None
workflow_destinations_dispatched: OrganizationUsageResource | None
logs_mb_ingested: OrganizationUsageResource | None
diff --git a/posthog/temporal/tests/ai/test_module_integrity.py b/posthog/temporal/tests/ai/test_module_integrity.py
index 7bc398305eac..c505bdacbc3e 100644
--- a/posthog/temporal/tests/ai/test_module_integrity.py
+++ b/posthog/temporal/tests/ai/test_module_integrity.py
@@ -248,6 +248,7 @@ class TestSignalsProductModuleIntegrity:
"fetch_error_tracking_issues_activity",
"assign_and_emit_signal_activity",
"capture_signal_dropped_activity",
+ "check_signals_quota_limited_activity",
"delete_report_activity",
"emit_eval_signal_activity",
"fetch_report_contexts_activity",
diff --git a/products/signals/backend/quota.py b/products/signals/backend/quota.py
new file mode 100644
index 000000000000..8c7670c9624b
--- /dev/null
+++ b/products/signals/backend/quota.py
@@ -0,0 +1,42 @@
+"""Signals credit quota enforcement.
+
+Lives in its own module (not `billing.py`) to avoid a circular import: `billing.py` is imported by
+`posthog.tasks.usage_report`, which `ee.billing.quota_limiting` imports in turn.
+"""
+
+import structlog
+from temporalio import activity
+
+from posthog.temporal.common.metrics import get_metric_meter
+
+from ee.billing.quota_limiting import QuotaLimitingCaches, QuotaResource, is_team_limited
+
+logger = structlog.get_logger(__name__)
+
+
+def _record_failed_open() -> None:
+ # Emit the meter directly rather than via products.signals.backend.temporal.metrics: importing
+ # that package runs its __init__, which imports buffer.py, which imports this module (cycle).
+ if not activity.in_activity():
+ return
+ get_metric_meter().create_counter(
+ "signals_quota_check_failed_open_total",
+ "Signals quota checks that errored and failed open, bypassing enforcement",
+ ).add(1)
+
+
+def is_team_signals_quota_limited(team_api_token: str) -> bool:
+ """Whether a team is currently over its Signals credits quota.
+
+ Fails open on a quota-limiter read error so an infra blip lets work through rather than stalling.
+ Records `signals_quota_check_failed_open_total` so the bypass is alertable.
+ Synchronous (Redis read); wrap in `sync_to_async` when calling from async code.
+ """
+ try:
+ return is_team_limited(
+ team_api_token, QuotaResource.SIGNALS_CREDITS, QuotaLimitingCaches.QUOTA_LIMITER_CACHE_KEY
+ )
+ except Exception:
+ logger.warning("signals_quota_check_failed_open", exc_info=True)
+ _record_failed_open()
+ return False
diff --git a/products/signals/backend/temporal/__init__.py b/products/signals/backend/temporal/__init__.py
index 3b498d313627..aea8b8aa13a6 100644
--- a/products/signals/backend/temporal/__init__.py
+++ b/products/signals/backend/temporal/__init__.py
@@ -16,6 +16,7 @@ from products.signals.backend.temporal.backfill_error_tracking import (
)
from products.signals.backend.temporal.buffer import (
BufferSignalsWorkflow,
+ check_signals_quota_limited_activity,
flush_signals_to_s3_activity,
signal_with_start_grouping_v2_activity,
submit_signal_to_buffer_activity,
@@ -98,6 +99,7 @@ ACTIVITIES = [
stamp_dispatched_signals_scout_runs_activity,
assign_and_emit_signal_activity,
capture_signal_dropped_activity,
+ check_signals_quota_limited_activity,
delete_report_activity,
emit_eval_signal_activity,
fetch_report_contexts_activity,
diff --git a/products/signals/backend/temporal/agentic/scout_scheduler.py b/products/signals/backend/temporal/agentic/scout_scheduler.py
index 4d00238f766b..058d6bc3db18 100644
--- a/products/signals/backend/temporal/agentic/scout_scheduler.py
+++ b/products/signals/backend/temporal/agentic/scout_scheduler.py
@@ -10,9 +10,12 @@ import structlog
import temporalio
from temporalio.common import RetryPolicy
+from posthog.models import Team
+from posthog.sync import database_sync_to_async
from posthog.temporal.common.heartbeat import Heartbeater
from posthog.temporal.common.utils import close_db_connections
+from products.signals.backend.quota import is_team_signals_quota_limited
from products.signals.backend.scout_harness.limits import WORKFLOW_HARD_CEILING_S
from products.signals.backend.temporal import metrics
@@ -43,6 +46,11 @@ class RunSignalsScoutOutput:
skip_reason: str | None = None
+def _is_team_over_signals_quota(team_id: int) -> bool:
+ api_token = Team.objects.only("api_token").get(pk=team_id).api_token
+ return is_team_signals_quota_limited(api_token)
+
+
def _to_output(result: RunResult) -> RunSignalsScoutOutput:
return RunSignalsScoutOutput(
run_id=result.run_id,
@@ -72,6 +80,24 @@ async def run_signals_scout_activity(input: RunSignalsScoutInput) -> RunSignalsS
which run outside the run-row try/except — so a transient drop is reported as a failed
run rather than escaping the activity and breaching the "never raises" contract.
"""
+ # Skip the run when the team is over its Signals credits quota, before any LLM work.
+ if await database_sync_to_async(_is_team_over_signals_quota, thread_sensitive=False)(input.team_id):
+ logger.info(
+ "signals_scout: skipping run, team over signals_credits quota",
+ team_id=input.team_id,
+ skill_name=input.skill_name,
+ )
+ metrics.increment_scout_run("quota_limited")
+ return RunSignalsScoutOutput(
+ run_id=None,
+ task_run_id=None,
+ status=None,
+ runtime_s=0.0,
+ skill_name=input.skill_name,
+ skill_version=input.skill_version or 0,
+ skip_reason="quota_limited",
+ )
+
# Deferred to break the runner <-> temporal import cycle (see the TYPE_CHECKING note
# above): importing the runner at module load leaves RunResult undefined when runner
# is the import entry point. Imported here at call time, after both modules are loaded.
diff --git a/products/signals/backend/temporal/buffer.py b/products/signals/backend/temporal/buffer.py
index ce5ee2b4c3a1..50b02fe166c8 100644
--- a/products/signals/backend/temporal/buffer.py
+++ b/products/signals/backend/temporal/buffer.py
@@ -14,10 +14,13 @@ from asgiref.sync import sync_to_async
from temporalio import activity, workflow
from temporalio.common import MetricCounter, RetryPolicy
+from posthog.models import Team
from posthog.storage import object_storage
from posthog.temporal.common.client import async_connect
from posthog.temporal.common.scoped import scoped_temporal
+from posthog.temporal.common.utils import close_db_connections
+from products.signals.backend.quota import is_team_signals_quota_limited
from products.signals.backend.temporal import metrics
from products.signals.backend.temporal.grouping_v2 import TeamSignalGroupingV2Workflow
from products.signals.backend.temporal.safety_filter import SafetyFilterInput, safety_filter_activity
@@ -29,6 +32,10 @@ logger = structlog.get_logger(__name__)
BUFFER_MAX_SIZE = 20
BUFFER_FLUSH_TIMEOUT_SECONDS = 5
+# Guards the ingestion quota gate so runs that recorded history before it was added replay
+# deterministically. Switch to workflow.deprecate_patch() once those have drained, then remove.
+_PATCH_QUOTA_INGESTION_GATE = "signals-quota-ingestion-gate-v1"
+
OBJECT_STORAGE_SIGNALS_PREFIX = "signals/signal_batches"
@@ -63,6 +70,20 @@ async def flush_signals_to_s3_activity(input: FlushBufferInput) -> FlushBufferOu
return FlushBufferOutput(object_key=object_key, signal_count=len(input.signals))
+@dataclass
+class CheckSignalsQuotaInput:
+ team_id: int
+
+
+@scoped_temporal()
+@close_db_connections
+async def check_signals_quota_limited_activity(input: CheckSignalsQuotaInput) -> bool:
+ """Whether the team is over its Signals credits quota."""
+ team = await Team.objects.only("api_token").aget(pk=input.team_id)
+ return await sync_to_async(is_team_signals_quota_limited)(team.api_token)
+
+
@dataclass
class SignalWithStartGroupingV2Input:
team_id: int
@@ -183,6 +204,32 @@ class BufferSignalsWorkflow:
batch = list(self._signal_buffer)
self._signal_buffer.clear()
+ # Drop the batch when the team is over its Signals credits quota, before any downstream work.
+ if workflow.patched(_PATCH_QUOTA_INGESTION_GATE):
+ over_quota = await workflow.execute_activity(
+ check_signals_quota_limited_activity,
+ CheckSignalsQuotaInput(team_id=input.team_id),
+ start_to_close_timeout=timedelta(seconds=30),
+ retry_policy=RetryPolicy(maximum_attempts=3),
+ )
+ if over_quota:
+ logger.info(
+ "signals_buffer.dropped_batch_quota_limited",
+ team_id=input.team_id,
+ signal_count=len(batch),
+ )
+ metrics.increment_dropped(stage="ingestion", reason="quota_limited", count=len(batch))
+ # Compact history like the empty-batch path so a sustained over-quota stream
+ # doesn't grow Temporal history unboundedly.
+ if len(self._signal_buffer) < BUFFER_MAX_SIZE:
+ workflow.continue_as_new(
+ BufferSignalsInput(
+ team_id=input.team_id,
+ pending_signals=list(self._signal_buffer),
+ )
+ )
+ continue
+
# Filter out malicious signals
safety_results = await asyncio.gather(
*[
diff --git a/products/signals/backend/test/test_buffer_workflow.py b/products/signals/backend/test/test_buffer_workflow.py
new file mode 100644
index 000000000000..acb6f12dc562
--- /dev/null
+++ b/products/signals/backend/test/test_buffer_workflow.py
@@ -0,0 +1,106 @@
+import uuid
+import asyncio
+
+import pytest
+
+from temporalio import activity
+from temporalio.testing import WorkflowEnvironment
+from temporalio.worker import UnsandboxedWorkflowRunner, Worker
+
+from products.signals.backend.temporal.buffer import (
+ BufferSignalsWorkflow,
+ CheckSignalsQuotaInput,
+ FlushBufferInput,
+ FlushBufferOutput,
+ SignalWithStartGroupingV2Input,
+)
+from products.signals.backend.temporal.safety_filter import SafetyFilterInput, SafetyFilterOutput
+from products.signals.backend.temporal.types import BufferSignalsInput, EmitSignalInputs
+
+TASK_QUEUE = "test-buffer-queue"
+
+
+def _signal(team_id: int) -> EmitSignalInputs:
+ return EmitSignalInputs(
+ team_id=team_id,
+ source_product="error_tracking",
+ source_type="issue",
+ source_id=str(uuid.uuid4()),
+ description="something happened",
+ )
+
+
+class _Recorder:
+ def __init__(self, over_quota: bool) -> None:
+ self.over_quota = over_quota
+ self.quota_checks = 0
+ self.safety_checks = 0
+ self.flushes = 0
+ self.grouping_starts = 0
+ # The drop path ends at the quota check; the pass-through path ends at grouping. Each path's
+ # terminal activity sets its event so the test knows the batch finished processing.
+ self.gate_reached = asyncio.Event()
+ self.flow_done = asyncio.Event()
+
+
+async def _drive(recorder: _Recorder) -> None:
+ @activity.defn(name="check_signals_quota_limited_activity")
+ async def fake_quota(_input: CheckSignalsQuotaInput) -> bool:
+ recorder.quota_checks += 1
+ recorder.gate_reached.set()
+ return recorder.over_quota
+
+ @activity.defn(name="safety_filter_activity")
+ async def fake_safety(_input: SafetyFilterInput) -> SafetyFilterOutput:
+ recorder.safety_checks += 1
+ return SafetyFilterOutput(safe=True, threat_type="", explanation=None)
+
+ @activity.defn(name="flush_signals_to_s3_activity")
+ async def fake_flush(input: FlushBufferInput) -> FlushBufferOutput:
+ recorder.flushes += 1
+ return FlushBufferOutput(object_key="signals/batch/test", signal_count=len(input.signals))
+
+ @activity.defn(name="signal_with_start_grouping_v2_activity")
+ async def fake_grouping(_input: SignalWithStartGroupingV2Input) -> None:
+ recorder.grouping_starts += 1
+ recorder.flow_done.set()
+
+ async with await WorkflowEnvironment.start_time_skipping() as env:
+ async with Worker(
+ env.client,
+ task_queue=TASK_QUEUE,
+ workflows=[BufferSignalsWorkflow],
+ activities=[fake_quota, fake_safety, fake_flush, fake_grouping],
+ workflow_runner=UnsandboxedWorkflowRunner(),
+ ):
+ handle = await env.client.start_workflow(
+ BufferSignalsWorkflow.run,
+ BufferSignalsInput(team_id=1),
+ id=f"buffer-{uuid.uuid4()}",
+ task_queue=TASK_QUEUE,
+ )
+ await handle.signal(BufferSignalsWorkflow.submit_signal, _signal(1))
+ terminal = recorder.gate_reached if recorder.over_quota else recorder.flow_done
+ await asyncio.wait_for(terminal.wait(), timeout=30)
+ await handle.terminate()
+
+
+async def test_over_quota_batch_is_dropped():
+ recorder = _Recorder(over_quota=True)
+ await _drive(recorder)
+ assert recorder.quota_checks >= 1
+ # The batch is dropped at the gate, so nothing downstream runs.
+ assert recorder.safety_checks == 0
+ assert recorder.flushes == 0
+ assert recorder.grouping_starts == 0
+
+
+async def test_under_quota_batch_flows_through():
+ recorder = _Recorder(over_quota=False)
+ await _drive(recorder)
+ assert recorder.quota_checks >= 1
+ assert recorder.safety_checks == 1
+ assert recorder.flushes == 1
+ assert recorder.grouping_starts == 1
diff --git a/products/signals/backend/test/test_quota.py b/products/signals/backend/test/test_quota.py
new file mode 100644
index 000000000000..7fa88484cfb8
--- /dev/null
+++ b/products/signals/backend/test/test_quota.py
@@ -0,0 +1,33 @@
+import pytest
+from unittest.mock import patch
+
+from products.signals.backend.quota import is_team_signals_quota_limited
+
+
+ ("limited", "expected"),
+ [
+ (True, True),
+ (False, False),
+ ],
+)
+def test_reflects_quota_limiter(limited, expected):
+ with patch("products.signals.backend.quota.is_team_limited", return_value=limited) as mock_limited:
+ assert is_team_signals_quota_limited("phc_token") is expected
+ # Always queries the signals_credits resource for the given token.
+ args = mock_limited.call_args.args
+ assert args[0] == "phc_token"
+ assert args[1].value == "signals_credits"
+
+
+def test_fails_open_on_error():
+ with patch("products.signals.backend.quota.is_team_limited", side_effect=RuntimeError("redis down")):
+ assert is_team_signals_quota_limited("phc_token") is False
+
+
+def test_fail_open_metric_noops_outside_activity():
+ # The fail-open counter only records inside a Temporal activity; outside one it must not raise.
+ with patch("products.signals.backend.quota.is_team_limited", side_effect=RuntimeError("redis down")):
+ with patch("products.signals.backend.quota.get_metric_meter") as mock_meter:
+ assert is_team_signals_quota_limited("phc_token") is False
+ mock_meter.assert_not_called()
diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.py
index ae624823de9f..bfdc847dbd84 100644
--- a/products/signals/backend/test/test_scout_harness.py
+++ b/products/signals/backend/test/test_scout_harness.py
@@ -762,6 +762,62 @@ async def test_activity_returns_skip_outcome_when_already_running(ateam):
assert output.skip_reason is not None
+async def test_activity_skips_run_when_team_over_signals_quota(ateam):
+ fake_arun = AsyncMock()
+ with (
+ patch(
+ "products.signals.backend.temporal.agentic.scout_scheduler.is_team_signals_quota_limited",
+ return_value=True,
+ ),
+ patch("products.signals.backend.scout_harness.runner.arun_signals_scout", fake_arun),
+ ):
+ env = ActivityEnvironment()
+ output = await env.run(
+ run_signals_scout_activity,
+ RunSignalsScoutInput(team_id=ateam.id, skill_name="signals-scout-errors"),
+ )
+
+ fake_arun.assert_not_called()
+ assert output.run_id is None
+ assert output.status is None
+ assert output.skip_reason == "quota_limited"
+
+
+async def test_activity_runs_when_team_under_signals_quota(ateam):
+ TaskRun = apps.get_model("tasks", "TaskRun")
+
+ async def fake_arun(**_kwargs):
+ return RunResult(
+ run_id="abc",
+ task_run_id="def",
+ status=TaskRun.Status.COMPLETED.value,
+ last_message="ok",
+ runtime_s=1.5,
+ skill_name="signals-scout-errors",
+ skill_version=2,
+ )
+
+ with (
+ patch(
+ "products.signals.backend.temporal.agentic.scout_scheduler.is_team_signals_quota_limited",
+ return_value=False,
+ ),
+ patch("products.signals.backend.scout_harness.runner.arun_signals_scout", side_effect=fake_arun),
+ ):
+ env = ActivityEnvironment()
+ output = await env.run(
+ run_signals_scout_activity,
+ RunSignalsScoutInput(team_id=ateam.id, skill_name="signals-scout-errors"),
+ )
+
+ assert output.status == "completed"
+ assert output.skip_reason is None
+
+
@pytest.mark.asyncio
@pytest.mark.django_db
async def test_activity_swallows_transient_db_connection_drop(ateam):
diff --git a/tach.toml b/tach.toml
index 69f2a498b195..0b805bc8f218 100644
--- a/tach.toml
+++ b/tach.toml
@@ -539,6 +539,7 @@ layer = "modules"
[[modules]]
path = "products.signals"
depends_on = [
+ "ee",
"products.cohorts",
"posthog",
"products.actions",