fix(agent): use reasoning content when model wraps entire response in think tags - #2124
Closed
ygd58 wants to merge 0 commit into
Closed
fix(agent): use reasoning content when model wraps entire response in think tags#2124ygd58 wants to merge 0 commit into
ygd58 wants to merge 0 commit into
Conversation
ygd58
force-pushed
the
fix/use-reasoning-when-response-is-empty
branch
from
March 20, 2026 06:15
688272e to
3a9a1bb
Compare
Contributor
Author
|
Closing — upstream already includes this fix in the latest main. The reasoning-as-fallback logic is now part of the codebase. |
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.
Fixes #2123
Problem
Some models (especially local Ollama models with extended thinking) wrap their entire response in
<think>tags. Hermes detects this as empty content, retries 3 times, then dies with "Max retries (3) for empty content exceeded."Fix
When max retries are hit and reasoning text is available but final_response is empty, use the reasoning text as the final response instead of dying. This allows the agent to continue working even when the model puts content in think blocks.
Before
❌ Max retries (3) for empty content exceeded. → agent dies
After
Using reasoning as response content (model wrapped entire response in think tags). → agent continues