Skip to content

The agent that grows with you

fix(agent): keep context_length pin for named custom providers

xxxigm3a0a2951099d
diff --git a/agent/agent_init.py b/agent/agent_init.py
index ad6b0eb00af..649d5338a99 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -209,7 +209,18 @@ def _context_route_mismatch(
if active_route:
configured_routes = _provider_default_routes(configured_provider)
- return not configured_routes or active_route not in configured_routes
+ if configured_routes:
+ return active_route not in configured_routes
+ # Named/custom providers have no catalog default routes. An empty
+ # configured URL with a matching provider identity is still the same
+ # route — agent_init fills base_url from custom_providers before this
+ # check, but gateway display/hygiene paths historically compared the
+ # raw empty model.base_url and falsely dropped model.context_length,
+ # falling through to family defaults (e.g. qwen → 131072) on Discord
+ # session-reset banners while /status still showed the config pin.
+ if active_provider and configured_provider == active_provider:
+ return False
+ return True
return bool(
configured_provider
and active_provider