History

refactor(cache, translator): remove session ID from signature caching and clean up logic

Luis Pater committed 9 months agov6.7.16

Commit ef4508d1 parent f775e462 files · +5 −6Browse files

Unified · Split

2 files
  1. internal/cache/signature_cache.go +4 −4
  2. internal/translator/antigravity/claude/antigravity_claude_response.go +1 −2
internal/cache/signature_cache.go+4−4
@@ -104,9 +104,9 @@ func CacheSignature(modelName, text, signature string) { · 103 unmodified lines
104104 return
105105 }
106106
107− sc := getOrCreateSession(fmt.Sprintf("%s#%s", GetModelGroup(modelName), text))
107+ text = fmt.Sprintf("%s#%s", GetModelGroup(modelName), text)
108108 textHash := hashText(text)
109−
109+ sc := getOrCreateSession(textHash)
110110 sc.mu.Lock()
111111 defer sc.mu.Unlock()
112112
@@ -127,8 +127,8 @@ func GetCachedSignature(modelName, text string) string { · 14 unmodified lines
127127 }
128128 return ""
129129 }
130−
131− val, ok := signatureCache.Load(fmt.Sprintf("%s#%s", family, text))
130+ text = fmt.Sprintf("%s#%s", GetModelGroup(modelName), text)
131+ val, ok := signatureCache.Load(hashText(text))
132132 if !ok {
133133 if family == "gemini" {
134134 return "skip_thought_signature_validator"
internal/translator/antigravity/claude/antigravity_claude_response.go+1−2
@@ -41,7 +41,6 @@ type Params struct { · 40 unmodified lines
4141 HasContent bool // Tracks whether any content (text, thinking, or tool use) has been output
4242
4343 // Signature caching support
44− SessionID string // Session ID derived from request for signature caching
4544 CurrentThinkingText strings.Builder // Accumulates thinking text for signature caching
4645 }
4746
@@ -138,7 +137,7 @@ func ConvertAntigravityResponseToClaude(_ context.Context, _ string, originalReq · 90 unmodified lines
138137 if thoughtSignature := partResult.Get("thoughtSignature"); thoughtSignature.Exists() && thoughtSignature.String() != "" {
139138 // log.Debug("Branch: signature_delta")
140139
141− if params.SessionID != "" && params.CurrentThinkingText.Len() > 0 {
140+ if params.CurrentThinkingText.Len() > 0 {
142141 cache.CacheSignature(modelName, params.CurrentThinkingText.String(), thoughtSignature.String())
143142 // log.Debugf("Cached signature for thinking block (sessionID=%s, textLen=%d)", params.SessionID, params.CurrentThinkingText.Len())
144143 params.CurrentThinkingText.Reset()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t