version summary cache keys
This commit is contained in:
parent
60c4541fa4
commit
82ab9dd2e3
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue