fix: prevent premature loop exit when weak models return empty after substantive tool calls#10472
Merged
Conversation
…substantive tool calls The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
kagura-agent
pushed a commit
to kagura-agent/hermes-agent
that referenced
this pull request
Apr 16, 2026
…substantive tool calls (NousResearch#10472) The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
4 tasks
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…substantive tool calls (NousResearch#10472) The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…substantive tool calls (NousResearch#10472) The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…substantive tool calls (NousResearch#10472) The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…substantive tool calls (NousResearch#10472) The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…substantive tool calls (NousResearch#10472) The _last_content_with_tools fallback was firing indiscriminately for ALL content+tool turns, including mid-task narration alongside substantive tools (terminal, search_files, etc.). This caused the agent to exit the loop with 'I'll scan the directory...' as the final answer instead of nudging the model to continue processing tool results. The fix restricts the fallback to housekeeping-only turns (memory, todo, skill_manage, session_search) where the content genuinely IS the final answer. When substantive tools are present, the existing post-tool nudge mechanism now fires instead, prompting the model to continue. Affected models: xiaomi/mimo-v2-pro, GLM-5, and other weaker models that intermittently return empty after tool results. Reported by user Renaissance on Discord.
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.
Summary
Fixes the
↻ Empty response after tool calls — using earlier content as final answerpremature exit that users with weaker models (xiaomi/mimo-v2-pro, GLM-5, etc.) are hitting.The bug: The
_last_content_with_toolsfallback fires for ALL turns where the model returns content alongside tool calls — including mid-task narration like "I'm going to scan the directory..." alongsideterminal(ls). When the weak model then returns empty on the next turn (a known behavior), the fallback immediately uses that narration as the "final answer" and exits the loop. The post-tool nudge mechanism (designed specifically for this weak-model scenario) never gets a chance to fire because the fallback preempts it.The fix: Only use the
_last_content_with_toolsfallback when ALL tools in the turn were housekeeping (memory, todo, skill_manage, session_search) — where the content genuinely IS the final answer (e.g. "You're welcome!" + memory save). When substantive tools are present (terminal, search_files, etc.), skip the fallback and let the post-tool nudge prompt the model to continue processing.Control flow (before)
Control flow (after)
Changes
_last_content_tools_all_housekeepingflag alongside_last_content_with_toolsTest plan
Reported by user Renaissance on Discord.