fix(sessions): preserve recently active sessions during pruning (salvage of #71043 by @Frowtek) - #72358
Merged
Conversation
Contributor
૮ >ﻌ< ა ci reviewran on d61560b ℹ️ InfoDesktop E2E visual evidence · View test artifacts · View job1 visual diff. inline evidence upload failed. Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso) |
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Auto-prune no longer deletes a recently-active conversation just because it was created long ago.
Root cause:
prune_sessions/list_prune_candidatesconvertedolder_than_daystostarted_beforeonstarted_at. An ended, long-lived conversation used today but created >90d ago was deleted — and VACUUM makes recovery impractical.Changes
hermes_state.py: retention age is now inactivity —COALESCE(MAX(messages.timestamp), started_at).session_filters.py: newlast_active_before/after;--older-than/--newer-thanbound activity,--before/--afterkeep bounding start time.last_active(dashboard keepsoldest/newest_started_atfor compat).Note
Deliberate CLI semantics change:
--older-than+--beforebecome independent axes (was: tighter-bound-wins). Documented; test replaced accordingly. Conceptually overlaps #70429's indexedlast_activecolumn — coordinate if both land; prune runs at most once per interval so the correlated subquery cost is acceptable.Validation
Real-SQLite regression tests across 5 files: 609 passed.
Salvage of #71043 — @Frowtek's commit cherry-picked with authorship preserved.
Infographic