Skip to content

fix: thinking models with tools returning empty content (reasoning-only retry loop)#9290

Merged
mudler merged 1 commit intomasterfrom
fix/tool-call-noresult
Apr 9, 2026
Merged

fix: thinking models with tools returning empty content (reasoning-only retry loop)#9290
mudler merged 1 commit intomasterfrom
fix/tool-call-noresult

Conversation

@mudler
Copy link
Copy Markdown
Owner

@mudler mudler commented Apr 9, 2026

When clients like Nextcloud or Home Assistant send requests with tools to thinking models (e.g. Gemma 4 with <|channel>thought tags), the response was empty despite the backend producing valid content ( Fixes: #9283 ).

Root cause: the C++ autoparser puts clean content in both the raw Response and ChatDeltas. The Go-side PrependThinkingTokenIfNeeded then prepends the thinking start token to the already-clean content, causing ExtractReasoning to classify the entire response as unclosed reasoning. This made cbRawResult empty, triggering a retry loop that never succeeds.

Two fixes:

  • inference.go: check ChatDeltas for content/tool_calls regardless of whether Response is empty, so skipCallerRetry fires correctly
  • chat.go: when ChatDeltas have content but no tool calls, use that content directly instead of falling back to the empty cbRawResult

…ly retry loop)

When clients like Nextcloud or Home Assistant send requests with tools
to thinking models (e.g. Gemma 4 with <|channel>thought tags), the
response was empty despite the backend producing valid content.

Root cause: the C++ autoparser puts clean content in both the raw
Response and ChatDeltas. The Go-side PrependThinkingTokenIfNeeded
then prepends the thinking start token to the already-clean content,
causing ExtractReasoning to classify the entire response as unclosed
reasoning. This made cbRawResult empty, triggering a retry loop that
never succeeds.

Two fixes:
- inference.go: check ChatDeltas for content/tool_calls regardless of
  whether Response is empty, so skipCallerRetry fires correctly
- chat.go: when ChatDeltas have content but no tool calls, use that
  content directly instead of falling back to the empty cbRawResult
@mudler mudler added the bug Something isn't working label Apr 9, 2026
@mudler mudler merged commit 13a6ed7 into master Apr 9, 2026
36 checks passed
@mudler mudler deleted the fix/tool-call-noresult branch April 9, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend produced reasoning without actionable content, retrying

1 participant