fix(memory): queue and loader updates

This commit is contained in:
ZanzyTHEbar 2026-02-22 22:53:48 +00:00
parent 30328c8d63
commit 623c28f6dd
2 changed files with 22 additions and 2 deletions

View file

@ -148,6 +148,12 @@ func (q *QueueManager) EvictOldest(ctx context.Context, agentID, sessionKey stri
evicted++ 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 := "" summary := ""
if evicted > 0 { if evicted > 0 {
summary = fmt.Sprintf("[Memory compaction: %d items archived]\nEvicted topics: %s", summary = fmt.Sprintf("[Memory compaction: %d items archived]\nEvicted topics: %s",

View file

@ -77,8 +77,9 @@ func NewSkillsLoader(primarySkillsDir string, globalSkills string, builtinSkills
} }
} }
// DirsMtime returns the latest modification time across all skill directories. // DirsMtime returns the latest modification time across all skill directories
// Used for cache invalidation — if no directories exist, returns zero time. // 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 { func (sl *SkillsLoader) DirsMtime() time.Time {
var latest time.Time var latest time.Time
for _, dir := range []string{sl.primarySkills, sl.globalSkills, sl.builtinSkills} { 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) { if mt := info.ModTime(); mt.After(latest) {
latest = mt 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 return latest
} }