Skip to content

fix: return synthetic empty text on Anthropic empty content response#171

Merged
jamiepine merged 2 commits intospacedriveapp:mainfrom
Marenz:fix/anthropic-empty-response
Feb 23, 2026
Merged

fix: return synthetic empty text on Anthropic empty content response#171
jamiepine merged 2 commits intospacedriveapp:mainfrom
Marenz:fix/anthropic-empty-response

Conversation

@Marenz
Copy link
Collaborator

@Marenz Marenz commented Feb 23, 2026

Anthropic returns an empty content array (stop_reason=end_turn) after side-effect-only tool calls like react or skip — the model has nothing further to say but the response is otherwise valid.

Previously this was treated as a CompletionError, which exhausted retries and fell through to the next model in the fallback chain. That model then failed for unrelated reasons (e.g. deepseek-reasoner expecting reasoning_content in history).

Return a synthetic Text { text: "" } response instead so the agentic loop terminates gracefully with no wasted retries or spurious fallbacks.

Depends on #174.

@Marenz Marenz force-pushed the fix/anthropic-empty-response branch from 85f1ac9 to 64a0ecf Compare February 23, 2026 17:21
Anthropic returns an empty content array (stop_reason=end_turn) after
side-effect-only tool calls like react or skip — the model has nothing
further to say but the response is valid.

Previously this was treated as an error, exhausting retries and falling
through to the next model in the fallback chain, which then failed for
unrelated reasons (e.g. deepseek-reasoner expecting reasoning_content).

Return a synthetic empty Text response instead so the agentic loop
terminates gracefully.
@Marenz Marenz force-pushed the fix/anthropic-empty-response branch from 64a0ecf to 8ddf516 Compare February 23, 2026 17:34
@jamiepine jamiepine merged commit 496bff3 into spacedriveapp:main Feb 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants