timestamp log fix

3clyp50 committed Jan 6, 2026 at 19:02 UTC 7dcfd6af6a36adaa67b6231c5e10a5fb501ff8e2
2 files changed +9 -6
python/helpers/log.py
+2 -2
@@ -137,8 +137,8 @@ class LogItem:
137 agent_number: int = 0 # Agent number (0 = main agent, 1+ = subordinate agents)
138
139 def __post_init__(self):
140 - self.guid = self.log.guid
141 - self.timestamp = time.time()
140 + self.guid = self.guid or self.log.guid
141 + self.timestamp = self.timestamp or time.time()
142
143 def update(
144 self,
webui/js/time-utils.js
+7 -4
@@ -78,11 +78,14 @@ export function getUserTimezone() {
78 export function formatDuration(durationMs) {
79 if (durationMs == null || durationMs < 0) return '0s';
80
81 - if (durationMs < 60000) {
82 - return `${Math.round(durationMs / 1000)}s`;
81 + // Round total seconds first to avoid "1m60s" when seconds round up to 60
82 + const totalSecs = Math.round(durationMs / 1000);
83 +
84 + if (totalSecs < 60) {
85 + return `${totalSecs}s`;
86 }
87
85 - const mins = Math.floor(durationMs / 60000);
86 - const secs = Math.round((durationMs % 60000) / 1000);
88 + const mins = Math.floor(totalSecs / 60);
89 + const secs = totalSecs % 60;
90 return `${mins}m${secs}s`;
91 }