fix: log timestamps respect configured timezone (#289)#290
Merged
Conversation
_BufferHandler.emit() used datetime.fromtimestamp() without a tz argument, which defaulted to the system (Docker) UTC regardless of the user's configured timezone in agent config. Changes: - admin.py: add _LOG_TIMEZONE module variable (default 'UTC') and set_log_timezone() to update it after config loads - admin.py: emit() now passes tz=ZoneInfo(_LOG_TIMEZONE) to datetime.fromtimestamp() - main.py: call set_log_timezone(config.agent.timezone) after config is loaded in _start_agent() - tests: two new tests verifying UTC default and US/Eastern offset Closes #289.
5 tasks
Owner
|
@kindralai[bot] linting fails. Please install the pre-commit hook to auto lint before committing. This is getting annoying. |
datetime.fromtimestamp() call exceeded 100-char limit, causing CI lint failure on PR #290. Broke it across multiple lines.
Contributor
Author
|
Fixed the lint issue — E501 line-too-long on the datetime.fromtimestamp() call. Broke it across multiple lines. Also activated the pre-commit hook: |
kindralai Bot
added a commit
that referenced
this pull request
Jul 10, 2026
…ia hooksPath - Split datetime.fromtimestamp() call across multiple lines to stay under ruff's 100-char limit (fixes CI lint failure on PR #290) - Set core.hooksPath = .githooks so the existing pre-commit hook (which runs ruff check) fires on every commit
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
Log timestamps in the admin Logs tab always show UTC time, regardless of the user-specified timezone in their config (You tab in admin UI). The root cause is
_BufferHandler.emit()usingdatetime.fromtimestamp()without atzargument, defaulting to the Docker container's system timezone (UTC).Solution
_LOG_TIMEZONEvariable (default"UTC") andset_log_timezone()to update it after config loadsemit()now passestz=ZoneInfo(_LOG_TIMEZONE)todatetime.fromtimestamp()main.pycallsset_log_timezone(config.agent.timezone)in_start_agent()after config is loadedAcceptance criteria
Closes #289