Commit 957187e

Eric Bower  ·  2026-08-08 11:19:45 -0400 EDT
parent 4451977
fix: sort tasks by created time
1 files changed,  +8, -0
+8, -0
......@@ -18,6 +18,7 @@ import (
1818 "os/signal"
1919 "path/filepath"
2020 "runtime"
21+ "sort"
2122 "strconv"
2223 "strings"
2324 "syscall"
......@@ -1823,6 +1824,13 @@ func formatTimestamp(ts string) string {
18231824 // sessions for a job with links and metadata (status, exit code, ended at).
18241825 // It also includes any other artifacts in the job directory (e.g., event.json, attestation.json, workspace.tar).
18251826 func generateJobIndex(artifactDir, name, jobID string, sessions []SessionInfo) (htmlContent, txtContent string) {
1827+ // Sort sessions by Created (STARTED) timestamp
1828+ sort.Slice(sessions, func(i, j int) bool {
1829+ ci, _ := strconv.ParseInt(sessions[i].Created, 10, 64)
1830+ cj, _ := strconv.ParseInt(sessions[j].Created, 10, 64)
1831+ return ci < cj
1832+ })
1833+
18261834 rows := make([]sessionRow, 0, len(sessions))
18271835 for _, s := range sessions {
18281836 row := sessionRow{