@@ -1723,6 +1723,55 @@ describe("buildOpenAIProvider", () => {
17231723 ) . toEqual ( { effort : "high" , transport : "sse" } ) ;
17241724 } ) ;
17251725
1726+ it ( "delegates an unlisted first-party model to its explicitly selected Codex runtime" , ( ) => {
1727+ const provider = buildOpenAIProvider ( ) ;
1728+ const model = provider . resolveDynamicModel ?.( {
1729+ provider : "openai" ,
1730+ modelId : "gpt-future" ,
1731+ modelRegistry : { find : ( ) => null } ,
1732+ agentRuntimeId : "codex" ,
1733+ } as never ) ;
1734+
1735+ expect ( model ) . toMatchObject ( {
1736+ provider : "openai" ,
1737+ id : "gpt-future" ,
1738+ api : "openai-chatgpt-responses" ,
1739+ baseUrl : "https://chatgpt.com/backend-api/codex" ,
1740+ compat : { supportedReasoningEfforts : [ "low" , "medium" , "high" , "xhigh" , "max" ] } ,
1741+ } ) ;
1742+ expect (
1743+ provider
1744+ . resolveThinkingProfile ?.( {
1745+ provider : "openai" ,
1746+ modelId : "gpt-future" ,
1747+ agentRuntime : "codex" ,
1748+ api : model ?. api ,
1749+ compat : model ?. compat ,
1750+ } as never )
1751+ ?. levels . map ( ( level ) => level . id ) ,
1752+ ) . toContain ( "max" ) ;
1753+ } ) ;
1754+
1755+ it ( "does not invent an unlisted model for authored Platform credentials" , ( ) => {
1756+ const provider = buildOpenAIProvider ( ) ;
1757+
1758+ expect (
1759+ provider . resolveDynamicModel ?.( {
1760+ provider : "openai" ,
1761+ modelId : "gpt-future" ,
1762+ modelRegistry : { find : ( ) => null } ,
1763+ agentRuntimeId : "codex" ,
1764+ authProfileId : "openai:platform" ,
1765+ authProfileMode : "api_key" ,
1766+ providerConfig : {
1767+ auth : "api-key" ,
1768+ api : "openai-responses" ,
1769+ baseUrl : "https://api.openai.com/v1" ,
1770+ } ,
1771+ } as never ) ,
1772+ ) . toBeUndefined ( ) ;
1773+ } ) ;
1774+
17261775 it ( "restores gpt-5.3-codex-spark only through ChatGPT/Codex OAuth routing" , ( ) => {
17271776 const provider = buildOpenAIProvider ( ) ;
17281777
0 commit comments