File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -703,6 +703,36 @@ describe("handleModelsCommand", () => {
703703 expect ( authLabelParams . acceptedProviderIds ) . toEqual ( [ "openai-codex" ] ) ;
704704 } ) ;
705705
706+ it ( "keeps custom OpenAI-compatible model list labels on OpenAI auth" , async ( ) => {
707+ modelAuthLabelMocks . resolveModelAuthLabel . mockImplementation ( ( params : unknown ) => {
708+ const acceptedProviderIds = ( params as { acceptedProviderIds ?: string [ ] } )
709+ . acceptedProviderIds ;
710+ return acceptedProviderIds ?. [ 0 ] === "openai"
711+ ? "api-key (env: OPENAI_API_KEY)"
712+ : "oauth (codex-runtime)" ;
713+ } ) ;
714+
715+ const result = await handleModelsCommand (
716+ buildParams ( "/models openai" , {
717+ models : {
718+ providers : {
719+ openai : {
720+ baseUrl : "https://proxy.example.test/v1" ,
721+ models : [ ] ,
722+ } ,
723+ } ,
724+ } ,
725+ } ) ,
726+ true ,
727+ ) ;
728+
729+ expect ( result ?. reply ?. text ) . toContain ( "Models (openai · 🔑 api-key (env: OPENAI_API_KEY))" ) ;
730+ const [ [ authLabelParams ] ] = modelAuthLabelMocks . resolveModelAuthLabel . mock
731+ . calls as unknown as Array < [ { provider ?: string ; acceptedProviderIds ?: string [ ] } ] > ;
732+ expect ( authLabelParams . provider ) . toBe ( "openai" ) ;
733+ expect ( authLabelParams . acceptedProviderIds ) . toEqual ( [ "openai" ] ) ;
734+ } ) ;
735+
706736 it ( "uses spawned workspace for direct /models provider visibility" , async ( ) => {
707737 modelProviderAuthMocks . authenticatedProviders = new Set ( [ "anthropic" ] ) ;
708738 const params = buildParams ( "/models" ) ;
You can’t perform that action at this time.
0 commit comments