Conversation
…nt turns (#71) When an assistant turn only carries tool_calls (no visible text), the neutral history stores content="" but messages_to_openai serialized it as content:null via `m.get("content") or None`. OpenAI accepts null for this case, but Ollama's OpenAI-compat endpoint rejects it with 400 `invalid message content type: <nil>`. Empty string is accepted by all target backends. Also: classify 400 / BadRequestError as a new INVALID_REQUEST category that is non-retryable. Previously a 400 fell into UNKNOWN (retryable), so the same broken payload was retried 3 times, exhausted the circuit breaker budget and triggered the 120s cooldown — blocking the entire session even though the request body, not the network, was the problem. Match urllib HTTPError(code=400) explicitly and add a targeted hint when the error string contains `invalid message content type`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
…nt turns (#71)
When an assistant turn only carries tool_calls (no visible text), the neutral history stores content="" but messages_to_openai serialized it as content:null via
m.get("content") or None. OpenAI accepts null for this case, but Ollama's OpenAI-compat endpoint rejects it with 400invalid message content type: <nil>. Empty string is accepted by all target backends.Also: classify 400 / BadRequestError as a new INVALID_REQUEST category that is non-retryable. Previously a 400 fell into UNKNOWN (retryable), so the same broken payload was retried 3 times, exhausted the circuit breaker budget and triggered the 120s cooldown — blocking the entire session even though the request body, not the network, was the problem. Match urllib HTTPError(code=400) explicitly and add a targeted hint when the error string contains
invalid message content type.