@@ -14,6 +14,7 @@ import {
1414 isMaxReasoningCodexModel ,
1515 isModernCodexModel ,
1616 readCodexSupportedReasoningEfforts ,
17+ resolveCodexFallbackReasoningEfforts ,
1718 resolveCodexSupportedReasoningEffort ,
1819 type CodexReasoningEffort ,
1920} from "../../provider.js" ;
@@ -1868,13 +1869,10 @@ export function resolveCodexAppServerModelProvider(params: {
18681869 return normalizedLower === "openai" ? "openai" : normalized ;
18691870}
18701871
1871- // Modern Codex models (gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.3-codex-spark) use the
1872- // none/low/medium/high/xhigh effort enum and reject "minimal". The CLI
1873- // defaults thinkLevel to "minimal", so without translation EVERY agent turn
1874- // on those models pays a wasted first request + retry-with-low fallback in
1875- // embedded-agent-runner. Map "minimal" -> "low" upfront for modern models so the
1876- // first request is accepted. Older Codex models still accept "minimal"
1877- // directly. (#71946)
1872+ // Modern Codex models reject the legacy CLI `minimal` default. Prefer
1873+ // app-server metadata, then use the provider-owned fallback effort contract
1874+ // for Pro models whose minimum supported effort is `medium`.
1875+ // Other modern models translate `minimal` to `low`. (#71946)
18781876// Exported for unit-test coverage of the model-aware translation path.
18791877export function resolveReasoningEffort (
18801878 thinkLevel : EmbeddedRunAttemptParams [ "thinkLevel" ] ,
@@ -1892,6 +1890,15 @@ export function resolveReasoningEffort(
18921890 } ) ?? null
18931891 ) ;
18941892 }
1893+ const fallbackReasoningEfforts = resolveCodexFallbackReasoningEfforts ( modelId ) ;
1894+ if ( fallbackReasoningEfforts ) {
1895+ return (
1896+ resolveCodexSupportedReasoningEffort ( {
1897+ requested : thinkLevel ,
1898+ supportedReasoningEfforts : fallbackReasoningEfforts ,
1899+ } ) ?? null
1900+ ) ;
1901+ }
18951902 if ( thinkLevel === "minimal" ) {
18961903 return isModernCodexModel ( modelId ) ? "low" : "minimal" ;
18971904 }
0 commit comments