ollama: Fix thinking being also sent as content - #55540
Merged
benbrandt merged 1 commit intoMay 6, 2026
Merged
Conversation
Contributor
Author
|
In the end, I still have issue with gemma4. Less systematic, but I suspect there are still issue somewhere between Zed and Ollama. Changed the release notes in accordance. (this patch is benificial nonetheless) |
benbrandt
approved these changes
May 6, 2026
benbrandt
left a comment
Member
There was a problem hiding this comment.
good catch, thanks!
Should we also be appending thinking text?
Contributor
Author
|
Appending thinking text? As in, merging ChatMessage::Assistant to contain both the thinking part and the generated part? Maybe. But looking at the generated text feed to the model by ollama, I notice nothing wrong beside what is fixed here. |
benbrandt
enabled auto-merge
May 6, 2026 12:54
This was referenced May 13, 2026
ubunatic
pushed a commit
to ubunatic/zed
that referenced
this pull request
May 16, 2026
"msg.string_contents();" return more than just content. It also return tool result (which need special handling, and should be emitted from the tool role) and thinking (which need already implemented special handling). This resulted in thinking being sent as content, which apparently ollama’s gemma4 parser didn’t handled well, and caused a number of issue that manifested by 1. outputting end of though token where unappropriate and 2. repeating things endlessly Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [ ] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) (no UI/UX impact) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable (a quick review, without benchmark, show that this should be at least as fast as the previous code. This is called only exceptionally anyway.) Closes zed-industries#55537 Release Notes: - Fixed "thinking" text being badly formatted when sent to Ollama
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
"msg.string_contents();" return more than just content. It also return tool result (which need special handling, and should be emitted from the tool role) and thinking (which need already implemented special handling). This resulted in thinking being sent as content, which apparently ollama’s gemma4 parser didn’t handled well, and caused a number of issue that manifested by 1. outputting end of though token where unappropriate and 2. repeating things endlessly Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [ ] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) (no UI/UX impact) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable (a quick review, without benchmark, show that this should be at least as fast as the previous code. This is called only exceptionally anyway.) Closes zed-industries#55537 Release Notes: - Fixed "thinking" text being badly formatted when sent to Ollama
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
"msg.string_contents();" return more than just content. It also return tool result (which need special handling, and should be emitted from the tool role) and thinking (which need already implemented special handling). This resulted in thinking being sent as content, which apparently ollama’s gemma4 parser didn’t handled well, and caused a number of issue that manifested by 1. outputting end of though token where unappropriate and 2. repeating things endlessly Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [ ] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) (no UI/UX impact) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable (a quick review, without benchmark, show that this should be at least as fast as the previous code. This is called only exceptionally anyway.) Closes zed-industries#55537 Release Notes: - Fixed "thinking" text being badly formatted when sent to Ollama
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"msg.string_contents();" return more than just content. It also return tool result (which need special handling, and should be emitted from the tool role) and thinking (which need already implemented special handling).
This resulted in thinking being sent as content, which apparently ollama’s gemma4 parser didn’t handled well, and caused a number of issue that manifested by 1. outputting end of though token where unappropriate and 2. repeating things endlessly
Self-Review Checklist:
Closes #55537
Release Notes: