fix: exclude pause time from task run duration

Persist active_run_seconds + run_segment_started_at so task list and
orchestration list_tasks accumulate only actual execution time across
pause/resume/queue/terminal transitions.
This commit is contained in:
artex committed 2026-10-27 13:37:43 +08:00
1 parent e740334b90
commit 41c967f7ad
15 files changed
+320 -71

No files matched your search

+1 -1
View File
@@ -1136,7 +1136,7 @@ func (s *Server) listTasks(w http.ResponseWriter, r *http.Request) {
metric := metrics[t.ExpID]
dto.Tokens = tokenTotalDTO(metric.Tokens)
// prefer the live in-memory heartbeat (fresher) and fall back to the
// persisted max activity time (survives restarts) for run-duration display.
// persisted max activity time (survives restarts) for activity display.
dto.LastActivity = metric.LastActivity
if live := s.engine.LastActivity(t.ID); live > dto.LastActivity {
dto.LastActivity = live