You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
After jcode is actually doing something, gets interrupted, and then executes another task, it returns a 400 error #321
After jcode is actually doing something, gets interrupted, and then executes another task, it returns a 400 error。
No matter what you say, it cannot recover。After exiting, even if you enter /resume again, it still cannot recover.
OpenAI-compatible chat request failed
endpoint: https://api.deepseek.com/chat/completions
model: deepseek-v4-flash
auth: DEEPSEEK_API_KEY
status: 400 Bad Request
response: {"error":{"message":"Invalid assistant message: content or tool_calls must be set","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
Hint: check network connectivity, DNS/TLS, that the base URL includes the API version (usually /v1), and that the model exists on the provider.
Root cause: When a turn is interrupted while only reasoning (thinking) content has streamed, the persisted assistant message contains a single reasoning block but no text or tool calls. The OpenAI-compatible request builder serialized this as a bare {"role":"assistant"} for providers like DeepSeek that don't accept a standalone reasoning_content field. DeepSeek then rejects the entire request with 400 Invalid assistant message: content or tool_calls must be set, which is why no follow-up message recovered and even /resume kept failing (it replayed the same invalid history).
Fix: The builder now drops the empty interrupted-thinking artifact entirely when there is no text/tool payload and no provider-accepted reasoning_content (and, for providers that do accept reasoning replay, attaches an explicit empty content so strict validators accept it). Added a regression test that asserts no assistant message is sent without content or tool_calls.
Cause: When a turn is interrupted while only reasoning has streamed, the persisted assistant message carries a single Reasoning block with no text and no tool calls. For direct OpenAI-compatible providers that don't accept a standalone reasoning_content field (e.g. DeepSeek, where allow_reasoning=false), the request builder serialized this as a bare {"role":"assistant"}. DeepSeek rejects that with 400 Invalid assistant message: content or tool_calls must be set, and because the bad message stays in history, every subsequent request (including /resume) replays it and keeps failing, permanently wedging the session.
Fix: The OpenAI-compatible message builder now only keeps an interrupted-thinking assistant message when it actually carries text/tool_calls, or when a provider-accepted reasoning_content field is present (in which case it adds an explicit empty content so strict validators still accept it). Otherwise the empty artifact is dropped entirely. Added regression tests for both branches.
This will close automatically on the next release.
Triaged: this was reproduced and fixed in b8ba276a ("fix(openrouter): never send empty assistant message from interrupted reasoning").
Root cause: when a turn was interrupted while only reasoning had streamed, the persisted assistant message carried a single Reasoning block but no text/tool calls. For direct OpenAI-compatible providers that don't accept a standalone reasoning_content field (e.g. DeepSeek), the request builder serialized this as a bare {"role":"assistant"}, which the provider rejected with 400 "Invalid assistant message: content or tool_calls must be set". Because the invalid message stayed in history, even /resume replayed it and the session could never recover, matching your report exactly.
Fix: the builder now only keeps an interrupted reasoning-only assistant turn when it has text/tool calls, or when a provider-accepted reasoning_content field is present (with an explicit empty content added for strict validators); otherwise the empty artifact is dropped. Regression tests cover both the drop path (DeepSeek-style) and the keep-with-reasoning path.
Activity
1jehuang commentedon Jun 5, 2026
Reproduced and fixed in
b8ba276a.Root cause: When a turn is interrupted while only reasoning (thinking) content has streamed, the persisted assistant message contains a single reasoning block but no text or tool calls. The OpenAI-compatible request builder serialized this as a bare
{"role":"assistant"}for providers like DeepSeek that don't accept a standalonereasoning_contentfield. DeepSeek then rejects the entire request with400 Invalid assistant message: content or tool_calls must be set, which is why no follow-up message recovered and even/resumekept failing (it replayed the same invalid history).Fix: The builder now drops the empty interrupted-thinking artifact entirely when there is no text/tool payload and no provider-accepted
reasoning_content(and, for providers that do accept reasoning replay, attaches an explicit emptycontentso strict validators accept it). Added a regression test that asserts no assistant message is sent withoutcontentortool_calls.Will close automatically on the next release.
1jehuang commentedon Jun 5, 2026
Root-caused and fixed in
b8ba276a.Cause: When a turn is interrupted while only reasoning has streamed, the persisted assistant message carries a single
Reasoningblock with no text and no tool calls. For direct OpenAI-compatible providers that don't accept a standalonereasoning_contentfield (e.g. DeepSeek, whereallow_reasoning=false), the request builder serialized this as a bare{"role":"assistant"}. DeepSeek rejects that with400 Invalid assistant message: content or tool_calls must be set, and because the bad message stays in history, every subsequent request (including/resume) replays it and keeps failing, permanently wedging the session.Fix: The OpenAI-compatible message builder now only keeps an interrupted-thinking assistant message when it actually carries text/tool_calls, or when a provider-accepted
reasoning_contentfield is present (in which case it adds an explicit emptycontentso strict validators still accept it). Otherwise the empty artifact is dropped entirely. Added regression tests for both branches.This will close automatically on the next release.
1jehuang commentedon Jun 5, 2026
Triaged: this was reproduced and fixed in
b8ba276a("fix(openrouter): never send empty assistant message from interrupted reasoning").Root cause: when a turn was interrupted while only reasoning had streamed, the persisted assistant message carried a single
Reasoningblock but no text/tool calls. For direct OpenAI-compatible providers that don't accept a standalonereasoning_contentfield (e.g. DeepSeek), the request builder serialized this as a bare{"role":"assistant"}, which the provider rejected with 400 "Invalid assistant message: content or tool_calls must be set". Because the invalid message stayed in history, even/resumereplayed it and the session could never recover, matching your report exactly.Fix: the builder now only keeps an interrupted reasoning-only assistant turn when it has text/tool calls, or when a provider-accepted
reasoning_contentfield is present (with an explicit emptycontentadded for strict validators); otherwise the empty artifact is dropped. Regression tests cover both the drop path (DeepSeek-style) and the keep-with-reasoning path.Will close automatically on the next release.
fix(openrouter): never send empty assistant message from interrupted …
fix(openrouter): never send empty assistant message from interrupted …
fix(openrouter): never send empty assistant message from interrupted …