fix: handle text session summary timestamps
This commit is contained in:
@@ -518,9 +518,9 @@ func (s *Server) querySessionSummaries(ctx context.Context, stage string, sqlTex
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var sessionID, ownerUserID, projectID, conversationID, threadID, status, lastTraceID, sourceEventID, sessionJSON sql.NullString
|
||||
var createdAt, updatedAt sql.NullString
|
||||
var projectedSeq, sourceSeq sql.NullInt64
|
||||
var terminal, sealed sql.NullBool
|
||||
var createdAt, updatedAt sql.NullTime
|
||||
if err := rows.Scan(&sessionID, &ownerUserID, &projectID, &conversationID, &threadID, &status, &lastTraceID, &projectedSeq, &sourceSeq, &sourceEventID, &terminal, &sealed, &createdAt, &updatedAt, &sessionJSON); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -541,8 +541,8 @@ func (s *Server) querySessionSummaries(ctx context.Context, stage string, sqlTex
|
||||
"sourceEventId": nullableString(sourceEventID),
|
||||
"terminal": nullableBool(terminal),
|
||||
"sealed": nullableBool(sealed),
|
||||
"createdAt": nullableTime(createdAt),
|
||||
"updatedAt": first(nullableTime(updatedAt), nullableTime(createdAt)),
|
||||
"createdAt": nullableTimeText(createdAt),
|
||||
"updatedAt": first(nullableTimeText(updatedAt), nullableTimeText(createdAt)),
|
||||
"valuesPrinted": false,
|
||||
"valuesRedacted": true,
|
||||
}
|
||||
@@ -1336,6 +1336,21 @@ func nullableTime(value sql.NullTime) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func nullableTimeText(value sql.NullString) string {
|
||||
if !value.Valid {
|
||||
return ""
|
||||
}
|
||||
raw := strings.TrimSpace(value.String)
|
||||
if raw == "" {
|
||||
return ""
|
||||
}
|
||||
parsed, err := time.Parse(time.RFC3339Nano, raw)
|
||||
if err == nil {
|
||||
return parsed.UTC().Format(time.RFC3339Nano)
|
||||
}
|
||||
return raw
|
||||
}
|
||||
|
||||
type sqlStateError interface{ SQLState() string }
|
||||
|
||||
func sqlErrorCode(err error) string {
|
||||
|
||||
Reference in New Issue
Block a user