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
 1@@ -18,6 +18,7 @@ import (
 2 	"os/signal"
 3 	"path/filepath"
 4 	"runtime"
 5+	"sort"
 6 	"strconv"
 7 	"strings"
 8 	"syscall"
 9@@ -1823,6 +1824,13 @@ func formatTimestamp(ts string) string {
10 // sessions for a job with links and metadata (status, exit code, ended at).
11 // It also includes any other artifacts in the job directory (e.g., event.json, attestation.json, workspace.tar).
12 func generateJobIndex(artifactDir, name, jobID string, sessions []SessionInfo) (htmlContent, txtContent string) {
13+	// Sort sessions by Created (STARTED) timestamp
14+	sort.Slice(sessions, func(i, j int) bool {
15+		ci, _ := strconv.ParseInt(sessions[i].Created, 10, 64)
16+		cj, _ := strconv.ParseInt(sessions[j].Created, 10, 64)
17+		return ci < cj
18+	})
19+
20 	rows := make([]sessionRow, 0, len(sessions))
21 	for _, s := range sessions {
22 		row := sessionRow{