Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 19, 2025

Related GitHub Issue

Closes: #10106

Description

This PR attempts to address Issue #10106. Feedback and guidance are welcome.

The fix adds a safeguard to the Requesty provider to handle scenarios where models return only reasoning/thinking content without actual text or tool calls. This can occur when:

  • Models output their thinking process but fail to produce actionable content
  • Models attempt tool calls but format them incorrectly within their reasoning content (e.g., <tool_call><function=...> syntax)

Implementation:

  • Added tracking for hasContent and hasReasoning flags during streaming
  • When reasoning content is present but no actual content was emitted, a placeholder message is yielded to prevent the "empty assistant response" error
  • This mirrors the same safeguard pattern already used in the Gemini provider

This fix is part of a broader effort to address empty response errors across multiple providers (see related PR #10136 for OpenRouter).

Test Procedure

  1. Unit tests added for:

    • Scenario where model returns only reasoning content (should emit placeholder)
    • Scenario where model returns both reasoning and actual content (should not emit placeholder)
  2. Run tests:

    cd src && npx vitest run api/providers/__tests__/requesty.spec.ts

    All 14 tests pass.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A - Backend change only, no UI changes.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This is one potential fix for the "Unknown API Error" issue. The root cause appears to be related to how certain models format tool calls when using reasoning/thinking mode, particularly with the newer native tool protocol. The model may output something like <tool_call><function=get_weather> in its reasoning content, which is not a valid tool call format.

Related PRs:

Get in Touch

@roomote

Add safeguard to emit placeholder text when model returns only
reasoning/thinking content without actual text or tool calls.
This prevents "empty assistant response" errors that can occur
when models output malformed tool call syntax in their reasoning.

Includes tests for reasoning-only response handling.
@roomote
Copy link
Contributor Author

roomote bot commented Dec 19, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly adds safeguards to handle scenarios where models return only reasoning/thinking content without actual text or tool calls. The changes are well-tested with 14 passing tests.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Unknown API Error: Please contact Roo Code support

3 participants