AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix(competitors): clarify empty-plan errors and keep all entity subqueries
Trevin Chow3af5a9fc1565
diff --git a/skills/last30days/scripts/last30days.py b/skills/last30days/scripts/last30days.pyindex c9d97acd..4a2b4dc8 100644--- a/skills/last30days/scripts/last30days.py+++ b/skills/last30days/scripts/last30days.py@@ -3177,6 +3177,21 @@ def _main(comp_plan=comp_plan,)+ # Plan alone with zero peers (empty/invalid JSON object, or all entries+ # skipped) must not fall through to discover-N with a misleading abort.+ if (+ comp_enabled+ and not comp_explicit+ and args.competitors is None+ and args.competitors_plan+ ):+ sys.stderr.write(+ "[Competitors] --competitors-plan has no usable peer entries "+ "(and the topic is not a vs-comparison). Pass a non-empty plan, "+ "a vs-topic, --competitors-list, or --competitors N.\n"+ )+ return 2+# Dedicated subs ride the config dict (already threaded to every source# fetch) so the keyless Reddit path can pull them floor-exempt without# widening pipeline.run / _retrieve_stream signatures.diff --git a/skills/last30days/scripts/lib/planner.py b/skills/last30days/scripts/lib/planner.pyindex 8291d38d..aa1d43c9 100644--- a/skills/last30days/scripts/lib/planner.py+++ b/skills/last30days/scripts/lib/planner.py@@ -908,7 +908,8 @@ def _max_subqueries(intent: str, topic: str | None = None) -> int:# Hermes Agent Use Cases failure: prior cap of 3 produced near-literal# echoes of the topic instead of a paraphrase fanout.if intent == "comparison":- return competitors.COMPARISON_ENTITY_MAX+ # primary + one dedicated subquery per entity (up to COMPARISON_ENTITY_MAX)+ return competitors.COMPARISON_ENTITY_MAX + 1# Intent-modifier topics get headroom for paraphrase fanout even when# the intent itself is factual/concept. Without this, a "Hermes Agent# use cases" query (classified "concept" after the 2026-04-19 defaultdiff --git a/tests/test_adversarial_v3.py b/tests/test_adversarial_v3.pyindex 6b92defe..1f77e82d 100644--- a/tests/test_adversarial_v3.py+++ b/tests/test_adversarial_v3.py@@ -116,7 +116,10 @@ class TestFiveWayComparison(unittest.TestCase):model=None,)from lib import competitors- self.assertLessEqual(len(plan.subqueries), competitors.COMPARISON_ENTITY_MAX)+ self.assertLessEqual(+ len(plan.subqueries),+ competitors.COMPARISON_ENTITY_MAX + 1,+ )class TestDegenerateInputs(unittest.TestCase):@@ -155,7 +158,10 @@ class TestDegenerateInputs(unittest.TestCase):model=None,)from lib import competitors- self.assertLessEqual(len(plan.subqueries), competitors.COMPARISON_ENTITY_MAX)+ self.assertLessEqual(+ len(plan.subqueries),+ competitors.COMPARISON_ENTITY_MAX + 1,+ )class TestMixedCaseAndPunctuation(unittest.TestCase):diff --git a/tests/test_competitors_routing.py b/tests/test_competitors_routing.pyindex 958dfc19..7214b981 100644--- a/tests/test_competitors_routing.py+++ b/tests/test_competitors_routing.py@@ -115,7 +115,7 @@ class TestEntityCapAlignment(unittest.TestCase):)self.assertEqual(planner._max_subqueries("comparison"),- competitors.COMPARISON_ENTITY_MAX,+ competitors.COMPARISON_ENTITY_MAX + 1, # primary + per-entity)def test_five_way_not_silently_truncated(self):@@ -125,6 +125,34 @@ class TestEntityCapAlignment(unittest.TestCase):["Weber", "Traeger", "Big Green Egg", "Blackstone", "Napoleon Grills"],)+ def test_fallback_plan_keeps_all_entities_at_ceiling(self):+ topic = "A vs B vs C vs D vs E vs F vs G"+ entities = planner._comparison_entities(topic)+ self.assertEqual(len(entities), competitors.COMPARISON_ENTITY_MAX)+ plan = planner._fallback_plan(topic, ["reddit"], None, "standard")+ entity_labels = [sq.label for sq in plan.subqueries if sq.label.startswith("entity-")]+ self.assertEqual(len(entity_labels), competitors.COMPARISON_ENTITY_MAX)+ self.assertIn("primary", [sq.label for sq in plan.subqueries])++ def test_empty_plan_alone_errors_clearly(self):+ args = _parse("Weber grills", "--competitors-plan", "{}")+ enabled, count, explicit = cli.resolve_competitors_args(args)+ plan = cli.parse_competitors_plan(args.competitors_plan)+ topic, enabled, count, explicit = cli.apply_vs_competitor_routing(+ "Weber grills",+ competitors_flag=args.competitors,+ comp_enabled=enabled,+ comp_count=count,+ comp_explicit=explicit,+ comp_plan=plan,+ )+ self.assertTrue(enabled)+ self.assertEqual(explicit, [])+ # Guard in _main: plan present, no peers, not discover-N+ self.assertIsNone(args.competitors)+ self.assertTrue(args.competitors_plan)+ self.assertFalse(explicit)+def test_over_max_warns_and_names_dropped(self):# main + 6 peers = max; 8th entity dropped with warningtopic = "A vs B vs C vs D vs E vs F vs G vs H"diff --git a/tests/test_planner_v3.py b/tests/test_planner_v3.pyindex 5cfa0a40..64d55cf2 100644--- a/tests/test_planner_v3.py+++ b/tests/test_planner_v3.py@@ -344,7 +344,7 @@ class IntentModifierBreadthTests(unittest.TestCase):def test_max_subqueries_unchanged_for_comparison(self):from lib import competitorsself.assertEqual(- competitors.COMPARISON_ENTITY_MAX,+ competitors.COMPARISON_ENTITY_MAX + 1,planner._max_subqueries("comparison"),)