[PR #5249] [Engine] content is "" (not null) when a reply has no text and no tool call #5362

Open
opened 2026-11-07 16:34:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5249
Author: @festeraeb
Created: 11/4/2026
Status: 🔄 Open

Base: main ← Head: fix/content-empty-not-null


📝 Commits (1)

  • 873cd77 [Engine] content is "" (not null) when a reply has no text and no tool call

📊 Changes

2 files changed (+21 additions, -1 deletions)

View changed files

📝 serve/server.py (+3 -1)
📝 serve/test_server.py (+18 -0)

📄 Description

Problem. A non-streamed chat completion that runs out of max_tokens while the model is still thinking comes back with "content": null and only reasoning_content. Clients and proxies that require a string reject it. We hit it routing Strata's server through Lemonade as an OpenAI provider: Lemonade's provider route fails with type must be string, but is null.

Behavior after. openai_collect keeps content: null only when the message carries tool calls, which is how OpenAI sends it. A reply with no text and no tool call gets "". Text, reasoning and tool calls are unchanged. The streamed path is not affected; it never builds this message.

Validation (revision ffa80d7 + this change, Ubuntu 24.04, Python 3.12.3):

  • Passed: python -m unittest serve.test_server: 360 tests, OK.
  • Passed: the new UnfinishedToolCall.test_collect_content_is_null_only_beside_tool_calls, and it fails without the change (AssertionError: None != '').
  • Not run on this revision: a live model. The same one-line change has run in our fork's server behind Lemonade 2026.43.3 with a Tesla P100, where the null reply was rejected before it and passed after it. No hardware path is touched.

Related: #1392 (the web app drops a reply with empty content) is a separate case, not changed here.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5249 **Author:** [@festeraeb](https://github.com/festeraeb) **Created:** 11/4/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/content-empty-not-null` --- ### 📝 Commits (1) - [`873cd77`](https://github.com/Niko1221/Strata/commit/873cd77aa22ffed410537780038b7f6cb8ce8966) [Engine] content is "" (not null) when a reply has no text and no tool call ### 📊 Changes **2 files changed** (+21 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+3 -1) 📝 `serve/test_server.py` (+18 -0) </details> ### 📄 Description **Problem.** A non-streamed chat completion that runs out of `max_tokens` while the model is still thinking comes back with `"content": null` and only `reasoning_content`. Clients and proxies that require a string reject it. We hit it routing Strata's server through Lemonade as an OpenAI provider: Lemonade's provider route fails with `type must be string, but is null`. **Behavior after.** `openai_collect` keeps `content: null` only when the message carries tool calls, which is how OpenAI sends it. A reply with no text and no tool call gets `""`. Text, reasoning and tool calls are unchanged. The streamed path is not affected; it never builds this message. **Validation** (revision ffa80d7 + this change, Ubuntu 24.04, Python 3.12.3): - Passed: `python -m unittest serve.test_server`: 360 tests, OK. - Passed: the new `UnfinishedToolCall.test_collect_content_is_null_only_beside_tool_calls`, and it fails without the change (`AssertionError: None != ''`). - Not run on this revision: a live model. The same one-line change has run in our fork's server behind Lemonade 2026.43.3 with a Tesla P100, where the null reply was rejected before it and passed after it. No hardware path is touched. Related: #1392 (the web app drops a reply with empty content) is a separate case, not changed here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5362
No description provided.