From 514f5a8ad4036c341b8e75cd226d0e37d838db3c Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Tue, 7 Oct 2025 21:23:21 +0800 Subject: [PATCH] feat(cliproxy): Rebind auth executors on config change --- sdk/cliproxy/service.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sdk/cliproxy/service.go b/sdk/cliproxy/service.go index 41ee7513..b9bb5abc 100644 --- a/sdk/cliproxy/service.go +++ b/sdk/cliproxy/service.go @@ -291,6 +291,17 @@ func (s *Service) ensureExecutorsForAuth(a *coreauth.Auth) { } } +// rebindExecutors refreshes provider executors so they observe the latest configuration. +func (s *Service) rebindExecutors() { + if s == nil || s.coreManager == nil { + return + } + auths := s.coreManager.List() + for _, auth := range auths { + s.ensureExecutorsForAuth(auth) + } +} + // Run starts the service and blocks until the context is cancelled or the server stops. // It initializes all components including authentication, file watching, HTTP server, // and starts processing requests. The method blocks until the context is cancelled. @@ -389,6 +400,7 @@ func (s *Service) Run(ctx context.Context) error { s.cfgMu.Lock() s.cfg = newCfg s.cfgMu.Unlock() + s.rebindExecutors() }