From 68b7d946b3c6e4e6f6ae9c3fd9ea723616cdc122 Mon Sep 17 00:00:00 2001 From: Algis Dumbris Date: Sun, 15 Mar 2026 08:43:18 +0200 Subject: [PATCH] fix: scan SQLite text timestamps in channel summary query sql.NullTime cannot scan SQLite's text-format timestamps from modernc.org/sqlite. Switch to sql.NullString with manual time.Parse. Co-Authored-By: Claude Opus 4.6 --- internal/channels/store.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/channels/store.go b/internal/channels/store.go index e0d9020..3d841c6 100644 --- a/internal/channels/store.go +++ b/internal/channels/store.go @@ -6,6 +6,7 @@ import ( "fmt" "log/slog" "strings" + "time" ) // ChannelStore defines the storage interface for channel operations. @@ -394,12 +395,16 @@ func (s *SQLiteChannelStore) GetChannelSummaries(ctx context.Context, agentName var summaries []ChannelSummary for rows.Next() { var cs ChannelSummary - var lastMsg sql.NullTime + var lastMsg sql.NullString if err := rows.Scan(&cs.ID, &cs.Name, &cs.UnreadCount, &lastMsg); err != nil { return nil, fmt.Errorf("scan channel summary: %w", err) } if lastMsg.Valid { - cs.LastMessageAt = &lastMsg.Time + if t, err := time.Parse("2006-01-02T15:04:05Z", lastMsg.String); err == nil { + cs.LastMessageAt = &t + } else if t, err := time.Parse("2006-01-02 15:04:05", lastMsg.String); err == nil { + cs.LastMessageAt = &t + } } summaries = append(summaries, cs) }