让 SDK 日志时间在 UTC 容器中稳定显示东八区#123
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes SDK-emitted log timestamps stable in UTC-based containers by forcing %(asctime)s formatting to use a UTC+8 time converter inside the SDK’s CustomFormatter, with unit tests validating the behavior across log levels.
Changes:
- Add a UTC+8 converter (
_utc8_converter) and apply it to all internallogging.Formatterinstances used byCustomFormatter. - Introduce unit tests ensuring
CustomFormatteralways formatsasctimeas UTC+8 for both known and fallback log levels.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| agentrun/utils/log.py | Adds a UTC+8 time converter and ensures all formatter instances used by CustomFormatter apply it for asctime. |
| tests/unittests/test_log.py | Adds unit tests that assert log timestamps render in UTC+8 regardless of the process timezone and for all levels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Constraint: Aone 83336550 requires quick-created Agent logs to show UTC+8 instead of UTC. Rejected: process TZ or frontend conversion | broader blast radius and does not target SDK-emitted asctime. Confidence: high Scope-risk: narrow Directive: Keep timezone policy local to SDK formatter unless future requirements make it configurable. Tested: uv run pytest tests/unittests/test_log.py -q; TZ=UTC/Asia/Shanghai/America/Los_Angeles uv run pytest tests/unittests/test_log.py -q; uv run mypy --config-file mypy.ini agentrun/utils/log.py tests/unittests/test_log.py; git diff --check; independent code-reviewer APPROVE; architect CLEAR; UltraQA PASS. Change-Id: I7ce521856fe79489fae17f97d35f516ddc82491b Co-developed-by: Codex <noreply@openai.com> Not-tested: full repo mypy has unrelated pre-existing examples/conversation_service_langgraph_server.py:175 error; full pytest includes credential-gated e2e and was not used as merge gate. Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com>
7a60968 to
a7ec599
Compare
Sodawyx
approved these changes
Jun 18, 2026
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.
Constraint: Aone 83336550 requires quick-created Agent logs to show UTC+8 instead of UTC.
Rejected: process TZ or frontend conversion | broader blast radius and does not target SDK-emitted asctime.
Confidence: high
Scope-risk: narrow
Directive: Keep timezone policy local to SDK formatter unless future requirements make it configurable.
Tested: uv run pytest tests/unittests/test_log.py -q; TZ=UTC/Asia/Shanghai/America/Los_Angeles uv run pytest tests/unittests/test_log.py -q; uv run mypy --config-file mypy.ini agentrun/utils/log.py tests/unittests/test_log.py; git diff --check; independent code-reviewer APPROVE; architect CLEAR; UltraQA PASS.
Change-Id: I4a49664dcba0fe023fa0847b1046a0e3a9ae72ec
Co-developed-by: Codex noreply@openai.com
Not-tested: full repo mypy has unrelated pre-existing examples/conversation_service_langgraph_server.py:175 error; full pytest includes credential-gated e2e and was not used as merge gate.
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update