Skip to content

fix(providers): emit content:"" instead of null for tool-only assista…#72

Merged
chauncygu merged 1 commit intomainfrom
feature/tab-accept-ghost-suggestion
Apr 28, 2026
Merged

fix(providers): emit content:"" instead of null for tool-only assista…#72
chauncygu merged 1 commit intomainfrom
feature/tab-accept-ghost-suggestion

Conversation

@chauncygu
Copy link
Copy Markdown
Contributor

…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.

…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>
@chauncygu chauncygu merged commit 3ed9754 into main Apr 28, 2026
6 checks passed
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.

1 participant