: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
fix(signals): stop suggesting companion skills as scouts (#115815)
posthog[bot]b2695a123bf9
diff --git a/products/signals/backend/scout_harness/suggestions.py b/products/signals/backend/scout_harness/suggestions.pyindex 1af83722ecb2..f14a59591baa 100644--- a/products/signals/backend/scout_harness/suggestions.py+++ b/products/signals/backend/scout_harness/suggestions.py@@ -57,6 +57,7 @@ from products.signals.backend.scout_harness.lazy_seed import (discover_canonical_skills,)from products.signals.backend.scout_harness.prompt import SCOUT_PROJECT_SCAN_GUIDANCE+from products.signals.backend.scout_harness.skill_loader import SIGNALS_SCOUT_SKILL_PREFIXfrom products.signals.backend.scout_harness.team_limits import read_flag_payload, withheld_skills_for_teamfrom products.skills.backend.marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTHfrom products.skills.backend.models.skills import LLMSkill@@ -806,10 +807,14 @@ def fleet_context(team_id: int) -> FleetContext:# A held-back canonical scout is not seeded by the sync path and the config API refuses to# enable it, so offering it would surface an unreleased scout behind a Create that must fail.withheld = withheld_skills_for_team(resolve_effective_team_id(team_id))+ # Companion helper skills ship in the same manifest but never get a scout config, so Create+ # could never apply them. The parser pins the scout prefix to scouts only.available = tuple((skill.name, skill.description)for skill in canonical- if skill.name not in enabled_set and skill.name not in withheld+ if skill.name.startswith(SIGNALS_SCOUT_SKILL_PREFIX)+ and skill.name not in enabled_set+ and skill.name not in withheld)return FleetContext(enabled_skill_names=enabled, available_canonical=available, reserved_names=reserved_scout_names(team_id)@@ -1005,7 +1010,8 @@ def visible_items(normal config API disappears without waiting for `mark_suggestion_created`, and its reservednames so a custom draft whose name was since taken (a stored skill or a disabled config, whichCreate answers with 409) is hidden too. Canonical items ignore `reserved_names` — a disabled- canonical scout is exactly what those items offer to enable."""+ canonical scout is exactly what those items offer to enable. A canonical item that names a+ companion skill is hidden, because no scout config exists for Create to enable."""enabled = set(enabled_skill_names)reserved = set(reserved_names)return [@@ -1016,6 +1022,10 @@ def visible_items(and not record.get("created_config_id")and record.get("skill_name") not in enabledand not (record.get("kind") == "custom" and record.get("skill_name") in reserved)+ and not (+ record.get("kind") == "canonical"+ and not str(record.get("skill_name") or "").startswith(SIGNALS_SCOUT_SKILL_PREFIX)+ )]diff --git a/products/signals/backend/test/test_scout_suggestions.py b/products/signals/backend/test/test_scout_suggestions.pyindex aaf292b4ea28..59817a0b0fd9 100644--- a/products/signals/backend/test/test_scout_suggestions.py+++ b/products/signals/backend/test/test_scout_suggestions.py@@ -37,6 +37,7 @@ from products.signals.backend.scout_harness.suggestions import (SuggestionSettings,TeamActivity,dismiss_suggestion,+ fleet_context,mark_generation_failed,mark_suggestion_created,parse_suggestion_settings,@@ -265,6 +266,14 @@ class TestSuggestionPersistence(BaseTest):visible = visible_items(row, enabled_skill_names={"signals-scout-error-tracking"})self.assertEqual([record["skill_name"] for record in visible], ["signals-scout-checkout-drop"])+ @parameterized.expand([("authoring-scouts",), ("exploring-replay-vision-observations",)])+ def test_companion_skills_are_never_offered_as_picks(self, companion):+ self.assertNotIn(companion, {name for name, _ in fleet_context(self.team.id).available_canonical})+ row = persist_suggestion_batch(+ self.team.id, [_item(skill_name=companion), _custom()], task_run_id=None, model=None, fleet_snapshot=[]+ )+ self.assertEqual([record["skill_name"] for record in visible_items(row)], ["signals-scout-checkout-drop"])+def test_failed_generation_keeps_prior_items_and_counts_toward_breaker(self):persist_suggestion_batch(self.team.id, [_item()], task_run_id=None, model=None, fleet_snapshot=[])row = mark_generation_failed(self.team.id, task_run_id=None)