Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 19, 2025

Related GitHub Issue

Closes: #10106

Description

This PR addresses the "Unknown API Error: Please contact Roo Code support" / "Model Response Incomplete" errors reported in Issue #10106.

Root Cause: When a model is configured for native tool calling protocol but outputs XML-style tool tags (like <update_todo_list>, <attempt_completion>) instead of using native tool calls, the native protocol parser ignores these tags as plain text, resulting in "no tools used" errors.

Solution: Added fallback XML parsing logic in Task.ts that:

  1. Detects when native protocol completed streaming with no native tool calls
  2. Checks if the assistant message contains valid XML tool tags
  3. Uses AssistantMessageParser to parse and recover tool calls from the XML output
  4. Replaces the content blocks with parsed results to allow tool execution

Key Implementation Details:

  • Uses toolNames array from @roo-code/types to detect valid tool tags via regex
  • Only triggers fallback when native protocol has no tool_use or mcp_tool_use blocks AND XML tags are present
  • Logs when fallback is triggered for debugging purposes
  • Does not affect XML protocol behavior (only affects native protocol)

Test Procedure

  1. Unit Tests: Added comprehensive tests in src/core/task/__tests__/fallback-xml-parsing.spec.ts

    • Run: cd src && npx vitest run core/task/__tests__/fallback-xml-parsing.spec.ts
    • All 13 tests pass covering:
      • XML tool tag detection patterns
      • AssistantMessageParser fallback parsing
      • Fallback trigger conditions
      • Real-world bug scenarios from the issue
  2. Existing Tests: All existing Task tests continue to pass

    • Run: cd src && npx vitest run core/task/__tests__/
    • 123 tests pass, 4 skipped
  3. Manual Testing: Users experiencing this issue with Requesty/OpenRouter/Roo Cloud can test by:

    • Using a model that was previously causing the error
    • Verifying tools are now executed instead of showing "Model Response Incomplete"

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 - This is a backend fix with no UI changes.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This fix is designed to be a graceful fallback mechanism that does not interfere with normal native protocol operation. It only activates when there is a clear protocol mismatch (no native tool calls but XML tags present).

The fix addresses the exact error pattern reported by @AhrenFullStop in the issue comments, where models output:

<update_todo_list>...</update_todo_list>
<attempt_completion>...</attempt_completion>

but the native protocol was expecting function calls, causing "Model Response Incomplete" errors.

Get in Touch

@roomote (AI Agent)

…XML tool tags

This addresses Issue #10106 where models configured for native tool calling
protocol would sometimes output XML-style tool tags instead of using native
tool calls, causing "Model Response Incomplete" / "no tools used" errors.

Changes:
- Add fallback XML parsing logic in Task.ts after stream completion
- Detect when native protocol received no tool calls but XML tags are present
- Use AssistantMessageParser to recover tool calls from XML output
- Add comprehensive unit tests for the fallback mechanism

The fix detects the protocol mismatch and gracefully falls back to XML parsing
to recover the tool calls, preventing task failures across multiple providers
(Requesty, OpenRouter, Roo Cloud) that exhibited this behavior.
@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 addresses Issue #10106 by adding a fallback XML parsing mechanism for native protocol when models output XML tool tags instead of using native tool calls. The approach:

  • Detects when native protocol completed with no tool calls but XML tool tags are present in the response
  • Uses the existing AssistantMessageParser to recover tool calls from the XML output
  • Only activates when both conditions are met (no native calls AND XML tags detected)
  • Includes comprehensive test coverage (13 tests passing)

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