: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(slack_app): stop reading model data questions as model overrides (#116796)
Vojta Bartošf080698e0ad3
diff --git a/posthog/temporal/ai/slack_app/activities/prompts/model_override.md.j2 b/posthog/temporal/ai/slack_app/activities/prompts/model_override.md.j2index d3ed9ebc59d7..012816cb2ef9 100644--- a/posthog/temporal/ai/slack_app/activities/prompts/model_override.md.j2+++ b/posthog/temporal/ai/slack_app/activities/prompts/model_override.md.j2@@ -8,19 +8,22 @@ Name a model or effort only when the message instructs how to run this task:- The instruction can sit alongside the actual request: 'use sonnet and fix the flaky checkout test'.Once — and only once — you have decided the message is such an instruction, resolve its shorthand to an id from the list. Nobody types a model id:- - A bare nickname is the model: "sol", "luna", "fable".- - A runtime or vendor in front of it is only a qualifier, and the name beside it is the answer: "codex sol" and "openai sol" are both the Sol id; "claude opus" and "anthropic opus" are both an Opus id.- - A family with no version means its newest listed member: "opus" is the highest-numbered Opus in the list, not the first one you see. Read the versions as decimals — 5 is newer than 4.8, not older.+ - A bare nickname names a family, not one version: "sol", "luna", "fable".+ - A runtime or vendor in front of it is only a qualifier, and the name beside it is the answer: "codex sol" and "openai sol" both mean Sol; "claude opus" and "anthropic opus" both mean Opus.+ - Any name with no version means its newest listed member — a family word like "opus" and a nickname like "luna" alike. Take the highest-numbered entry carrying that name, never the first one you see. Read the versions as decimals: 5 is newer than 4.8, and 6 is newer than 5.6.- A runtime or vendor standing alone names no model: "run this on codex", "use anthropic" → null. A model id that happens to end in "codex" is a different thing, and needs its version said out loud to be chosen.Answer with nulls when a model or effort is merely part of the subject matter — this is the common mistake, so check for it:- "add claude-fable-5 to our model picker" (a code change that names a model).- "move the summary agents over to sonnet" (a code change that switches something else onto a model, not this task).- "why is gpt-5 slower than opus in our evals?" (a question about models).+ - "how long does a scout take on sol 6.1, compared with terra?" (a request for data about models: the models are what gets measured, not what runs this task).- "the opus rollout broke the dashboard" (a topic).- "reasoning about this is hard" (the word, not a setting).- "we tried sonnet on this last week and it kept timing out" (an account of a run that already happened, not an instruction for this one — past tense is the tell).+A question or a data request about a model — its cost, speed, token use, error rate, or how it compares with other models — is subject matter. This stays true when the model name comes after "for", "via", "on", or "with". To change the run, the message must also tell you to run this task on that model.+Rules for the fields:- model: an id from the list above, or null if the author named no model (or named one that isn't listed).- reasoning_effort: only when the author explicitly asks for an effort level, and only a value listed for that model. Otherwise null.diff --git a/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_model_override.ambr b/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_model_override.ambrindex e8f6e167ada8..ab9220c5fd82 100644--- a/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_model_override.ambr+++ b/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_model_override.ambr@@ -15,19 +15,22 @@- The instruction can sit alongside the actual request: 'use sonnet and fix the flaky checkout test'.Once — and only once — you have decided the message is such an instruction, resolve its shorthand to an id from the list. Nobody types a model id:- - A bare nickname is the model: "sol", "luna", "fable".- - A runtime or vendor in front of it is only a qualifier, and the name beside it is the answer: "codex sol" and "openai sol" are both the Sol id; "claude opus" and "anthropic opus" are both an Opus id.- - A family with no version means its newest listed member: "opus" is the highest-numbered Opus in the list, not the first one you see. Read the versions as decimals — 5 is newer than 4.8, not older.+ - A bare nickname names a family, not one version: "sol", "luna", "fable".+ - A runtime or vendor in front of it is only a qualifier, and the name beside it is the answer: "codex sol" and "openai sol" both mean Sol; "claude opus" and "anthropic opus" both mean Opus.+ - Any name with no version means its newest listed member — a family word like "opus" and a nickname like "luna" alike. Take the highest-numbered entry carrying that name, never the first one you see. Read the versions as decimals: 5 is newer than 4.8, and 6 is newer than 5.6.- A runtime or vendor standing alone names no model: "run this on codex", "use anthropic" → null. A model id that happens to end in "codex" is a different thing, and needs its version said out loud to be chosen.Answer with nulls when a model or effort is merely part of the subject matter — this is the common mistake, so check for it:- "add claude-fable-5 to our model picker" (a code change that names a model).- "move the summary agents over to sonnet" (a code change that switches something else onto a model, not this task).- "why is gpt-5 slower than opus in our evals?" (a question about models).+ - "how long does a scout take on sol 6.1, compared with terra?" (a request for data about models: the models are what gets measured, not what runs this task).- "the opus rollout broke the dashboard" (a topic).- "reasoning about this is hard" (the word, not a setting).- "we tried sonnet on this last week and it kept timing out" (an account of a run that already happened, not an instruction for this one — past tense is the tell).+ A question or a data request about a model — its cost, speed, token use, error rate, or how it compares with other models — is subject matter. This stays true when the model name comes after "for", "via", "on", or "with". To change the run, the message must also tell you to run this task on that model.+Rules for the fields:- model: an id from the list above, or null if the author named no model (or named one that isn't listed).- reasoning_effort: only when the author explicitly asks for an effort level, and only a value listed for that model. Otherwise null.diff --git a/products/slack_app/evals/eval_model_classifier.py b/products/slack_app/evals/eval_model_classifier.pyindex c2459bc843c7..d4413ae0a5a3 100644--- a/products/slack_app/evals/eval_model_classifier.py+++ b/products/slack_app/evals/eval_model_classifier.py@@ -65,6 +65,7 @@ CHOICES: tuple[ModelChoice, ...] = (ModelChoice("codex", "gpt-5.6-terra", "GPT-5.6 Terra", _MAX),ModelChoice("codex", "gpt-5.6-luna", "GPT-5.6 Luna", _MAX),ModelChoice("codex", "gpt-6.1-sol", "GPT-6.1 Sol", _MAX),+ ModelChoice("codex", "gpt-6-luna", "GPT-6 Luna", _MAX),ModelChoice("codex", "gpt-5.5", "GPT-5.5", _XHIGH),ModelChoice("codex", "gpt-5.4", "GPT-5.4", _STANDARD),ModelChoice("codex", "gpt-5.3-codex", "GPT-5.3 Codex", _STANDARD),@@ -103,7 +104,7 @@ INSTRUCTION_CASES = [BaseEvalCase(name="colloquial_model_name",prompt="@PostHog do this one with luna: add a loading state to the cohort picker",- expected=_asks(model="gpt-5.6-luna"),+ expected=_asks(model="gpt-6-luna"),),BaseEvalCase(name="instruction_with_model_also_as_subject",@@ -119,12 +120,18 @@ INSTRUCTION_CASES = [BaseEvalCase(name="runtime_qualified_model",prompt="@PostHog can you investigate using codex sol on high",- expected=_asks(model="gpt-5.6-sol", reasoning_effort="high"),+ expected=_asks(model="gpt-6.1-sol", reasoning_effort="high"),),BaseEvalCase(name="vendor_qualified_model",prompt="@PostHog use openai luna and work out why the nightly export job stalls at 90%",- expected=_asks(model="gpt-5.6-luna"),+ expected=_asks(model="gpt-6-luna"),+ ),+ # People write the version after the nickname as often as before it.+ BaseEvalCase(+ name="version_after_nickname",+ prompt="@PostHog why does the cohort export stop at 10k rows? use luna 6 for this one",+ expected=_asks(model="gpt-6-luna"),),BaseEvalCase(name="decimal_model_version",@@ -191,6 +198,19 @@ SUBJECT_MATTER_CASES = [prompt="@PostHog why is opus 5 slower than sonnet 5 on our eval suite? dig into the traces",expected=_asks(),),+ # A data question about a fleet of models, often asked inside a thread where the agent+ # already runs. A model after "for" or "via" reads like a run instruction, and in a+ # running thread a false positive on the other runtime is answered with a refusal.+ BaseEvalCase(+ name="metrics_question_about_model",+ prompt="@PostHog what are the p50 and p95 token counts for sol 6.1 runs, next to every other model in the fleet?",+ expected=_asks(),+ ),+ BaseEvalCase(+ name="cost_breakdown_names_model",+ prompt="@PostHog split last week's spend per run by model, and show where luna 6 lands via the scout view",+ expected=_asks(),+ ),BaseEvalCase(name="model_as_incident_topic",prompt="@PostHog the fable rollout broke the usage dashboard last night, can you find what changed",