Skip to content

让 SDK 日志时间在 UTC 容器中稳定显示东八区#123

Merged
zoeshawwang merged 1 commit into
mainfrom
fix/83336550-utc8-logger
Jun 18, 2026
Merged

让 SDK 日志时间在 UTC 容器中稳定显示东八区#123
zoeshawwang merged 1 commit into
mainfrom
fix/83336550-utc8-logger

Conversation

@zoeshawwang

Copy link
Copy Markdown
Collaborator

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.

Thank you for creating a pull request to contribute to Serverless Devs agentrun-sdk-python code! Before you open the request please answer the following questions to help it be more easily integrated. Please check the boxes "[ ]" with "[x]" when done too.
Please select one of the PR types below to complete


Fix bugs

Bug detail

The specific manifestation of the bug or the associated issue.

Pull request tasks

  • Add test cases for the changes
  • Passed the CI test

Update docs

Reason for update

Why do you need to update your documentation?

Pull request tasks

  • Update Chinese documentation
  • Update English documentation

Add contributor

Contributed content

  • Code
  • Document

Content detail

if content_type == 'code' || content_type == 'document':
    please tell us `PR url`,like: https://github.com/Serverless-Devs/agentrun-sdk-python/pull/1
else:
    please describe your contribution in detail

Others

Reason for update

Why do you need to update your documentation?

@zoeshawwang zoeshawwang requested review from OhYee and Copilot and removed request for OhYee June 18, 2026 05:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 internal logging.Formatter instances used by CustomFormatter.
  • Introduce unit tests ensuring CustomFormatter always formats asctime as 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.

@zoeshawwang zoeshawwang enabled auto-merge June 18, 2026 06:02
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>
@zoeshawwang zoeshawwang force-pushed the fix/83336550-utc8-logger branch from 7a60968 to a7ec599 Compare June 18, 2026 06:10
@zoeshawwang zoeshawwang merged commit 9411ddb into main Jun 18, 2026
3 checks passed
@zoeshawwang zoeshawwang deleted the fix/83336550-utc8-logger branch June 18, 2026 06:32
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.

4 participants