@@ -852,6 +852,24 @@ func (s *Service) hasNativeOpenAICompatExecutorConfig(a *coreauth.Auth, provider
852852 return false
853853}
854854
855+ func (s * Service ) unregisterOpenAICompatExecutor (providerKey string ) {
856+ if s == nil || s .coreManager == nil {
857+ return
858+ }
859+ providerKey = strings .ToLower (strings .TrimSpace (providerKey ))
860+ if providerKey == "" {
861+ return
862+ }
863+ existing , okExecutor := s .coreManager .Executor (providerKey )
864+ if ! okExecutor || existing == nil {
865+ return
866+ }
867+ if _ , okOpenAICompat := existing .(* executor.OpenAICompatExecutor ); ! okOpenAICompat {
868+ return
869+ }
870+ s .coreManager .UnregisterExecutor (providerKey )
871+ }
872+
855873func (s * Service ) ensureExecutorsForAuth (a * coreauth.Auth ) {
856874 s .ensureExecutorsForAuthWithMode (a , false )
857875}
@@ -984,6 +1002,7 @@ func (s *Service) registerExecutorForAuth(a *coreauth.Auth, forceReplace bool) {
9841002 if s .pluginHost != nil &&
9851003 s .pluginHost .HasExecutorCandidateProvider (providerKey ) &&
9861004 ! s .hasNativeOpenAICompatExecutorConfig (a , providerKey ) {
1005+ s .unregisterOpenAICompatExecutor (providerKey )
9871006 return
9881007 }
9891008 s .coreManager .RegisterExecutor (executor .NewOpenAICompatExecutor (providerKey , s .cfg ))
@@ -1223,6 +1242,8 @@ func (s *Service) applyConfigUpdateWithAuthSynthesis(newCfg *config.Config, synt
12231242 s .coreManager .SetConfig (newCfg )
12241243 s .coreManager .SetOAuthModelAlias (newCfg .OAuthModelAlias )
12251244 }
1245+ ctx := coreauth .WithSkipPersist (context .Background ())
1246+ s .syncPluginRuntimeConfig (ctx )
12261247 var auths []* coreauth.Auth
12271248 if s .coreManager != nil {
12281249 auths = s .coreManager .List ()
@@ -1232,7 +1253,6 @@ func (s *Service) applyConfigUpdateWithAuthSynthesis(newCfg *config.Config, synt
12321253 forceReplaceAuths : true ,
12331254 auths : auths ,
12341255 })
1235- ctx := coreauth .WithSkipPersist (context .Background ())
12361256 if synthesizeConfigAuths {
12371257 s .registerConfigAPIKeyAuths (ctx , newCfg )
12381258 }
@@ -1241,7 +1261,7 @@ func (s *Service) applyConfigUpdateWithAuthSynthesis(newCfg *config.Config, synt
12411261 log .Warnf ("failed to restore cooldown state after config update: %v" , errRestoreCooldown )
12421262 }
12431263 }
1244- s .syncPluginRuntime (ctx )
1264+ s .syncPluginModelRuntime (ctx )
12451265}
12461266
12471267func (s * Service ) reloadConfigFromWatcher () bool {
0 commit comments