mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
2b488cd5ae
The AI Sessions page Provider column displayed the wrong provider when a session contained interceptions from multiple providers. This happened because providers were aggregated with ARRAY_AGG(DISTINCT ... ORDER BY provider), which sorts alphabetically. Since 'anthropic' < 'openai', a single Anthropic Haiku title-generation interception would push Anthropic to index 0, even when the session was primarily an OpenAI chat. Replace the alphabetical ARRAY_AGG with a subquery that groups providers by count and orders them most-frequent-first (with alphabetical as tiebreaker). The frontend already displays providers[0], so the primary chat provider now appears correctly. Fixes: AIGOV-403