agent: Do not reuse assistant message across generations (#29360)

#29354 introduced a bug where we would append tool uses to the last
assistant message even if it was from a previous request.

Release Notes:

- N/A

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
Agus Zubiaga
2025-04-24 17:56:47 +00:00
committed by GitHub
co-authored by Bennet Bo Fenner
parent b0609272c0
commit 58604fba86
2 changed files with 32 additions and 31 deletions
@@ -453,9 +453,11 @@ impl CopilotChatLanguageModel {
}
}
messages.push(ChatMessage::User {
content: text_content,
});
if !text_content.is_empty() {
messages.push(ChatMessage::User {
content: text_content,
});
}
}
Role::Assistant => {
let mut tool_calls = Vec::new();