: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 the project classifier routing on ownership (#103928)
Vojta Bartoš07d3cad3be94
diff --git a/posthog/temporal/ai/slack_app/activities/classifiers.py b/posthog/temporal/ai/slack_app/activities/classifiers.pyindex 6f9d122042c8..233be2a0d1b9 100644--- a/posthog/temporal/ai/slack_app/activities/classifiers.py+++ b/posthog/temporal/ai/slack_app/activities/classifiers.py@@ -583,9 +583,15 @@ class _ProjectRouteReply(BaseModel):project_id: int | None = None-def classify_slack_app_project_route(event_text: str, projects: list[Integration]) -> Integration | None:+def classify_slack_app_project_route(+ event_text: str, projects: list[Integration], default: Integration | None = None+) -> Integration | None:"""Read the project a mention asked to be answered from, out of its text.+ ``default`` is the project the run is already on. It heads the list the model is+ shown and is marked there, so that staying put is a visible choice rather than the+ absence of one.+Returns ``None`` when the author named none, which is the overwhelming majority ofmentions, and on a reply this cannot parse.@@ -599,9 +605,14 @@ def classify_slack_app_project_route(event_text: str, projects: list[Integrationwhere the answer has to come from, because that is where the data lives. Quality onthat is measured by ``products/slack_app/evals/eval_project_classifier.py``."""+ # Named to the model by id rather than by a marker on its line: a team may be called+ # anything, including whatever that marker would have been.+ if default is not None and not any(p.id == default.id for p in projects):+ default = Noneprompt = prompts.render("project_route",- projects=format_project_candidate_list(projects),+ projects=format_project_candidate_list(projects, first=default),+ default_id=default.team_id if default is not None else None,event_text=event_text,)@@ -667,7 +678,7 @@ def classify_slack_app_project_route_activity(input: SlackAppProjectRouteInput)return Nonetry:- chosen = classify_slack_app_project_route(input.event_text, projects)+ chosen = classify_slack_app_project_route(input.event_text, projects, default=integration)except Exception:# The fallback boundary: a mention we cannot classify stays on the project# routing already resolved, which is what it would have done anyway.diff --git a/posthog/temporal/ai/slack_app/activities/prompts/project_route.md.j2 b/posthog/temporal/ai/slack_app/activities/prompts/project_route.md.j2index 709f018af318..47472fbcb0ad 100644--- a/posthog/temporal/ai/slack_app/activities/prompts/project_route.md.j2+++ b/posthog/temporal/ai/slack_app/activities/prompts/project_route.md.j2@@ -1,9 +1,17 @@-You are routing a Slack message addressed to the PostHog agent. This Slack workspace is connected to several PostHog projects, each holding separate data, and this message opens a new thread. Decide which project it should be answered from.+You are routing a Slack message addressed to the PostHog agent. This Slack workspace is connected to several PostHog projects, each holding separate data, and this message opens a new thread. Decide which project it should be answered from, or that it names none.++You are not deciding who owns the work, or whose area the message touches. Only where the data an answer needs is held. A message that asks for no data names no project.Only these projects can be selected, and the id is the number:{{ projects }}-Most messages name no project at all, and null is the answer for those. Only name one when the message points at it.+{% if default_id %}This message is already going to be answered from `{{ default_id }}`, the first on that list. Null leaves it there — a real choice, and the right one far more often than not.++{% endif %}Most messages name no project at all, and null is the answer for those. Only name one when the message points at it.++Before you answer with an id, find the words in this message that name that project — its name, or its number. If you cannot point to them, the answer is null. A message that shares a subject with a project, or asks for work a project's team does, has not named it, however sure you are about whose desk it lands on.++A number counts only where it is written as a project: "in project 42", "for 42", or a `/project/42/` link. Messages carry counts, percentages, ids, version numbers and error codes, and any of them may happen to equal a project id. A bare number names no project, however exactly it matches.Name a project when the message says where to look:- "check the error rate on Fernwood staging", "in the website project, why did signups drop", "for production, which exports failed yesterday".@@ -13,11 +21,12 @@ Name a project when the message says where to look:Answer with null when the project is the thing being worked on rather than the place to look:- "rename the Website project", "add staging to the project dropdown" (a project as the object of a change).- "we should split staging and production" (a proposal about projects).+ - "update the reply this agent sends", "fix the skill so it stops truncating" (a request to change the agent's own behaviour or output). The project whose team owns that work is not where the answer comes from, because the request asks for no data at all.- A word that only happens to match a project name. With a project called "Website", "the website is down" names no project.- "I already checked staging, look at the SDK instead" (an account of a place already ruled out — past tense is the tell).- Two projects at once, as in "compare staging and production". One task answers from one project, and picking one of the two on a guess is worse than staying on the default.-When you are unsure, answer with null — the default is the right place to look.+When you are unsure, answer with null — the default is the right place to look. Null is equally the answer when you are certain whose work a message is but it named no project: confidence about the owner is not evidence about the data.Message: {{ event_text }}diff --git a/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_project_route.ambr b/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_project_route.ambrindex 9cafa4e0738b..87cbbab33dfd 100644--- a/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_project_route.ambr+++ b/posthog/temporal/tests/ai/slack_app/activities/__snapshots__/test_classify_slack_app_project_route.ambr@@ -1,14 +1,22 @@# serializer version: 1# name: TestClassifySlackAppProjectRoute.test_prompt_snapshot_matches'''- You are routing a Slack message addressed to the PostHog agent. This Slack workspace is connected to several PostHog projects, each holding separate data, and this message opens a new thread. Decide which project it should be answered from.+ You are routing a Slack message addressed to the PostHog agent. This Slack workspace is connected to several PostHog projects, each holding separate data, and this message opens a new thread. Decide which project it should be answered from, or that it names none.++ You are not deciding who owns the work, or whose area the message touches. Only where the data an answer needs is held. A message that asks for no data names no project.Only these projects can be selected, and the id is the number:- • `41` — Northwind · Staging• `42` — Northwind · Production+ • `41` — Northwind · Staging++ This message is already going to be answered from `42`, the first on that list. Null leaves it there — a real choice, and the right one far more often than not.Most messages name no project at all, and null is the answer for those. Only name one when the message points at it.+ Before you answer with an id, find the words in this message that name that project — its name, or its number. If you cannot point to them, the answer is null. A message that shares a subject with a project, or asks for work a project's team does, has not named it, however sure you are about whose desk it lands on.++ A number counts only where it is written as a project: "in project 42", "for 42", or a `/project/42/` link. Messages carry counts, percentages, ids, version numbers and error codes, and any of them may happen to equal a project id. A bare number names no project, however exactly it matches.+Name a project when the message says where to look:- "check the error rate on Fernwood staging", "in the website project, why did signups drop", "for production, which exports failed yesterday".- The project can be named anywhere in the sentence, and the rest of the message is still the request.@@ -17,11 +25,12 @@Answer with null when the project is the thing being worked on rather than the place to look:- "rename the Website project", "add staging to the project dropdown" (a project as the object of a change).- "we should split staging and production" (a proposal about projects).+ - "update the reply this agent sends", "fix the skill so it stops truncating" (a request to change the agent's own behaviour or output). The project whose team owns that work is not where the answer comes from, because the request asks for no data at all.- A word that only happens to match a project name. With a project called "Website", "the website is down" names no project.- "I already checked staging, look at the SDK instead" (an account of a place already ruled out — past tense is the tell).- Two projects at once, as in "compare staging and production". One task answers from one project, and picking one of the two on a guess is worse than staying on the default.- When you are unsure, answer with null — the default is the right place to look.+ When you are unsure, answer with null — the default is the right place to look. Null is equally the answer when you are certain whose work a message is but it named no project: confidence about the owner is not evidence about the data.Message: how many signups on staging yesterdaydiff --git a/posthog/temporal/tests/ai/slack_app/activities/test_classify_slack_app_project_route.py b/posthog/temporal/tests/ai/slack_app/activities/test_classify_slack_app_project_route.pyindex 60b4d506c438..0e787cf8bc32 100644--- a/posthog/temporal/tests/ai/slack_app/activities/test_classify_slack_app_project_route.py+++ b/posthog/temporal/tests/ai/slack_app/activities/test_classify_slack_app_project_route.py@@ -88,6 +88,52 @@ class TestClassifySlackAppProjectRoute:assert options["timeout"] < POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDSassert options["max_retries"] * options["timeout"] < POSTHOG_CODE_SLACK_MENTION_TIMEOUT_SECONDS+ def test_default_heads_the_list_and_is_named_by_id(self):+ prompt = self._prompt_for(PROJECTS, PRODUCTION)++ assert self._offered(prompt)[0] == "• `42` — Northwind · Production"+ assert "answered from `42`" in prompt++ def test_no_default_leaves_the_order_alone_and_says_nothing(self):+ prompt = self._prompt_for(PROJECTS, None)++ assert self._offered(prompt)[0] == "• `41` — Northwind · Staging"+ assert "already going to be answered from" not in prompt++ def test_a_team_named_like_the_marker_cannot_pose_as_the_default(self):+ # Team names are tenant text and may be anything, so a name is never the place to+ # put a marker on. The default is named by id, away from the list.+ impostor = _project(team_id=43, integration_id=430, name="Production (default)")+ prompt = self._prompt_for([STAGING, impostor], STAGING)++ assert self._offered(prompt) == [+ "• `41` — Northwind · Staging",+ "• `43` — Northwind · Production (default)",+ ]+ assert "answered from `41`" in prompt++ def test_a_default_outside_the_candidates_is_not_offered(self):+ # The list and the reply schema's enum have to name the same projects, and the+ # enum is built from the candidates alone.+ outsider = _project(team_id=44, integration_id=440, name="Elsewhere")+ fake_client = self._fake_client('{"project_id": null}')+ with patch(CLASSIFIER, return_value=fake_client):+ classify_slack_app_project_route("check staging", PROJECTS, outsider)++ kwargs = fake_client.chat.completions.create.call_args.kwargs+ assert "Elsewhere" not in kwargs["messages"][0]["content"]+ assert "already going to be answered from" not in kwargs["messages"][0]["content"]+ assert kwargs["response_format"]["json_schema"]["schema"]["properties"]["project_id"]["enum"] == [41, 42, None]++ def _prompt_for(self, projects: list[Integration], default: Integration | None) -> str:+ fake_client = self._fake_client('{"project_id": null}')+ with patch(CLASSIFIER, return_value=fake_client):+ classify_slack_app_project_route("check staging", projects, default)+ return fake_client.chat.completions.create.call_args.kwargs["messages"][0]["content"]++ def _offered(self, prompt: str) -> list[str]:+ return [line for line in prompt.splitlines() if line.startswith("• ")]+def test_prompt_snapshot_matches(self, snapshot):"""The prompt is the whole classifier — the projects it offers, thewhere-to-look versus what-to-change examples, and the reply contract. Pinning it@@ -97,7 +143,7 @@ class TestClassifySlackAppProjectRoute:"""fake_client = self._fake_client('{"project_id": null}')with patch(CLASSIFIER, return_value=fake_client):- classify_slack_app_project_route("how many signups on staging yesterday", PROJECTS)+ classify_slack_app_project_route("how many signups on staging yesterday", PROJECTS, PRODUCTION)assert fake_client.chat.completions.create.call_args.kwargs["messages"][0]["content"] == snapshotdef _fake_client(self, content: str) -> MagicMock:diff --git a/products/slack_app/backend/services/integration_resolver.py b/products/slack_app/backend/services/integration_resolver.pyindex 58c0e27712cc..2cb431657c3e 100644--- a/products/slack_app/backend/services/integration_resolver.py+++ b/products/slack_app/backend/services/integration_resolver.py@@ -94,7 +94,22 @@ def project_label(integration: Integration) -> str:return f"{integration.team.organization.name} · {integration.team.name}"-def format_project_candidate_list(candidates: list[Integration]) -> str:+def format_project_candidate_list(candidates: list[Integration], *, first: Integration | None = None) -> str:+ """One line per project, ``first`` at the head of the list.++ The order is otherwise ``check_integrations_auth_and_filter``'s, which sorts by+ freshest auth verdict and so reshuffles as cache entries expire. Leading with the+ project a caller is already on gives the list its one stable landmark.++ Every line carries the project's own name and nothing else. A caller marking one of+ them says so around the list, by id, because a team may be called anything at all —+ including whatever that marker would have been.++ ``first`` outside ``candidates`` is ignored rather than prepended: for the classifier+ this list and the reply schema's enum have to offer the same projects.+ """+ if first is not None and any(c.id == first.id for c in candidates):+ candidates = [first, *(c for c in candidates if c.id != first.id)]return "\n".join(f"• `{c.team_id}` — {project_label(c)}" for c in candidates)diff --git a/products/slack_app/evals/eval_project_classifier.py b/products/slack_app/evals/eval_project_classifier.pyindex 569e45f44fef..5fe57e273f32 100644--- a/products/slack_app/evals/eval_project_classifier.py+++ b/products/slack_app/evals/eval_project_classifier.py@@ -12,6 +12,15 @@ rephrases. An invented project answers a different question in a shape that readanswer to this one. `NoUnaskedProjectSwitch` is therefore the number to watch, not theoverall rate.+The prompt is the only thing standing between a mention and a wrong project, so this suite+is the whole of the quality signal. Nothing downstream second-guesses the answer: an id the+model returns is an id the run is moved to.++Most cases run with the project the run is already on offered as the default, which is how+a mention usually arrives. `NO_DEFAULT_CASES` repeats five of them with none, the shape a+mention takes when the resolved install is one `routable_projects` drops. Same message on+either side, so a difference in the answers is the default's doing and nothing else.+The projects below are invented, and the phrasings with them. No customer's project namesor messages appear here.@@ -58,13 +67,53 @@ def _project(*, team_id: int, integration_id: int, name: str) -> Integration:STAGING = _project(team_id=41, integration_id=410, name="Staging")PRODUCTION = _project(team_id=42, integration_id=420, name="Production")WEBSITE = _project(team_id=43, integration_id=430, name="Website")-PROJECTS = [STAGING, PRODUCTION, WEBSITE]+# The project whose team owns the agent itself. Present because without it the suite+# cannot pose the question the classifier actually got wrong: asked to change how the+# agent behaves, it answered with the owning project instead of with null. A workspace+# with nothing to attribute the work to never offers that temptation.+AGENT_PLATFORM = _project(team_id=44, integration_id=440, name="Agent Platform")+# Real project names carry emoji and more than one word, and nobody types them whole.+MOBILE = _project(team_id=45, integration_id=450, name="📱 Mobile app")+# The project the run is already on, which heads the list the model is shown. No case+# routes to it by accident: nothing below says "main", so every scored switch is a real+# one, and every null is a decision to stay here.+MAIN = _project(team_id=40, integration_id=400, name="Main")+PROJECTS = [STAGING, PRODUCTION, WEBSITE, AGENT_PLATFORM, MOBILE, MAIN]+++# A second workspace, shaped like the one the misroute happened in: thirteen projects,+# several of them plausible homes for work on an AI agent. Six clean candidates turned out+# not to reproduce anything — the model answers those correctly with or without the rules+# this suite is here to measure. The pull towards an owner only appears when several+# owners are on offer and the message reads like their subject matter.+AUTOPILOT = _project(team_id=46, integration_id=460, name="Autopilot")+CROWD = [+ MAIN,+ STAGING,+ PRODUCTION,+ WEBSITE,+ AGENT_PLATFORM,+ MOBILE,+ AUTOPILOT,+ _project(team_id=47, integration_id=470, name="AI labeling suite"),+ _project(team_id=48, integration_id=480, name="Security Review Agent"),+ _project(team_id=49, integration_id=490, name="🧪 Test"),+ _project(team_id=50, integration_id=500, name="DevEx"),+ _project(team_id=51, integration_id=510, name="Demo"),+ _project(team_id=52, integration_id=520, name="Statuspage"),+]++WORKSPACES: dict[str, tuple[list[Integration], Integration]] = {"simple": (PROJECTS, MAIN), "crowded": (CROWD, MAIN)}def _routes_to(project: Integration | None = None) -> dict:return {PROJECT_ROUTE_KEY: {"integration_id": project.id if project else None}}+def _in_the_crowd(**kwargs) -> BaseEvalCase:+ return BaseEvalCase(metadata={"workspace": "crowded"}, **kwargs)++ROUTING_CASES = [BaseEvalCase(name="explicit_on_project",@@ -94,6 +143,56 @@ ROUTING_CASES = [prompt="@PostHog which feature flags haven't been evaluated in a month? staging please",expected=_routes_to(STAGING),),+ BaseEvalCase(+ name="project_id_in_a_pasted_url",+ prompt="@PostHog https://us.posthog.com/project/42/insights/a1b2c3 reads zero since Tuesday, what happened?",+ expected=_routes_to(PRODUCTION),+ ),+ BaseEvalCase(+ name="project_id_written_out",+ prompt="@PostHog answer this from project 43: which pages lost the most traffic last month?",+ expected=_routes_to(WEBSITE),+ ),+ # The counterpart to the ownership cases below, and the reason the fix cannot simply+ # be "never route to the project that owns the agent". A data question about that+ # project is an ordinary routing request and has to be answered from its data.+ BaseEvalCase(+ name="owning_project_asked_a_data_question",+ prompt="@PostHog how many agent runs failed overnight on Agent Platform?",+ expected=_routes_to(AGENT_PLATFORM),+ ),+ BaseEvalCase(+ name="decorated_name_written_short",+ prompt="@PostHog how many crashes did the mobile app see after Thursday's release?",+ expected=_routes_to(MOBILE),+ ),+ BaseEvalCase(+ name="possessive_form",+ prompt="@PostHog what is staging's event volume today compared with a week ago?",+ expected=_routes_to(STAGING),+ ),+ BaseEvalCase(+ name="named_with_from",+ prompt="@PostHog from production, list the ten slowest queries this morning",+ expected=_routes_to(PRODUCTION),+ ),+ BaseEvalCase(+ name="named_only_in_a_url",+ prompt="@PostHog https://us.posthog.com/project/45/replay/abc — is this session typical of the crash?",+ expected=_routes_to(MOBILE),+ ),+ # The default is nameable like any other project, and saying so is not a mistake.+ BaseEvalCase(+ name="default_named_explicitly",+ prompt="@PostHog in Main, how many weekly active users did we finish the month on?",+ expected=_routes_to(MAIN),+ ),+ # The run is on the default already, so a project named alongside it still wins.+ BaseEvalCase(+ name="named_project_beside_the_default",+ prompt="@PostHog I know we usually look at Main, but check the paywall conversion on website",+ expected=_routes_to(WEBSITE),+ ),]NO_ROUTE_CASES = [@@ -134,6 +233,163 @@ NO_ROUTE_CASES = [prompt="@PostHog the checkout funnel drops 40% between steps 2 and 3, can you work out why",expected=_routes_to(),),+ BaseEvalCase(+ name="change_the_agents_own_wordiness",+ prompt="@PostHog you're far too wordy when nothing is wrong, edit this scout to keep quiet weeks short",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="change_where_the_agent_puts_a_link",+ prompt="@PostHog your last answer buried the link at the bottom, put it up top from now on",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="change_the_agents_house_style",+ prompt="@PostHog stop using em-dashes in the summaries you post, they read badly on mobile",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="subject_matter_overlap_without_a_name",+ prompt=(+ "@PostHog we said this was fine once already, stop raising it: 806,431 of 2,774,905 rows "+ "are missing a request id, which blocks trace lookup"+ ),+ expected=_routes_to(),+ ),+ # A count, a percentage, a version and an error code, each exactly equal to an offered+ # project id. Numbers are only a project where the message says they are.+ BaseEvalCase(+ name="bare_number_is_a_count",+ prompt="@PostHog 42 people hit the paywall twice yesterday, is that expected?",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="bare_number_is_a_version",+ prompt="@PostHog crashes jumped after 41 shipped, can you confirm before I roll it back?",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="bare_number_is_an_error_code",+ prompt="@PostHog we're seeing a lot of 43s in the exporter logs, worth worrying about?",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="asks_who_owns_something",+ prompt="@PostHog who looks after the ingestion pipeline these days, and who should I take this to?",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="change_where_the_agent_answers",+ prompt="@PostHog reply in the thread next time instead of DMing me, I lost the last one",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="complains_about_the_agents_routing",+ prompt="@PostHog why did you answer my last question from somewhere else entirely? sort that out",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="agent_capability_question",+ prompt="@PostHog can you open pull requests on your own, or do you only ever comment?",+ expected=_routes_to(),+ ),+ # A project that does not exist yet cannot be where an answer comes from.+ BaseEvalCase(+ name="hypothetical_project",+ prompt="@PostHog if we split the mobile app out into its own project later, what breaks?",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="url_to_another_service",+ prompt="@PostHog https://github.com/Northwind/northwind/pull/4821 — can you review this before standup?",+ expected=_routes_to(),+ ),+ # An id that belongs to nothing on the list, offered as bait.+ BaseEvalCase(+ name="unoffered_id_in_the_message",+ prompt="@PostHog pull last week's retention from project 987654",+ expected=_routes_to(),+ ),+ BaseEvalCase(+ name="staying_put_said_out_loud",+ prompt="@PostHog keep this where it is and tell me which dashboards nobody opened this quarter",+ expected=_routes_to(),+ ),+ # The shape of the mention that misrouted, in a workspace shaped like the one it+ # misrouted in. Dense, numeric, unmistakably about an AI agent, and naming no project.+ _in_the_crowd(+ name="crowded_change_the_agents_own_wordiness",+ prompt=(+ "@PostHog Seems like you're too wordy for telling us everything is business as usual. Could you "+ "please edit this scout to be less wordy when nothing is actionable?\n\nAlso, for the following "+ "point, if we said it's fine, let's not mention it again:\n> The known gateway identifier gap "+ "persists: 806,431 of 2,774,905 summarization rows (29.1%) and 18,662 of 64,118 clustering rows "+ "(29.1%) lacked a gateway request ID. This blocks reliable trace lookup and request-level "+ "attribution."+ ),+ expected=_routes_to(),+ ),+ _in_the_crowd(+ name="crowded_change_the_agents_reply",+ prompt=(+ "@PostHog the bot can hand out discount codes. The reply it sends is missing the clickable URL an "+ "end user needs. Can you update the bottom section to include one, and drop the em-dash?"+ ),+ expected=_routes_to(),+ ),+ _in_the_crowd(+ name="crowded_agent_evaluation_question",+ prompt="@PostHog which of your evaluations regressed this week, and can you make the scorer stricter?",+ expected=_routes_to(),+ ),+]++# Crowding must not cost the classifier a project the author did name.+CROWDED_ROUTING_CASES = [+ _in_the_crowd(+ name="crowded_explicit_on_project",+ prompt="@PostHog how many signups did we get on Northwind staging yesterday?",+ expected=_routes_to(STAGING),+ ),+ _in_the_crowd(+ name="crowded_owning_project_asked_a_data_question",+ prompt="@PostHog how many agent runs failed overnight on Autopilot?",+ expected=_routes_to(AUTOPILOT),+ ),+]++# A mention normally arrives with the resolved project on offer as the default, but not+# always: `routable_projects` drops an install the bot cannot post into, and the project+# the run is on can be that one. The model then sees the list in the auth filter's own+# order and no sentence naming where it already is.+_CASES_BY_NAME = {case.name: case for case in [*ROUTING_CASES, *NO_ROUTE_CASES, *CROWDED_ROUTING_CASES]}+++def _without_a_default(name: str) -> BaseEvalCase:+ """The same message again, with nothing marked as the default.++ Same text on purpose. Holding the message fixed and removing the default is what+ isolates the sentence's effect on the answer; two different messages would only show+ that two different messages score differently.+ """+ case = _CASES_BY_NAME[name]+ return case.model_copy(+ update={"name": f"{name}_without_a_default", "metadata": {**case.metadata, "default": "none"}}+ )+++NO_DEFAULT_CASES = [+ _without_a_default(name)+ for name in (+ "explicit_on_project",+ "project_id_in_a_pasted_url",+ "change_the_agents_own_wordiness",+ "subject_matter_overlap_without_a_name",+ "no_project_mentioned",+ "crowded_change_the_agents_own_wordiness",+ "crowded_change_the_agents_reply",+ "crowded_explicit_on_project",+ )]@@ -143,10 +399,12 @@ async def eval_project_classifier(ctx: EvalContext) -> None:try:# Sync, and blocking on the gateway — keep it off the event loop so cases# still run concurrently under the harness's limiter.+ projects, resolved = WORKSPACES[case.metadata.get("workspace", "simple")]chosen = await asyncio.to_thread(classifiers.classify_slack_app_project_route,case.prompt,- PROJECTS,+ projects,+ None if case.metadata.get("default") == "none" else resolved,)except Exception as error:return {@@ -162,7 +420,7 @@ async def eval_project_classifier(ctx: EvalContext) -> None:await OneShotPublicEval(experiment_name="slack-app-project-classifier",- cases=[*ROUTING_CASES, *NO_ROUTE_CASES],+ cases=[*ROUTING_CASES, *CROWDED_ROUTING_CASES, *NO_ROUTE_CASES, *NO_DEFAULT_CASES],scorers=[ProjectRouteMatch(), NoUnaskedProjectSwitch()],task=task,ctx=ctx,