mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 06:45:50 +00:00
fix: ACP 模式下 extended thinking + tool_use 触发连续 user 消息导致 400 (CC-1215)
This commit is contained in:
@@ -5829,11 +5829,15 @@ export function ensureToolResultPairing(
|
||||
)
|
||||
} else {
|
||||
// Content is empty after stripping orphaned tool_results. We still
|
||||
// need a user message here to maintain role alternation — otherwise
|
||||
// the assistant placeholder we just pushed would be immediately
|
||||
// followed by the NEXT assistant message, which the API rejects with
|
||||
// a role-alternation 400 (not the duplicate-id 400 we handle).
|
||||
// need a user message here to maintain role alternation — unless the
|
||||
// previous result entry is already a user message, in which case
|
||||
// inserting another user placeholder creates consecutive-user messages
|
||||
// that Anthropic rejects with a misleading "tool_use without
|
||||
// tool_result" 400 (CC-1215).
|
||||
i++
|
||||
if (result.at(-1)?.type === 'user') {
|
||||
continue
|
||||
}
|
||||
result.push(
|
||||
createUserMessage({
|
||||
content: NO_CONTENT_MESSAGE,
|
||||
|
||||
Reference in New Issue
Block a user