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)