version summary cache keys

This commit is contained in:
Ollie Agent 2026-08-15 13:43:04 +02:00
parent 60c4541fa4
commit 82ab9dd2e3
2 changed files with 6 additions and 2 deletions

View File

@ -104,8 +104,8 @@ func toolMessageID(m backend.Message) string {
const coldSummaryCacheVersion = "v2"
func toolSummaryHash(m backend.Message) string {
h := sha256.Sum256([]byte(coldSummaryCacheVersion + "\x00" + normalizeSummaryCacheContent(m.Content)))
return hex.EncodeToString(h[:])
h := sha256.Sum256([]byte(normalizeSummaryCacheContent(m.Content)))
return "cold-summary:" + coldSummaryCacheVersion + ":" + hex.EncodeToString(h[:])
}
func normalizeSummaryCacheContent(content string) string {

View File

@ -1,6 +1,7 @@
package agent
import (
"strings"
"testing"
"ollie/cmd/olliesrv/internal/backend"
@ -30,6 +31,9 @@ func TestToolSummaryHashIgnoresToolCallID(t *testing.T) {
if first != second {
t.Fatalf("hashes differ for identical content: %q != %q", first, second)
}
if !strings.HasPrefix(first, "cold-summary:v2:") {
t.Fatalf("hash missing version prefix: %q", first)
}
}
func TestToolSummaryHashSeparatesContent(t *testing.T) {