Skip to content

Your lightweight open-source personal agent.

fix(email): fix misleading comment and simplify uid eviction

Re-bin4e8c8cc2274f
diff --git a/nanobot/channels/email.py b/nanobot/channels/email.py
index c90a14d03..5dc05fb45 100644
--- a/nanobot/channels/email.py
+++ b/nanobot/channels/email.py
@@ -304,9 +304,8 @@ class EmailChannel(BaseChannel):
self._processed_uids.add(uid)
# mark_seen is the primary dedup; this set is a safety net
if len(self._processed_uids) > self._MAX_PROCESSED_UIDS:
- # Evict oldest half instead of clearing entirely
- to_keep = list(self._processed_uids)[len(self._processed_uids) // 2:]
- self._processed_uids = set(to_keep)
+ # Evict a random half to cap memory; mark_seen is the primary dedup
+ self._processed_uids = set(list(self._processed_uids)[len(self._processed_uids) // 2:])
if mark_seen:
client.store(imap_id, "+FLAGS", "\\Seen")