: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): run repo selection on gpt-6-luna flex (#128295)
Georgiy Tarasovbaf3d995608c
diff --git a/products/signals/backend/agent_runtime.py b/products/signals/backend/agent_runtime.pyindex 80ef15879f21..fa46e01d7742 100644--- a/products/signals/backend/agent_runtime.py+++ b/products/signals/backend/agent_runtime.py@@ -30,7 +30,7 @@ fields are taken as a set so a Codex runtime never pairs with a Claude model):→ team_configs[team_id].steps["*"]→ team_configs["*"].steps[step]→ team_configs["*"].steps["*"]- → step default (Codex for scout rubrics; agent-server Claude runtime otherwise)+ → step default (Codex for scout rubrics and repo selection; agent-server Claude runtime otherwise)A resolved override threads through `CustomPromptSandboxContext`(runtime_adapter/model/reasoning_effort/service_tier) → `Task.create_and_run` → the run state → the@@ -92,6 +92,10 @@ class AgentRuntime:DEFAULT_RUNTIME = AgentRuntime()SCOUT_RUBRICS_RUNTIME = AgentRuntime(runtime_adapter="codex", model="gpt-6-sol", reasoning_effort="high")+# Repo selection runs in the background, so it takes the cheaper, slower Flex queue.+REPO_SELECTION_RUNTIME = AgentRuntime(+ runtime_adapter="codex", model="gpt-6-luna", reasoning_effort="medium", service_tier="flex"+)# The OpenAI service tiers a pin may name, mirroring the agent server's `ServiceTier` enum. The# agent server sends the value verbatim as the gateway's `X-PostHog-Service-Tier`, which fails@@ -102,6 +106,11 @@ KNOWN_SERVICE_TIERS = frozenset({"default", "priority", "flex"})# The Codex trial config (used by the local `analyze_report --codex` override).CODEX_RUNTIME = AgentRuntime(runtime_adapter="codex", model="gpt-5.5", reasoning_effort="xhigh")+_STEP_DEFAULT_RUNTIMES: dict[str, AgentRuntime] = {+ STEP_SCOUT_RUBRICS: SCOUT_RUBRICS_RUNTIME,+ STEP_REPO_SELECTION: REPO_SELECTION_RUNTIME,+}+def _read_flag_payload() -> dict | None:"""Read + parse the `signals-pipeline-models` flag payload once.@@ -181,6 +190,6 @@ def resolve_agent_runtime(team_id: int, step: str) -> AgentRuntime:step default; gating the runtime must never be able to fail an agentic run. Blocking network I/O(the payload read), so async callers wrap this in `database_sync_to_async`."""runtime = _resolve_from_payload(_read_flag_payload(), team_id, step)- if runtime == DEFAULT_RUNTIME and step == STEP_SCOUT_RUBRICS:- return SCOUT_RUBRICS_RUNTIME+ if runtime == DEFAULT_RUNTIME:+ return _STEP_DEFAULT_RUNTIMES.get(step, DEFAULT_RUNTIME)return runtimediff --git a/products/signals/backend/test/test_agent_runtime.py b/products/signals/backend/test/test_agent_runtime.pyindex 3e17ff84183a..77752c1bb716 100644--- a/products/signals/backend/test/test_agent_runtime.py+++ b/products/signals/backend/test/test_agent_runtime.py@@ -29,6 +29,7 @@ _CODEX = AgentRuntime(runtime_adapter="codex", model="gpt-5.5", reasoning_effort_SONNET_MODEL_ONLY = AgentRuntime(runtime_adapter=None, model="claude-sonnet-4-6", reasoning_effort=None)_CODEX_NO_EFFORT = AgentRuntime(runtime_adapter="codex", model="gpt-5.5", reasoning_effort=None)_SOL_HIGH = AgentRuntime(runtime_adapter="codex", model="gpt-6-sol", reasoning_effort="high")+_LUNA_FLEX = AgentRuntime(runtime_adapter="codex", model="gpt-6-luna", reasoning_effort="medium", service_tier="flex")class TestResolveAgentRuntime:@@ -45,6 +46,7 @@ class TestResolveAgentRuntime:("wildcard_team_step_missing", 999, "research", DEFAULT_RUNTIME),("rubrics_default", 999, "scout_rubrics", _SOL_HIGH),("rubrics_wildcard_override", 2, "scout_rubrics", _SONNET_MODEL_ONLY),+ ("repo_selection_default", 999, "repo_selection", _LUNA_FLEX),])def test_resolution_precedence(self, _name: str, team_id: int, step: str, expected: AgentRuntime) -> None:@@ -122,7 +124,7 @@ class TestResolveAgentRuntime:with patch(_PAYLOAD_FN_PATH, return_value=json.dumps(_PAYLOAD)):assert resolve_agent_runtime(2, "research") == _CODEX- @parameterized.expand([("research", DEFAULT_RUNTIME), ("scout_rubrics", _SOL_HIGH)])+ @parameterized.expand([("research", DEFAULT_RUNTIME), ("scout_rubrics", _SOL_HIGH), ("repo_selection", _LUNA_FLEX)])def test_flag_read_failure_falls_back_to_default(self, step: str, expected: AgentRuntime) -> None:with patch(_PAYLOAD_FN_PATH, side_effect=RuntimeError("flag service down")):assert resolve_agent_runtime(2, step) == expected