@@ -782,6 +782,9 @@ async function gatherRoutedModelsUncached(
782782 // Enriched (registry-hydrated) provider clones, keyed by name — the same view used above so
783783 // custom rows get the same noVisionModels / inputModalities treatment as discovered rows.
784784 const enrichedByName = new Map ( activeProviders ) ;
785+ // Provider-derived rows keyed by their Codex-facing slug: a custom override replaces the row
786+ // with the same slug below, so that row's provider capability metadata is the inheritance source.
787+ const replacedByRoutedSlug = new Map ( all . map ( model => [ routedSlug ( model . provider , model . id ) , model ] ) ) ;
785788 const customModels = ( config . customModels ?? [ ] ) . map ( cm => {
786789 const rawProvider = config . providers [ cm . provider ] ;
787790 const supportsReasoningSummaries = configuredReasoningSummarySupport ( rawProvider , cm . modelId ) ;
@@ -794,19 +797,38 @@ async function gatherRoutedModelsUncached(
794797 ...( cm . inputModalities ? { inputModalities : cm . inputModalities } : { } ) ,
795798 ...( typeof supportsReasoningSummaries === "boolean" ? { supportsReasoningSummaries } : { } ) ,
796799 } ;
800+ // #962: the dedupe below drops the provider-derived row this custom row replaces. Inherit that
801+ // row's provider capability metadata (reasoning ladder, default effort, parallel tool calls,
802+ // context, ...) so the generated catalog keeps advertising what the router actually provides.
803+ // Explicit custom fields win by construction; this only fills gaps. Without it a
804+ // noReasoningModels model loses its empty ladder and the catalog synthesizes the generic one,
805+ // which Codex then rejects for spawn_agent with effort "none".
806+ const replaced = replacedByRoutedSlug . get ( routedSlug ( cm . provider , cm . modelId ) ) ;
807+ const merged : CatalogModel = replaced ? {
808+ ...base ,
809+ ...( base . contextWindow === undefined && replaced . contextWindow !== undefined ? { contextWindow : replaced . contextWindow } : { } ) ,
810+ ...( base . maxInputTokens === undefined && replaced . maxInputTokens !== undefined ? { maxInputTokens : replaced . maxInputTokens } : { } ) ,
811+ ...( base . inputModalities === undefined && replaced . inputModalities !== undefined ? { inputModalities : replaced . inputModalities } : { } ) ,
812+ ...( base . reasoningEfforts === undefined && replaced . reasoningEfforts !== undefined ? { reasoningEfforts : replaced . reasoningEfforts } : { } ) ,
813+ ...( base . defaultReasoningEffort === undefined && replaced . defaultReasoningEffort !== undefined ? { defaultReasoningEffort : replaced . defaultReasoningEffort } : { } ) ,
814+ ...( base . parallelToolCalls === undefined && replaced . parallelToolCalls !== undefined ? { parallelToolCalls : replaced . parallelToolCalls } : { } ) ,
815+ ...( base . supportsVerbosity === undefined && replaced . supportsVerbosity !== undefined ? { supportsVerbosity : replaced . supportsVerbosity } : { } ) ,
816+ ...( base . supportsReasoningSummaries === undefined && replaced . supportsReasoningSummaries !== undefined ? { supportsReasoningSummaries : replaced . supportsReasoningSummaries } : { } ) ,
817+ ...( base . capabilities === undefined && replaced . capabilities !== undefined ? { capabilities : replaced . capabilities } : { } ) ,
818+ } : base ;
797819 // Vision-sidecar coverage ONLY: if the custom model is in the enriched provider's
798820 // noVisionModels, advertise image input so the Codex app lets images reach the sidecar
799821 // (#349/#344). Deliberately NOT the full applyProviderConfigHints pass — custom rows are a
800822 // user override, so their explicit contextWindow / inputModalities / reasoning fields must be
801823 // preserved verbatim (the hint pass would cap context and overwrite modalities from registry).
802824 const enrichedProvider = enrichedByName . get ( cm . provider ) ?? rawProvider ;
803- if ( enrichedProvider && modelInList ( enrichedProvider . noVisionModels , base . id ) ) {
804- const current = base . inputModalities ?? [ "text" ] ;
825+ if ( enrichedProvider && modelInList ( enrichedProvider . noVisionModels , merged . id ) ) {
826+ const current = merged . inputModalities ?? [ "text" ] ;
805827 if ( ! current . includes ( "image" ) ) {
806- return { ...base , inputModalities : [ ...current , "image" ] } ;
828+ return { ...merged , inputModalities : [ ...current , "image" ] } ;
807829 }
808830 }
809- return base ;
831+ return merged ;
810832 } ) ;
811833 // Custom rows override discovered rows that encode to the same Codex-facing slug.
812834 const customKeys = new Set ( customModels . map ( c => routedSlug ( c . provider , c . id ) ) ) ;
0 commit comments