fix(memory): queue and loader updates
This commit is contained in:
parent
30328c8d63
commit
623c28f6dd
2 changed files with 22 additions and 2 deletions
|
|
@ -148,6 +148,12 @@ func (q *QueueManager) EvictOldest(ctx context.Context, agentID, sessionKey stri
|
|||
evicted++
|
||||
}
|
||||
|
||||
// DB trigger cascades chunk deletion, but the in-memory vecCache
|
||||
// doesn't know about it. Force a reload on next search.
|
||||
if evicted > 0 {
|
||||
q.store.invalidateVecCache()
|
||||
}
|
||||
|
||||
summary := ""
|
||||
if evicted > 0 {
|
||||
summary = fmt.Sprintf("[Memory compaction: %d items archived]\nEvicted topics: %s",
|
||||
|
|
|
|||
|
|
@ -77,8 +77,9 @@ func NewSkillsLoader(primarySkillsDir string, globalSkills string, builtinSkills
|
|||
}
|
||||
}
|
||||
|
||||
// DirsMtime returns the latest modification time across all skill directories.
|
||||
// Used for cache invalidation — if no directories exist, returns zero time.
|
||||
// DirsMtime returns the latest modification time across all skill directories
|
||||
// and their immediate children. Catches both file additions (directory mtime)
|
||||
// and in-place edits of existing skill files (file mtime).
|
||||
func (sl *SkillsLoader) DirsMtime() time.Time {
|
||||
var latest time.Time
|
||||
for _, dir := range []string{sl.primarySkills, sl.globalSkills, sl.builtinSkills} {
|
||||
|
|
@ -92,6 +93,19 @@ func (sl *SkillsLoader) DirsMtime() time.Time {
|
|||
if mt := info.ModTime(); mt.After(latest) {
|
||||
latest = mt
|
||||
}
|
||||
entries, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, e := range entries {
|
||||
fi, err := e.Info()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if mt := fi.ModTime(); mt.After(latest) {
|
||||
latest = mt
|
||||
}
|
||||
}
|
||||
}
|
||||
return latest
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue