fix: require a user message when provided messages are empty

This commit is contained in:
hugocasa
2026-09-14 18:26:25 +02:00
parent cc9a4213b3
commit ed503366db
+2 -1
View File
@@ -995,7 +995,8 @@ pub async fn run_agent(
.map(|m| !m.is_empty())
.unwrap_or(false);
if !matches!(history, HistorySource::Messages(_)) && !has_user_message {
// An empty list, such as a messages expression that evaluated to null, is no conversation to send.
if !matches!(&history, HistorySource::Messages(m) if !m.is_empty()) && !has_user_message {
return Err(Error::internal_err(
"Either 'messages' or 'user_message' must be provided".to_string(),
));