From 2ce3553612a8cd6732f45d481a97f2b4644432c2 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Wed, 21 Jan 2026 10:11:21 +0800 Subject: [PATCH] feat(cache): handle gemini family in signature cache with fallback validator logic --- internal/cache/signature_cache.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/cache/signature_cache.go b/internal/cache/signature_cache.go index 6ece41fa..f3693962 100644 --- a/internal/cache/signature_cache.go +++ b/internal/cache/signature_cache.go @@ -119,12 +119,20 @@ func CacheSignature(modelName, sessionID, text, signature string) { // GetCachedSignature retrieves a cached signature for a given session and text. // Returns empty string if not found or expired. func GetCachedSignature(modelName, sessionID, text string) string { + family := GetModelGroup(modelName) + if sessionID == "" || text == "" { + if family == "gemini" { + return "skip_thought_signature_validator" + } return "" } - val, ok := signatureCache.Load(fmt.Sprintf("%s#%s", GetModelGroup(modelName), sessionID)) + val, ok := signatureCache.Load(fmt.Sprintf("%s#%s", family, sessionID)) if !ok { + if family == "gemini" { + return "skip_thought_signature_validator" + } return "" } sc := val.(*sessionCache) @@ -137,11 +145,17 @@ func GetCachedSignature(modelName, sessionID, text string) string { entry, exists := sc.entries[textHash] if !exists { sc.mu.Unlock() + if family == "gemini" { + return "skip_thought_signature_validator" + } return "" } if now.Sub(entry.Timestamp) > SignatureCacheTTL { delete(sc.entries, textHash) sc.mu.Unlock() + if family == "gemini" { + return "skip_thought_signature_validator" + } return "" }