diff --git a/internal/provider/gemini-web/state.go b/internal/provider/gemini-web/state.go index 37828dcb..e0044984 100644 --- a/internal/provider/gemini-web/state.go +++ b/internal/provider/gemini-web/state.go @@ -88,6 +88,11 @@ func (s *GeminiWebState) Label() string { if s == nil { return "" } + if s.token != nil { + if lbl := strings.TrimSpace(s.token.Label); lbl != "" { + return lbl + } + } if s.storagePath != "" { base := strings.TrimSuffix(filepath.Base(s.storagePath), filepath.Ext(s.storagePath)) if base != "" { @@ -169,8 +174,12 @@ func (s *GeminiWebState) Refresh(ctx context.Context) error { s.client.Cookies["__Secure-1PSIDTS"] = newTS } s.tokenMu.Unlock() - // Detailed debug log: provider and account. - log.Debugf("gemini web account %s rotated 1PSIDTS: %s", s.accountID, MaskToken28(newTS)) + // Detailed debug log: provider and account label. + label := strings.TrimSpace(s.Label()) + if label == "" { + label = s.accountID + } + log.Debugf("gemini web account %s rotated 1PSIDTS: %s", label, MaskToken28(newTS)) } s.lastRefresh = time.Now() return nil diff --git a/internal/runtime/executor/gemini_web_executor.go b/internal/runtime/executor/gemini_web_executor.go index 78f31abb..f026299c 100644 --- a/internal/runtime/executor/gemini_web_executor.go +++ b/internal/runtime/executor/gemini_web_executor.go @@ -200,7 +200,8 @@ func parseGeminiWebToken(auth *cliproxyauth.Auth) (*gemini.GeminiWebTokenStorage if psid == "" || psidts == "" { return nil, fmt.Errorf("gemini-web executor: incomplete cookie metadata") } - return &gemini.GeminiWebTokenStorage{Secure1PSID: psid, Secure1PSIDTS: psidts}, nil + label := strings.TrimSpace(stringFromMetadata(auth.Metadata, "label")) + return &gemini.GeminiWebTokenStorage{Secure1PSID: psid, Secure1PSIDTS: psidts, Label: label}, nil } func stringFromMetadata(meta map[string]any, keys ...string) string {