diff --git a/internal/service/chat_service.go b/internal/service/chat_service.go index f8e0af7..16c68aa 100644 --- a/internal/service/chat_service.go +++ b/internal/service/chat_service.go @@ -1118,6 +1118,14 @@ func (s *ChatService) systemMessage(ctx context.Context, conversationID, body st return } if created { + // Publish the hydrated message. Append leaves Attachments nil, which + // serialises to null and breaks clients that trust the "always an + // array" contract this field's own doc comment promises. + if full, hErr := s.withAttachments(ctx, "", msg); hErr == nil { + msg = full + } else if msg.Attachments == nil { + msg.Attachments = []model.Attachment{} + } s.publish(ctx, conversationID, "", msg) } }