Skip to content

[codex] fix gateway startup session suspension cutoff - #7973

Closed
samrusani wants to merge 1 commit into
NousResearch:mainfrom
samrusani:fix/gateway-startup-session-suspension
Closed

[codex] fix gateway startup session suspension cutoff#7973
samrusani wants to merge 1 commit into
NousResearch:mainfrom
samrusani:fix/gateway-startup-session-suspension

Conversation

@samrusani

@samrusani samrusani commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Fixed suspend_recently_active() to compare datetime values instead of datetime to float.
  • Added a regression test for recent vs old sessions.

Why

  • Gateway startup could throw datetime >= float and skip the session-suspension safeguard.

Validation

  • python3 -m py_compile gateway/session.py tests/gateway/test_session.py
  • Targeted sanity check confirmed only recent sessions are suspended.
  • Full suite was not used as a gating signal for this patch because the repository has unrelated failures outside this change.

@samrusani

Copy link
Copy Markdown
Contributor Author

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.

@teknium1

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants