From 1ba508169f715971f5caef8c0f02b6336e350dde Mon Sep 17 00:00:00 2001 From: "anthony.wen" Date: Thu, 26 Mar 2026 12:26:23 -0400 Subject: [PATCH] Fix watcher timestamp handling for reused categorized runs - interpret ATVM controller log timestamps in the controller's local timezone before converting to UTC so the watcher uses the correct current-run window - prevent newly started categorized runs from immediately picking up older categorized artifacts just because the parent build name was reused - keep the categorized watcher focused on artifacts from the current controller run instead of stale prior attempts --- atvm/watcher-service/atvm_run_watcher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atvm/watcher-service/atvm_run_watcher.py b/atvm/watcher-service/atvm_run_watcher.py index 91a0073..75ca8a7 100644 --- a/atvm/watcher-service/atvm_run_watcher.py +++ b/atvm/watcher-service/atvm_run_watcher.py @@ -27,6 +27,8 @@ RUN_STATES = { "RUNNING", } +LOCAL_TZ = datetime.now().astimezone().tzinfo or timezone.utc + @dataclass class HostResult: @@ -177,7 +179,7 @@ def parse_xml_timestamp(raw: Optional[str]) -> Optional[datetime]: def parse_log_timestamp(raw: str) -> Optional[datetime]: try: - return datetime.strptime(raw, "%Y-%m-%d %H:%M:%S,%f").replace(tzinfo=timezone.utc) + return datetime.strptime(raw, "%Y-%m-%d %H:%M:%S,%f").replace(tzinfo=LOCAL_TZ).astimezone(timezone.utc) except ValueError: return None