fix(agent): stop sending think=false to remote custom providers - #11296
Open
LeonSGP43 wants to merge 1 commit into
Open
fix(agent): stop sending think=false to remote custom providers#11296LeonSGP43 wants to merge 1 commit into
LeonSGP43 wants to merge 1 commit into
Conversation
Collaborator
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the incompatible think field.
Problems
- Current main no longer has the inline request builder this PR edits:
AIAgent._build_api_kwargs()is a forwarder atrun_agent.py:5328-5331. The active provider-specific request construction callsCustomProfile.build_api_kwargs_extras()throughagent/transports/chat_completions.py:562-594. - The reported behavior is still live there:
plugins/model-providers/custom/__init__.py:52-56emitsextra_body["think"] = Falsefor every disabled-reasoning custom endpoint. Existing assertions attests/plugins/model_providers/test_custom_profile.py:51-64encode that broad behavior.
Suggested changes
- Port the endpoint predicate to
CustomProfile.build_api_kwargs_extras()and gate the assignment atplugins/model-providers/custom/__init__.py:55-56using its suppliedbase_urlcontext. - Add remote-custom and supported-Ollama cases at the profile/transport layer, replacing the stale run-agent test target.
Automated hermes-sweeper review.
| # Ollama-style custom providers: pass think=false when reasoning is | ||
| # disabled. Remote OpenAI-compatible custom endpoints reject Ollama's | ||
| # native `think` field with 4xx validation errors. | ||
| if self._should_send_ollama_think_flag() and self.reasoning_config and isinstance(self.reasoning_config, dict): |
Contributor
There was a problem hiding this comment.
Current main no longer executes this inline custom-provider branch: AIAgent._build_api_kwargs() now forwards to agent.chat_completion_helpers, whose transport invokes CustomProfile.build_api_kwargs_extras() (agent/transports/chat_completions.py:562-594). Port this guard to plugins/model-providers/custom/__init__.py; otherwise the active request path will still emit think: false for remote custom endpoints.
5 tasks
This was referenced Aug 3, 2026
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\n- only send Ollama's native \ flag to Ollama-style custom endpoints\n- keep existing local Ollama behavior intact while avoiding 4xx validation errors on remote OpenAI-compatible providers\n- add a regression test for remote custom providers\n\nWhy\n- \ currently injects \ for every endpoint when reasoning is disabled\n- remote custom providers like Mistral reject that Ollama-specific field with HTTP 422\n\nFixes #11237\n\nTesting\n- python3 -m pytest -o addopts='' tests/run_agent/test_run_agent.py -k "think_false or remote_custom_provider_does_not_receive_ollama_think_flag or non_custom_provider_unaffected"