Skip to content

fix(session): use datetime for cutoff in suspend_recently_active() - #8002

Closed
zicochaos wants to merge 1 commit into
NousResearch:mainfrom
zicochaos:fix/session-suspend-datetime
Closed

fix(session): use datetime for cutoff in suspend_recently_active()#8002
zicochaos wants to merge 1 commit into
NousResearch:mainfrom
zicochaos:fix/session-suspend-datetime

Conversation

@zicochaos

Copy link
Copy Markdown
Contributor

Summary

suspend_recently_active() compares entry.updated_at (a datetime object) with time.time() (a float), which raises TypeError: '>=' not supported between instances of 'datetime.datetime' and 'float' on every gateway startup.

Fix: use _now() - timedelta(seconds=max_age_seconds) instead of time.time() - max_age_seconds, matching the type of updated_at and the pattern used elsewhere in session.py (e.g. list_sessions()).

Test plan

  • Start gateway — no more TypeError on startup
  • Verified _now() and timedelta are already imported in session.py
  • Pattern matches existing code at line 939 (list_sessions)

suspend_recently_active() compares entry.updated_at (datetime) with
time.time() (float), raising TypeError on gateway startup. Use
_now() - timedelta(seconds=...) instead to match the type of updated_at.
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the contribution, @zicochaos!

Closing this as a duplicate of #8026 (by @tomqiaozc), which targets the same fix/feature. We're consolidating on that PR for review.

If you want to help push it over the line, please jump in there — or if you think your approach is better for a specific reason that isn't covered in the other PR, let us know and we can reopen.

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