mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 12:27:29 +08:00
task lifecycle + heartbeat resilience: preserve archived done tasks and reset heartbeat session on pairing-loop errors
This commit is contained in:
@@ -321,6 +321,24 @@ func (sm *SessionManager) rewriteSessionFileLocked(session *Session) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sm *SessionManager) ResetSession(key string) {
|
||||
sm.mu.RLock()
|
||||
session, ok := sm.sessions[key]
|
||||
sm.mu.RUnlock()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
session.mu.Lock()
|
||||
session.Messages = []providers.Message{}
|
||||
session.Summary = ""
|
||||
session.Updated = time.Now()
|
||||
if sm.storage != "" {
|
||||
_ = sm.rewriteSessionFileLocked(session)
|
||||
_ = sm.writeOpenClawSessionsIndex()
|
||||
}
|
||||
session.mu.Unlock()
|
||||
}
|
||||
|
||||
func (sm *SessionManager) TruncateHistory(key string, keepLast int) {
|
||||
sm.mu.RLock()
|
||||
session, ok := sm.sessions[key]
|
||||
|
||||
Reference in New Issue
Block a user