From bb9955e461c628d5b5d746de4197d2d28929d468 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Mon, 24 Nov 2025 10:10:09 +0800 Subject: [PATCH] **fix(auth): resolve index reassignment issue during auth management** - Fixed improper handling of `indexAssigned` and `Index` during auth reassignment. - Ensured `EnsureIndex` is invoked after validating existing auth entries. --- sdk/cliproxy/auth/manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/cliproxy/auth/manager.go b/sdk/cliproxy/auth/manager.go index 363189ed..eef70ee5 100644 --- a/sdk/cliproxy/auth/manager.go +++ b/sdk/cliproxy/auth/manager.go @@ -207,8 +207,12 @@ func (m *Manager) Update(ctx context.Context, auth *Auth) (*Auth, error) { if auth == nil || auth.ID == "" { return nil, nil } - auth.EnsureIndex() m.mu.Lock() + if existing, ok := m.auths[auth.ID]; ok && existing != nil && !auth.indexAssigned && auth.Index == 0 { + auth.Index = existing.Index + auth.indexAssigned = existing.indexAssigned + } + auth.EnsureIndex() m.auths[auth.ID] = auth.Clone() m.mu.Unlock() _ = m.persist(ctx, auth)