@@ -132,21 +132,31 @@ function buildSettingsModal(params: {
132132 text : { type : "plain_text" as const , text : AGENT_PROVIDER_LABELS [ provider ] } ,
133133 value : provider ,
134134 } ) ) ;
135- const modelOptions = opencodeModels . length > 0
136- ? opencodeModels . map ( ( model ) => ( {
137- text : { type : "plain_text" as const , text : model } ,
138- value : model ,
139- } ) )
140- : [ { text : { type : "plain_text" as const , text : "No models configured" } , value : "__none__" } ] ;
141- const codexModelOptions = [
142- { text : { type : "plain_text" as const , text : "Use default (gpt-5.3-codex)" } , value : "__default__" } ,
143- ...codexModels . map ( ( model ) => ( {
144- text : { type : "plain_text" as const , text : model } ,
145- value : model ,
146- } ) ) ,
147- ] ;
148-
149- const availableModels = selectedProvider === "codex" ? codexModelOptions . map ( ( entry ) => entry . value ) : opencodeModels ;
135+ const providerModels = selectedProvider === "opencode"
136+ ? opencodeModels
137+ : selectedProvider === "codex"
138+ ? codexModels
139+ : null ;
140+ const modelOptions = providerModels && selectedProvider === "opencode"
141+ ? ( opencodeModels . length > 0
142+ ? opencodeModels . map ( ( model ) => ( {
143+ text : { type : "plain_text" as const , text : model } ,
144+ value : model ,
145+ } ) )
146+ : [ { text : { type : "plain_text" as const , text : "No models configured" } , value : "__none__" } ] )
147+ : providerModels && selectedProvider === "codex"
148+ ? [
149+ { text : { type : "plain_text" as const , text : "Use default (gpt-5.3-codex)" } , value : "__default__" } ,
150+ ...codexModels . map ( ( model ) => ( {
151+ text : { type : "plain_text" as const , text : model } ,
152+ value : model ,
153+ } ) ) ,
154+ ]
155+ : [ ] ;
156+
157+ const availableModels = selectedProvider === "codex"
158+ ? modelOptions . map ( ( entry ) => entry . value )
159+ : providerModels ?? [ ] ;
150160 const matchedSelectedModel = findMatchingModel ( availableModels , selectedModel ) ;
151161 const initialModel = matchedSelectedModel
152162 ? matchedSelectedModel
@@ -168,6 +178,7 @@ function buildSettingsModal(params: {
168178 {
169179 type : "input" as const ,
170180 block_id : PROVIDER_BLOCK ,
181+ dispatch_action : true ,
171182 label : { type : "plain_text" as const , text : "Provider" } ,
172183 element : {
173184 type : "static_select" as const ,
@@ -178,9 +189,8 @@ function buildSettingsModal(params: {
178189 } ,
179190 ] ;
180191
181- if ( selectedProvider === "opencode" || selectedProvider === "codex" ) {
182- const options = selectedProvider === "opencode" ? modelOptions : codexModelOptions ;
183- const initialOption = options . find ( ( option ) => option . value === initialModel ) ;
192+ if ( providerModels ) {
193+ const initialOption = modelOptions . find ( ( option ) => option . value === initialModel ) ;
184194 blocks . push (
185195 {
186196 type : "input" as const ,
@@ -190,7 +200,7 @@ function buildSettingsModal(params: {
190200 element : {
191201 type : "static_select" as const ,
192202 action_id : MODEL_ACTION ,
193- options,
203+ options : modelOptions ,
194204 initial_option : initialOption ,
195205 } ,
196206 } ,
0 commit comments