Skip to content

fix(agent): use reasoning content when model wraps entire response in think tags - #2124

Closed
ygd58 wants to merge 0 commit into
NousResearch:mainfrom
ygd58:fix/use-reasoning-when-response-is-empty
Closed

fix(agent): use reasoning content when model wraps entire response in think tags#2124
ygd58 wants to merge 0 commit into
NousResearch:mainfrom
ygd58:fix/use-reasoning-when-response-is-empty

Conversation

@ygd58

@ygd58 ygd58 commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

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

@ygd58 ygd58 closed this Mar 20, 2026
@ygd58
ygd58 force-pushed the fix/use-reasoning-when-response-is-empty branch from 688272e to 3a9a1bb Compare March 20, 2026 06:15
@ygd58

ygd58 commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

Closing — upstream already includes this fix in the latest main. The reasoning-as-fallback logic is now part of the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Agent randomly dies before task completion

1 participant