diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index e9ed57c91..47ded4c72 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -1157,7 +1157,7 @@ func (al *AgentLoop) forceCompression(agent *AgentInstance, sessionKey string) { newHistory = append(newHistory, history[len(history)-1]) // Last message // Update session - agent.Sessions.SetHistory(sessionKey, newHistory) + agent.Sessions.SetHistory(sessionKey, sanitizeToolPairs(newHistory)) agent.Sessions.Save(sessionKey) logger.WarnCF("agent", "Forced compression executed", map[string]any{