bug(providers): Cannot hide models on provider page due to hardcoded modality: chat and UI selector mismatch
Bug: Cannot hide models on provider page (modality mismatch & UI selector bug)
Description
On provider details pages (e.g. /dashboard/providers/codex), clicking the "Hide" toggle on models appears to succeed (returns 200 OK), but the UI immediately shows the model as visible again, and the model is not properly hidden.
Root Cause Analysis
Tracing the execution flow in diegosouzapw/omniroute:next:
Frontend hardcodes
"modality": "chat": On/dashboard/providers/[id], the hide toggle handlerhandleToggleModelHiddenissues:PATCH /api/provider-models?provider=${provider}&modelId=${modelId} Body: { "isHidden": true, "modality": "chat" }Backend only sets
hiddenModalities[modality], omittingisHidden: In thePATCH /api/provider-modelshandler (modelCompatOverridesupdater):if ("isHidden" in c) { let a = typeof c.modality === "string" && c.modality ? c.modality : null; if (a) { let b = { ...(f.hiddenModalities || {}) }; null === c.isHidden ? delete b[a] : (b[a] = !!c.isHidden); f.hiddenModalities = b; } else { f.isHidden = !!c.isHidden; } }Because
modality: "chat"is sent in the body, it only recordsf.hiddenModalities = { chat: true }. Top-levelf.isHiddenremainsundefined(or unchanged).Frontend UI selector
B(e)only readse.isHidden: In module27522, the helper that determines if a model is hidden:function B(e) { if (e && Object.prototype.hasOwnProperty.call(e, "isHidden")) { return !!e.isHidden; } }B(e)never inspectse.hiddenModalities. Sincee.isHiddenis undefined, the UI immediately renders the model as visible/unhidden after the state refresh.Non-chat provider mismatch (e.g., Codex): Providers like Codex use
apiFormat: "responses"rather than"chat". MarkinghiddenModalities.chat = truedoes not hide a responses-based model from consumers targeting its native endpoint format.
Expected Behavior
- Clicking "Hide" on a provider's model should set top-level
isHidden = truewhen toggled from the provider model list, or the frontend should omitmodalitywhen hiding the model globally for that provider connection. - The UI selector
B(e)should be consistent with how the backend determines model visibility.
Source: diegosouzapw/OmniRoute