From 95f1996c19a4f7c80b878227e59b7db1a2c8c89d Mon Sep 17 00:00:00 2001 From: ciregenz Date: Mon, 6 Jul 2026 18:09:34 -0700 Subject: [PATCH] [eric] distill: use the reliable cheap aux tier, not the chat's family (gemini/codex sessions 404'd/401'd the same-family aux) --- backend/apps/agents/manager/session/distill_history.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/apps/agents/manager/session/distill_history.py b/backend/apps/agents/manager/session/distill_history.py index 95e65312..f9227539 100644 --- a/backend/apps/agents/manager/session/distill_history.py +++ b/backend/apps/agents/manager/session/distill_history.py @@ -93,12 +93,11 @@ async def distilled_history_summary(session: AgentSession, settings: AppSettings @typechecked async def p_call_distiller(session: AgentSession, settings: AppSettings, body: str) -> str: - from backend.apps.agents.providers.registry import resolve_aux_model, get_api_type + from backend.apps.agents.providers.registry import resolve_aux_model from backend.apps.settings.credentials import get_anthropic_client_for_model - aux_model, _ = await resolve_aux_model( - settings, preferred_tier="haiku", primary_api=get_api_type(session.model), - ) + # No primary_api: a background summary wants the most RELIABLE cheap tier, not the chat's family. Forcing the family routed a gemini/codex chat's distill onto a same-family aux that 404s (gemini-direct google endpoint the Anthropic client can't call) or 401s (codex token rotation); the proven classifier omits it too and resolves to whatever anthropic-compatible lane the user has. + aux_model, _ = await resolve_aux_model(settings, preferred_tier="haiku") client = get_anthropic_client_for_model(settings, aux_model) resp = await client.messages.create( model=aux_model,