agent: Skip empty assistant messages for Mistral provider#47579
agent: Skip empty assistant messages for Mistral provider#47579benbrandt merged 1 commit intozed-industries:mainfrom
Conversation
|
I can confirm that this PR does help with the Mistral API. The issue appears mostly when the agent calls the Note however that this patch does not fix file editing completely for Mistral models. Sometimes, the Mistral model would answer to the content request with the file content correctly enclosed with backticks, but with some extra text appended afterwards. Zed happily writes the additional text to the file instead of showing it in the agent panel. As far as I can tell, this is an unrelated bug though. |
Yes, I've noticed this too! Perhaps some tweaks to the tool description (or switching to The issue fixed here is a more deterministic fix in that it filters out requests which will definitely be considered invalid, but the diff format is fuzzier and probably deserves some eval testing to see if it really helps (although from what I can tell the eval tests don't include all providers by default). |
I have had quite some success too by enabling the streaming edit_file tool, even though the Mistral API is not streaming the tool call, so the whole edit appears at once.
My opinion probably doesn't matter much, but I totally agree that this patch is worth merging. |
This *may* help with zed-industries#39211 or zed-industries#39031 although I'm not positive. Ata minimum, it should prevent sending invalid requests to the Mistral API, which return a 400 error and prevent the thread from progressing.
Head branch was pushed to by a user without write access
9deb94a to
4429afd
Compare
|
Looks like CI failed trying to find the Pushed a rebase, hopefully good to go for a CI run this time! |
|
I had this issue occasionally and switched models when it happened. Now it happens 100% of the time I ask it to edit files. I am on Zed 0.224.6 where this fix should be merged. chat md mistral.md I set the profile to write and verified all tool calls are there. I allowed all of them explicitly and changed the default to allow, just in case. |
|
@keizerkarel1 This PR was merged in the 0.225.0 preview release. It is not included in 0.224.6. |
This small change may help with #39211, #35025 or #39031 although I'm not positive it will fix it entirely. At a minimum, it should prevent sending invalid requests to the Mistral API, which return a 400 error and can prevent the thread from progressing if it gets stuck in a retry loop.
This should prevent sending a message like
{ "role": "assistant", "content": "" }if for some reason the thread contains a message with an empty text content and no tool calls.Some users (including myself) have encountered this with the Devstral 2 models, although it doesn't seem trivial to reproduce: #37021 (comment)
When it occurs, error logs look something like this:
Release Notes: