You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed the startup session-suspension bug by switching the cutoff to a datetime, and added a regression test covering recent vs stale sessions. I validated the patch with a targeted compile check and a local sanity run.
Thanks for the contribution @samrusani! This is an automated hermes-sweeper review.
After inspecting current main, the datetime >= float comparison bug in suspend_recently_active() is not present — it appears it was already fixed before this PR was opened (or the function was written correctly from the start on the branch you based off of).
Evidence on current main:
gateway/session.py line 1075: cutoff = _now() - timedelta(seconds=max_age_seconds) — _now() returns datetime.now(), so the cutoff is already a datetime, not a float.
gateway/session.py line 1082: if not entry.suspended and entry.updated_at >= cutoff: — both sides are datetime; no type mismatch.
Regression tests covering recent vs stale session suspension already exist in tests/gateway/test_clean_shutdown_marker.py (TestSuspendRecentlyActive class, lines 38–82), including test_does_not_suspend_old_sessions which backdates updated_at beyond the cutoff — matching exactly what this PR's test adds.
Closing as already implemented. If you believe the bug still exists in a code path not covered by the above, please reopen with a specific reproduction showing the float comparison.
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
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.
What changed
suspend_recently_active()to comparedatetimevalues instead ofdatetimeto float.Why
datetime >= floatand skip the session-suspension safeguard.Validation
python3 -m py_compile gateway/session.py tests/gateway/test_session.py