fix(chat): sanitize empty assistant content before requests - #31175
kenanjun001 wants to merge 1 commit into
Conversation
|
For anyone investigating this issue: I was able to reproduce it consistently with The root cause was an assistant message with empty content being sent in the request history: {
"role": "assistant",
"content": ""
}After applying the patch in this PR, the same workflow completed successfully without triggering:
|
|
Additional reproduction details: From the user perspective, the issue appears as repeated provider failures after a skill invocation. Example: The visible error is misleading because the actual failure happens earlier when Hermes replays conversation history containing: {
"role": "assistant",
"content": ""
}On strict Anthropic-compatible providers (AWS Bedrock Anthropic in my case), this results in a request validation failure: The provider error is then retried multiple times, which is why users observe several identical failure messages instead of the underlying validation problem. |
|
Thanks for isolating the strict-provider replay failure. The current code still constructs a pure tool-call assistant turn with Problems
Suggested changes
Automated hermes-sweeper review. |
|
Resolved on main via PR #73071. Empty assistant content is now repaired before it ever reaches the transport: |
Summary
Sanitize assistant messages with empty content before sending Chat Completions requests.
Strict Anthropic-compatible providers such as AWS Bedrock Anthropic reject assistant messages with empty content.
During tool / skill execution, Hermes can produce:
{ "role": "assistant", "content": "" }This causes HTTP 400:
Fix
Normalize empty assistant content before sending requests.