mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-06-13 22:34:06 +00:00
The previous fix made retain_recent_legal_suffix return the actual dropped message list, but already_consolidated was still computed with min(before_last_consolidated, len(dropped)), which assumes dropped messages are always a prefix. In the else branch (tail has no user messages), dropped may include messages from after the consolidated prefix, causing already_consolidated to skip too many and leaving tail messages neither retained nor raw-archived. Fix by having retain_recent_legal_suffix return (dropped, already_consolidated_count) where already_consolidated_count is computed against original message indices. Also fix last_consolidated update to count how many retained messages were inside the old consolidated prefix.