Skip to content

Commit f4ffc8a

Browse files
committed
session/Cleanup: remove stale entries from vector index
Store.Cleanup() primary path (with index) bypassed Store.Delete() and directly removed files + index entries — but never called Vec.Remove(). This left orphaned vectors in the vector store on every /prune command. They were silently skipped during search (Load fails -> continue), but accumulated garbage in vectors.gob. Now calls Vec.Remove(id) alongside file removal, matching the fallback path (which correctly used Store.Delete() -> Vec.Remove()).
1 parent 9e3ef5e commit f4ffc8a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

internal/session/session.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,10 @@ func (s *Store) Cleanup(before time.Time) (int, error) {
500500
return deleted, fmt.Errorf("session: delete %q: %w", id, err)
501501
}
502502
delete(idx, id)
503+
// Remove from vector index to prevent stale entries.
504+
if s.Vec != nil {
505+
_ = s.Vec.Remove(id) // best-effort
506+
}
503507
deleted++
504508
}
505509
}

0 commit comments

Comments
 (0)