fix: add hasReasoningContent to second content gate in Task.ts

The first content gate (line 3416) was updated to include
hasReasoningContent, but the second gate (line 3567) was not.
This caused reasoning-only responses to save an assistant message
to history but then fall through to the "no assistant messages"
error path, incrementing the retry counter and leaving an orphaned
assistant message in conversation history.

Both gates now consistently check:
  if (hasTextContent || hasToolUses || hasReasoningContent)

Addresses review feedback from @roomote.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
neorrk 2026-02-16 22:02:06 +01:00
parent c51cf58c61
commit 0760818025

View file

@ -3564,7 +3564,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
presentAssistantMessage(this)
}
if (hasTextContent || hasToolUses) {
if (hasTextContent || hasToolUses || hasReasoningContent) {
// NOTE: This comment is here for future reference - this was a
// workaround for `userMessageContent` not getting set to true.
// It was due to it not recursively calling for partial blocks