diff --git a/internal/planning/manager.go b/internal/planning/manager.go index 5ba14f8869d245a56125b7fcc6dc7df13623c704..3a9725395d5d50d3907dd166cb3fef7cc09e0406 100644 --- a/internal/planning/manager.go +++ b/internal/planning/manager.go @@ -7,6 +7,7 @@ package planning import ( "fmt" "log/slog" + "sort" "strings" "sync" "time" @@ -268,14 +269,10 @@ func (m *Manager) formatTaskListWithFilter(filterStatus *TaskStatus) string { } lines = append(lines, legend) - // Simple sort by creation time (newest first could be changed if needed) - for i := range len(taskList) { - for j := i + 1; j < len(taskList); j++ { - if taskList[i].CreatedAt.After(taskList[j].CreatedAt) { - taskList[i], taskList[j] = taskList[j], taskList[i] - } - } - } + // Sort tasks by creation time (oldest first for consistent ordering) + sort.Slice(taskList, func(i, j int) bool { + return taskList[i].CreatedAt.Before(taskList[j].CreatedAt) + }) for _, task := range taskList { line := fmt.Sprintf("%s %s [%s]", task.Status.String(), task.Title, task.ID)