From 6a258ff841203c305f7820b1c92b3f9b30899574 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Sun, 1 Feb 2026 12:05:48 +0800 Subject: [PATCH] feat(config): track routing and cloak changes in config diff --- internal/watcher/diff/config_diff.go | 15 +++++++++++++++ sdk/cliproxy/service.go | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/watcher/diff/config_diff.go b/internal/watcher/diff/config_diff.go index 4be9f117..ac9353b3 100644 --- a/internal/watcher/diff/config_diff.go +++ b/internal/watcher/diff/config_diff.go @@ -75,6 +75,10 @@ func BuildConfigChangeDetails(oldCfg, newCfg *config.Config) []string { changes = append(changes, fmt.Sprintf("quota-exceeded.switch-preview-model: %t -> %t", oldCfg.QuotaExceeded.SwitchPreviewModel, newCfg.QuotaExceeded.SwitchPreviewModel)) } + if oldCfg.Routing.Strategy != newCfg.Routing.Strategy { + changes = append(changes, fmt.Sprintf("routing.strategy: %s -> %s", oldCfg.Routing.Strategy, newCfg.Routing.Strategy)) + } + // API keys (redacted) and counts if len(oldCfg.APIKeys) != len(newCfg.APIKeys) { changes = append(changes, fmt.Sprintf("api-keys count: %d -> %d", len(oldCfg.APIKeys), len(newCfg.APIKeys))) @@ -147,6 +151,17 @@ func BuildConfigChangeDetails(oldCfg, newCfg *config.Config) []string { if oldExcluded.hash != newExcluded.hash { changes = append(changes, fmt.Sprintf("claude[%d].excluded-models: updated (%d -> %d entries)", i, oldExcluded.count, newExcluded.count)) } + if o.Cloak != nil && n.Cloak != nil { + if strings.TrimSpace(o.Cloak.Mode) != strings.TrimSpace(n.Cloak.Mode) { + changes = append(changes, fmt.Sprintf("claude[%d].cloak.mode: %s -> %s", i, o.Cloak.Mode, n.Cloak.Mode)) + } + if o.Cloak.StrictMode != n.Cloak.StrictMode { + changes = append(changes, fmt.Sprintf("claude[%d].cloak.strict-mode: %t -> %t", i, o.Cloak.StrictMode, n.Cloak.StrictMode)) + } + if len(o.Cloak.SensitiveWords) != len(n.Cloak.SensitiveWords) { + changes = append(changes, fmt.Sprintf("claude[%d].cloak.sensitive-words: %d -> %d", i, len(o.Cloak.SensitiveWords), len(n.Cloak.SensitiveWords))) + } + } } } diff --git a/sdk/cliproxy/service.go b/sdk/cliproxy/service.go index ee224db5..63eaf9eb 100644 --- a/sdk/cliproxy/service.go +++ b/sdk/cliproxy/service.go @@ -543,7 +543,6 @@ func (s *Service) Run(ctx context.Context) error { selector = &coreauth.RoundRobinSelector{} } s.coreManager.SetSelector(selector) - log.Infof("routing strategy updated to %s", nextStrategy) } s.applyRetryConfig(newCfg)