Skip to content

Commit 52ff4d8

Browse files
Jonathan Harrisonclaude
andcommitted
fix(router): route on the user's clean query, not the enriched blob
Benchmark surfaced a severe philosophy-routing bias (perspective_routing 56%, with cascade into hallucination_prevention and emotional_intelligence). Root cause: route_and_generate passed the full server-enriched query — user question + injected identity/memory context — to the keyword router. That context is saturated with philosophy/consciousness keywords, so a physics question scored philosophy=16 vs newton=1, sending nearly everything to philosophy. Fix: route adapter selection on extract_primary_user_query(query) (strips the injected context), while generation still uses the full enriched query. Verified deterministically: gravitational->newton, urban loneliness->davinci, job loss->empathy, superposition->quantum, distributed system->systems (all were ->philosophy before). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e1f151a commit 52ff4d8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

inference/codette_orchestrator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,13 @@ def route_and_generate(self, query: str, max_adapters=2,
10681068
strategy="forced",
10691069
)
10701070
else:
1071-
route = self.router.route(query, strategy=strategy,
1071+
# Route on the user's ACTUAL question, not the server-enriched query.
1072+
# The enriched blob carries injected identity/memory context saturated
1073+
# with philosophy/consciousness keywords, which otherwise hijacks routing
1074+
# (e.g. a physics question scored philosophy=16 vs newton=1). Generation
1075+
# still uses the full `query`; only adapter selection uses the clean one.
1076+
routing_query = extract_primary_user_query(query)
1077+
route = self.router.route(routing_query, strategy=strategy,
10721078
max_adapters=max_adapters)
10731079

10741080
print(f"\n Route: {' + '.join(route.all_adapters)} "

0 commit comments

Comments
 (0)