@@ -154,6 +154,14 @@ export interface DevinProbeData {
154154 readonly auth : ServerProviderAuth ;
155155 readonly status : ServerProviderState ;
156156 readonly message : string | undefined ;
157+ /**
158+ * Whether `models` is an authoritative probe result. When false (the
159+ * version probe failed, auth is unknown, or `devin models list` errored),
160+ * the snapshot keeps its previous catalog; when true, an empty list means
161+ * the account genuinely has no catalog (sign-out, empty discovery) and the
162+ * snapshot drops its built-in models.
163+ */
164+ readonly modelsFetched : boolean ;
157165 readonly models : ReadonlyArray < ServerProviderModel > ;
158166}
159167
@@ -183,6 +191,7 @@ export const checkDevinProviderStatus = Effect.fn("checkDevinProviderStatus")(fu
183191 message : isCommandMissingCause ( error )
184192 ? "Devin CLI (`devin`) is not installed or not on PATH."
185193 : "Failed to execute Devin CLI health check." ,
194+ modelsFetched : false ,
186195 models : [ ] ,
187196 } ;
188197 }
@@ -193,6 +202,7 @@ export const checkDevinProviderStatus = Effect.fn("checkDevinProviderStatus")(fu
193202 auth : { status : "unknown" } ,
194203 status : "error" ,
195204 message : "Devin CLI is installed but timed out while running `devin version`." ,
205+ modelsFetched : false ,
196206 models : [ ] ,
197207 } ;
198208 }
@@ -211,6 +221,7 @@ export const checkDevinProviderStatus = Effect.fn("checkDevinProviderStatus")(fu
211221 auth : { status : "unknown" } ,
212222 status : "error" ,
213223 message : "Devin CLI is installed but failed to run." ,
224+ modelsFetched : false ,
214225 models : [ ] ,
215226 } ;
216227 }
@@ -262,11 +273,13 @@ export const checkDevinProviderStatus = Effect.fn("checkDevinProviderStatus")(fu
262273 auth,
263274 status : "error" ,
264275 message : "Devin CLI is installed but not logged in. Run `devin auth login`." ,
276+ // Sign-out is an authoritative empty catalog.
277+ modelsFetched : true ,
265278 models : [ ] ,
266279 } ;
267280 }
268281
269- const models =
282+ const modelsResult =
270283 auth . status === "authenticated"
271284 ? yield * runDevinCliCommand (
272285 devinSettings ,
@@ -280,15 +293,16 @@ export const checkDevinProviderStatus = Effect.fn("checkDevinProviderStatus")(fu
280293 ) ,
281294 Effect . timeoutOption ( MODELS_PROBE_TIMEOUT_MS ) ,
282295 Effect . result ,
283- Effect . map ( ( result ) =>
284- Result . isSuccess ( result ) &&
285- Option . isSome ( result . success ) &&
286- result . success . value . code === 0
287- ? parseDevinModelsListJson ( result . success . value . stdout )
288- : [ ] ,
289- ) ,
290296 )
291- : [ ] ;
297+ : undefined ;
298+ // A failed or skipped listing keeps the previous catalog; a successful
299+ // listing (even an empty one) replaces it.
300+ const modelsFetched =
301+ modelsResult !== undefined &&
302+ Result . isSuccess ( modelsResult ) &&
303+ Option . isSome ( modelsResult . success ) &&
304+ modelsResult . success . value . code === 0 ;
305+ const models = modelsFetched ? parseDevinModelsListJson ( modelsResult . success . value . stdout ) : [ ] ;
292306
293307 return {
294308 installed : true ,
@@ -301,6 +315,7 @@ export const checkDevinProviderStatus = Effect.fn("checkDevinProviderStatus")(fu
301315 auth . status === "unknown"
302316 ? "Could not determine Devin sign-in state. Sessions may prompt for login."
303317 : undefined ,
318+ modelsFetched,
304319 models,
305320 } ;
306321} ) ;
@@ -435,10 +450,9 @@ export const makeDevinProvider = Effect.fn("makeDevinProvider")(function* (
435450 const checkedAt = DateTime . formatIso ( yield * DateTime . now ) ;
436451 const next = yield * SubscriptionRef . updateAndGet ( metadata , ( draft ) => {
437452 const { message : _previousMessage , ...rest } = draft ;
438- const models =
439- probe . models . length > 0
440- ? devinModelsFromSettings ( settings . customModels , probe . models )
441- : draft . models ;
453+ const models = probe . modelsFetched
454+ ? devinModelsFromSettings ( settings . customModels , probe . models )
455+ : draft . models ;
442456 return {
443457 ...rest ,
444458 installed : probe . installed ,
@@ -481,10 +495,13 @@ export const makeDevinProvider = Effect.fn("makeDevinProvider")(function* (
481495 Array . isArray ( started . sessionSetupResult . configOptions )
482496 ? started . sessionSetupResult . configOptions
483497 : [ ] ;
484- const sessionModels = devinModelsFromSettings (
485- settings . customModels ,
486- buildDevinModelsFromSession ( configOptions ) ,
487- ) ;
498+ // A session without a model config option is not an empty catalog —
499+ // keep the probed models instead of collapsing to custom-only.
500+ const sessionBuiltInModels = buildDevinModelsFromSession ( configOptions ) ;
501+ const sessionModels =
502+ sessionBuiltInModels . length > 0
503+ ? devinModelsFromSettings ( settings . customModels , sessionBuiltInModels )
504+ : [ ] ;
488505 return {
489506 ...rest ,
490507 installed : true ,
@@ -504,11 +521,9 @@ export const makeDevinProvider = Effect.fn("makeDevinProvider")(function* (
504521 const onConfigOptionsUpdated = Effect . fn ( "DevinProvider.onConfigOptionsUpdated" ) ( function * (
505522 configOptions : ReadonlyArray < EffectAcpSchema . SessionConfigOption > ,
506523 ) {
507- const models = devinModelsFromSettings (
508- settings . customModels ,
509- buildDevinModelsFromSession ( configOptions ) ,
510- ) ;
511- if ( models . length === 0 ) return ;
524+ const sessionBuiltInModels = buildDevinModelsFromSession ( configOptions ) ;
525+ if ( sessionBuiltInModels . length === 0 ) return ;
526+ const models = devinModelsFromSettings ( settings . customModels , sessionBuiltInModels ) ;
512527 yield * SubscriptionRef . update ( metadata , ( draft ) => {
513528 const heal = adapterFlaggedAuth ? healAdapterFlaggedAuth ( draft ) : { } ;
514529 if ( heal . auth ) adapterFlaggedAuth = false ;
@@ -543,6 +558,7 @@ export const makeDevinProvider = Effect.fn("makeDevinProvider")(function* (
543558 ...draft ,
544559 auth : { status : "unauthenticated" } ,
545560 status : settings . enabled ? "warning" : "disabled" ,
561+ supportsTextGeneration : false ,
546562 message : "Devin is not signed in. Run `devin auth login`, then start the thread again." ,
547563 checkedAt,
548564 } ) satisfies ServerProviderDraft ,
0 commit comments