fix(gateway): tz-aware datetime compare in suspend_recent_sessions - #10397
Closed
shagarwal wants to merge 2 commits into
Closed
fix(gateway): tz-aware datetime compare in suspend_recent_sessions#10397shagarwal wants to merge 2 commits into
shagarwal wants to merge 2 commits into
Conversation
Extract key frames (4 evenly-spaced) and audio from user-sent videos, run vision analysis on frames and STT on audio, then inject descriptions into the message text before the agent processes it. - Add _enrich_message_with_video() to gateway/run.py - Add video cache utilities to gateway/platforms/base.py - Add HTTP video URL caching to WhatsApp adapter
The startup session-suspension routine compared datetime.updated_at to a float cutoff (time.time()-based), throwing TypeError and silently disabling the loop-recovery safety net introduced in NousResearch#7536. When a gateway restart occurred mid-session, in-flight sessions were blindly resumed instead of reset, leading to apparent multi-hour hangs where the agent never responded. Fix: compute cutoff as tz-aware datetime, normalize entry.updated_at tzinfo to match, and guard None.
Collaborator
Contributor
|
Thanks for the detailed write-up and the real-world reproduction timeline, @shagarwal! This is a valid bug report. After reviewing
Closing as implemented on main. The |
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.
Problem
SessionStore.suspend_recent_sessions()(the startup session-suspension safety net from #7536) comparedentry.updated_at(adatetime) to a float cutoff derived fromtime.time():This raised
TypeError: >= not supported between instances of datetime.datetime and floaton gateway startup, silently disabling the whole loop-recovery mechanism.Impact
When a gateway restart happened mid-conversation (e.g. to stop an ignored-chat loop), in-flight sessions were blindly resumed instead of reset, resulting in apparent multi-hour hangs where the agent appeared stuck and never responded to the user.
Observed in the wild: gateway restart at 06:25, user session sat suspended-but-resumed until ~08:02, never processing queued messages.
Fix
cutoffas a tz-awaredatetimeusing_now() - timedelta(...)entry.updated_attzinfo to match the cutoff before comparingentry.updated_at is NoneNo behavior change when timestamps are well-formed; just stops the routine from crashing.