21d28dfe00
build_model_state dropped every inventory row whose slug name matched a named `providers:` entry and relabelled the current provider `custom:<key>` unconditionally. When a `providers:` key shadows a canonical provider name (providers.openrouter: -> proxy with a models: list), a session genuinely running on openrouter.ai lost all canonical rows and its current id became custom:openrouter:..., which resolves to the proxy base_url — picking the "current" row silently re-routed the session to a different endpoint. Only rows flagged is_user_defined are replaced by the named catalogs now, and the current provider is promoted to custom:<key> only when the session base_url matches that entry's api_url or no canonical row for the raw key exists (the reported relay/MixedCase class keeps its custom:<key> id). Review finding: named entry shadowing a canonical provider dropped canonical rows and re-routed the current session to the proxy.