Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 16, 2025

Related GitHub Issue

Closes: #10106

Description

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

The issue reports an "Unknown API Error" when using OpenRouter with the Mimo-V2-Flash model. The error occurs when the model outputs malformed tool call syntax (like <tool_call><function=read_file>...) in its reasoning/thinking content, which is not a valid tool call format.

Root Cause: When models output reasoning content but no actual text or tool call content, the OpenRouter provider was not handling this gracefully, resulting in an empty assistant response error that manifested as "Unknown API error" in the UI.

Solution: Added hasContent and hasReasoning tracking variables to the OpenRouter provider's stream processing. When reasoning exists but no actual content was generated, a localized placeholder message is emitted (mirroring the existing safeguard in the Gemini provider at src/api/providers/gemini.ts lines 298-312).

Test Procedure

  1. All existing OpenRouter tests pass (25/25)
  2. TypeScript type checking passes
  3. ESLint passes with no warnings
  4. To manually test: Use OpenRouter with a model that tends to output reasoning-only responses (like Mimo-V2-Flash) and verify no "Unknown API error" is thrown

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 fix mirrors the existing safeguard in the Gemini provider. The localized message uses the existing translation key common:errors.gemini.thinking_complete_no_output which is appropriate for this case as well.

Get in Touch

Discord: N/A (automated PR)

@roomote
Copy link
Contributor Author

roomote bot commented Dec 16, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No blocking issues found.

The implementation correctly adds hasContent and hasReasoning tracking to prevent "Empty assistant response" errors when models output reasoning-only content. The approach mirrors the existing Gemini provider safeguard and uses the same localized translation key.

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 16, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 7, 2026
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jan 7, 2026
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: Done

Development

Successfully merging this pull request may close these issues.

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

2 participants