: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): raise the scout run budget to 30 minutes (#127015)
Andrew Maguire4501a4979b05
diff --git a/products/signals/backend/constants.py b/products/signals/backend/constants.pyindex c737418cd01d..81e0502ff962 100644--- a/products/signals/backend/constants.py+++ b/products/signals/backend/constants.py@@ -1,11 +1,12 @@SIGNALS_FIRST_REPORT_EMAIL_TEMPLATE_ID: str = "01a1598d-9186-0000-b20d-d91813fc05ff"# Keep the agent polling budget below the activity timeout so teardown can finish.-DEFAULT_MAX_RUNTIME_S = 20 * 60+DEFAULT_MAX_RUNTIME_S = 30 * 60FIRST_REPORT_SCOUT = "signals-scout-first-report"SYSTEM_SCOUT_NAMES = frozenset({FIRST_REPORT_SCOUT})-FIRST_REPORT_SCOUT_TIMEOUT_SECONDS = DEFAULT_MAX_RUNTIME_S+# Onboarding waits on this run, so it keeps a shorter budget than the fleet.+FIRST_REPORT_SCOUT_TIMEOUT_SECONDS = 20 * 60def first_report_idempotency_key(team_id: int) -> str:diff --git a/products/signals/backend/report_check_agent.py b/products/signals/backend/report_check_agent.pyindex 19c7335d5637..4d337145b7ce 100644--- a/products/signals/backend/report_check_agent.py+++ b/products/signals/backend/report_check_agent.py@@ -52,7 +52,7 @@ logger = structlog.get_logger(__name__)FALLBACK_CHECK_SKILL_NAME = "signals-scout-inbox-validation"# How long a dispatched run has to record its verdict before the coordinator gives up on it. A scout-# activity is killed at `WORKFLOW_HARD_CEILING_S` (21 minutes) and the coordinator ticks every 30,+# activity is killed at `WORKFLOW_HARD_CEILING_S` (46 minutes) and the coordinator ticks every 30,# so two hours is several ticks past any run that is still alive. Sized generously because the cost# of waiting too long is one late verdict, while the cost of waiting too little is a second run# dispatched over the top of a live one.diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.pyindex d3b79e421cf2..5e5e176a6eab 100644--- a/products/signals/backend/test/test_scout_harness.py+++ b/products/signals/backend/test/test_scout_harness.py@@ -2151,7 +2151,7 @@ async def test_run_tags_session_with_scout_attribution(ateam, aerrors_skill):# `signals-scout-errors` is not canonical, so only `ai_agent_name` can name it.assert captured["ai_stage"] == "scout:custom"assert captured["ai_agent_name"] == "signals-scout-errors"- assert captured["max_poll_seconds"] == 20 * 60+ assert captured["max_poll_seconds"] == 30 * 60assert captured["context"].sandbox_timeout_seconds is None@@ -4106,7 +4106,7 @@ async def test_activity_wakes_the_workflow_step_that_started_the_run(ateam, work)@pytest.mark.parametrize("workflow_origin_key,trial_launch_id,timeout_minutes",- [("job:step:1", None, 36), (None, None, 36), (None, "11111111-1111-1111-1111-111111111111", 51)],+ [("job:step:1", None, 46), (None, None, 46), (None, "11111111-1111-1111-1111-111111111111", 51)],)async def test_workflow_delivers_scout_outcomes_even_when_the_run_activity_cannot(outcome, workflow_origin_key, trial_launch_id, timeout_minutesdiff --git a/products/tasks/backend/logic/services/custom_prompt_internals.py b/products/tasks/backend/logic/services/custom_prompt_internals.pyindex 86fab04d46c3..58f1e15de257 100644--- a/products/tasks/backend/logic/services/custom_prompt_internals.py+++ b/products/tasks/backend/logic/services/custom_prompt_internals.py@@ -54,7 +54,7 @@ FINAL_POLL_READ_SECONDS = 5# a finished-but-noisy turn is never salvaged (the observed dominant failure mode). The null-cost# finalization fingerprint (_ended_on_pending_finalization) is the real safety gate; this floor only# rules out salvaging a turn caught mid-stream. It must stay well below the per-turn poll budget (the-# Signals scout passes 1200s): a floor near the budget would salvage only turns that fell silent early+# Signals scout passes 1800s): a floor near the budget would salvage only turns that fell silent early# and reject one that works late and then drops end_turn, the exact case this path exists to recover.STALE_TURN_SALVAGE_SECONDS = 300