fix(agent_context): use utc_now() for current_datetime default#3544
Open
Oxygen56 wants to merge 1 commit into
Open
fix(agent_context): use utc_now() for current_datetime default#3544Oxygen56 wants to merge 1 commit into
Oxygen56 wants to merge 1 commit into
Conversation
Replace datetime.now().astimezone() with the SDK's own utc_now() helper for consistency. UTC is unambiguous for LLM agents and the .isoformat() output includes the timezone offset. The staleness issue (frozen at AgentContext construction time) is noted but requires broader lifecycle changes. Tracked in OpenHands#3438. Fixes OpenHands#3438
Collaborator
|
[Automatic Post]: It has been a while since there was any activity on this PR. @Oxygen56, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. This comment was created by an AI agent (OpenHands) on behalf of the user. |
Member
|
Hey @Oxygen56 |
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.
HUMAN:
Fixed the
current_datetimedefault by replacingdatetime.now().astimezone()withutc_now(). Verified by importing the module and checking the default factory output.AGENT:
Why
datetime.now().astimezone()uses local timezone which is non-deterministic for LLM agents running across different hosts. UTC is the standard for server-side timestamps.Summary
datetime.now().astimezone()withutc_now()helper in agent_context.py+00:00offset via isoformat()Issue Number
Fixes #3438
How to Test