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 14:56:47 -03:00 committed by GitHub
parent b0609272c0
commit 58604fba86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 31 deletions

View file

@ -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();