mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-17 04:15:05 +00:00
fix: auto-persist cleaned history when orphan tool messages detected (#128)
sanitizeHistory now returns dropped count so callers know when orphaned tool_use/tool_result messages were removed. When orphans are found in buildMessages, the full session history is sanitized and persisted, preventing repeated warnings on every request. - Add SetHistory() to SessionStore interface and both implementations - Adapt memoryflush caller to new two-return signature - Change sanitize log level from Warn to Debug
This commit is contained in:
1 parent
cc00a6f193
commit
cd2e407b29
6 files changed
+57
-16
No files matched your search
@@ -132,7 +132,8 @@ func (l *Loop) runMemoryFlush(ctx context.Context, sessionKey string, settings *
|
||||
if len(recentHistory) > 10 {
|
||||
recentHistory = recentHistory[len(recentHistory)-10:]
|
||||
}
|
||||
messages = append(messages, sanitizeHistory(recentHistory)...)
|
||||
sanitized, _ := sanitizeHistory(recentHistory)
|
||||
messages = append(messages, sanitized...)
|
||||
|
||||
// Flush prompt
|
||||
messages = append(messages, providers.Message{
|
||||
|
||||
Reference in new issue
Block a user