Conversation
Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>
Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AgentRunResponse.created_at to return correct UTC timestamp
Fix: AgentRunResponse.created_at returns local datetime labeled as UTC
Dec 3, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where AgentRunResponse.created_at and related timestamp fields were returning local server time but labeling it as UTC (with 'Z' suffix). The fix ensures all timestamps are genuinely in UTC by adding tz=timezone.utc parameter to datetime conversion functions.
- Updated
datetime.fromtimestamp()calls to includetz=timezone.utcin OpenAI chat and responses clients - Updated
datetime.now()call to includetz=timezone.utcin workflow agent - Added comprehensive unit tests to verify UTC timestamp conversion
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/openai/_chat_client.py | Fixed ChatResponse and ChatResponseUpdate to use UTC timestamps via datetime.fromtimestamp(..., tz=timezone.utc) |
| python/packages/core/agent_framework/openai/_responses_client.py | Fixed ChatResponse in responses client to use UTC timestamps via datetime.fromtimestamp(..., tz=timezone.utc) |
| python/packages/core/agent_framework/_workflows/_agent.py | Fixed AgentRunResponseUpdate to use UTC timestamps via datetime.now(tz=timezone.utc) |
| python/packages/core/tests/openai/test_openai_chat_client_base.py | Added unit tests test_chat_response_created_at_uses_utc and test_chat_response_update_created_at_uses_utc to verify UTC conversion |
| python/packages/core/tests/core/test_types.py | Added unit tests test_agent_run_response_created_at and test_agent_run_response_update_created_at to verify timestamp handling |
python/packages/core/agent_framework/openai/_responses_client.py
Outdated
Show resolved
Hide resolved
moonbox3
approved these changes
Dec 3, 2025
…tent Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Member
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||||||||||||
moonbox3
approved these changes
Dec 4, 2025
dmytrostruk
approved these changes
Dec 4, 2025
victordibia
approved these changes
Dec 4, 2025
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
…ed as UTC (microsoft#2590) * Initial plan * Fix created_at to use UTC datetime and add unit tests Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com> * Address code review feedback: move datetime imports to top of test files Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com> * Add UTC timestamp test for OpenAIResponsesClient._create_response_content Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com> * Fix lint issue --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com> Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>
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.
_chat_client.pyline 217 to use UTC datetime_chat_client.pyline 252 to use UTC datetime_responses_client.pyline 818 to use UTC datetime_workflows/_agent.pyline 272 to use UTC datetimetest_chat_response_created_at_uses_utcto verify ChatResponse uses UTCtest_chat_response_update_created_at_uses_utcto verify ChatResponseUpdate uses UTCtest_agent_run_response_update_created_atto verify AgentRunResponseUpdate handles created_at correctlytest_agent_run_response_created_atto verify AgentRunResponse handles created_at correctlytest_responses_client_created_at_uses_utcto verify OpenAIResponsesClient uses UTC timestamp💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.