Skip to content

fix(gateway): use datetime cutoff in suspend_recently_active - #8026

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

fix(gateway): use datetime cutoff in suspend_recently_active#8026
tomqiaozc wants to merge 1 commit into
NousResearch:mainfrom
tomqiaozc:fix/session-suspend-datetime-comparison

Conversation

@tomqiaozc

Copy link
Copy Markdown

Summary

  • suspend_recently_active() compared entry.updated_at (a datetime) to time.time() - max_age_seconds (a float), raising TypeError: '>=' not supported between instances of 'datetime.datetime' and 'float' on every gateway startup.
  • Replaces the float cutoff with _now() - timedelta(seconds=max_age_seconds) so the comparison is datetime >= datetime.
  • Adds 3 tests: suspends recent session, skips old session, and regression test for no TypeError.

Fixes #7966

Test plan

  • test_suspends_recent_session — session updated 30s ago is suspended (within 120s window)
  • test_skips_old_session — session updated 1h ago is not suspended
  • test_no_type_error — regression: no datetime >= float TypeError
  • Full session test suite: 63/63 passed

🤖 Generated with Claude Code

suspend_recently_active() compared a datetime (entry.updated_at) to a
float (time.time() - max_age_seconds), raising TypeError on every
gateway startup. Use _now() - timedelta() to produce a datetime cutoff
instead.

Fixes NousResearch#7966

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this fix, @tomqiaozc! The datetime vs float TypeError in suspend_recently_active() was already resolved on main before this PR was opened.

Evidence:

Closing as implemented on main. — automated hermes-sweeper review

@teknium1 teknium1 closed this Apr 27, 2026
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.

gateway startup session suspension compares datetime to float

2 participants