Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 26, 2025

This PR attempts to address Issue #10319 by restoring the ability for users of the OpenAI-Compatible provider to explicitly select XML tool protocol.

Problem

In v3.37+, the Tool Call Protocol selector was removed and all new tasks are forced to use native tool calling. This breaks users with OpenAI-Compatible endpoints backed by servers like SGLang or vLLM that do not support native tool calling (e.g., HarmonyParser throws NotImplementedError: structure_info not used with HarmonyParser).

Solution

This PR:

  1. Modifies resolveToolProtocol.ts to respect the user's toolProtocol preference when using the OpenAI-Compatible provider (apiProvider === "openai")
  2. Adds a Tool Protocol selector to the OpenAI-Compatible provider settings in OpenAICompatible.tsx
  3. Adds comprehensive tests for the new behavior

Precedence Logic

The updated resolveToolProtocol() function now follows this precedence:

  1. Locked Protocol (task-level lock for resumed tasks - highest priority)
  2. User Preference for OpenAI-Compatible (respects toolProtocol setting only for apiProvider: "openai")
  3. Native (default for all other new tasks)

This approach:

  • Maintains native as the default for all providers
  • Only allows explicit XML selection for OpenAI-Compatible provider where backends may not support native tools
  • Is minimally invasive (only affects OpenAI-Compatible provider, not other providers)

Feedback and guidance are welcome.


Important

Restores XML tool protocol option for OpenAI-Compatible provider, adds UI selector, and updates tests.

  • Behavior:
    • Restores XML tool protocol option for OpenAI-Compatible provider in resolveToolProtocol.ts.
    • Adds tool protocol selector to OpenAI-Compatible provider settings in OpenAICompatible.tsx.
    • Comprehensive tests added in resolveToolProtocol.spec.ts and OpenAICompatible.spec.tsx.
  • Precedence Logic:
    • resolveToolProtocol() now respects user preference for XML protocol for OpenAI-Compatible provider.
    • Locked protocol takes precedence over user preference.
    • Defaults to native protocol for other providers.
  • UI Changes:
    • Adds XML/native protocol selection dropdown in OpenAICompatible.tsx.

This description was created by Ellipsis for 89fd5a6. You can customize this summary. It will automatically update as commits are pushed.

This restores the ability for users of the OpenAI-Compatible provider to
explicitly select XML tool protocol, fixing compatibility issues with
backends like SGLang/vLLM that do not support native tool calling.

Changes:
- Modified resolveToolProtocol.ts to respect user toolProtocol preference
  for the OpenAI-Compatible provider ("openai")
- Added Tool Protocol selector to OpenAICompatible.tsx component
- Added tests for the new behavior in resolveToolProtocol.spec.ts
- Updated OpenAICompatible.spec.tsx to mock Select components

Fixes #10319
@roomote
Copy link
Contributor Author

roomote bot commented Dec 26, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

This PR correctly restores the XML tool protocol option for the OpenAI-Compatible provider by:

  • Modifying resolveToolProtocol.ts to respect user preference for the OpenAI-Compatible provider
  • Adding a Tool Protocol selector to the UI
  • Including comprehensive test coverage

The implementation is clean and well-tested.

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 26, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 26, 2025

Fixaroo Clock   See task on Roo Cloud

PR marked as ready for review. All tests pass (40 tests total across backend and UI).

@roomote roomote bot marked this pull request as ready for review December 26, 2025 15:44
@roomote roomote bot requested review from cte, jr and mrubens as code owners December 26, 2025 15:44
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Dec 26, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 26, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

This PR correctly restores the XML tool protocol option for the OpenAI-Compatible provider by:

  • Modifying resolveToolProtocol.ts to respect user preference for the OpenAI-Compatible provider (apiProvider === "openai")
  • Adding a Tool Protocol selector to the UI with proper i18n support
  • Including comprehensive test coverage for the new behavior
  • Maintaining backward compatibility (defaults to native when no preference is set)

The implementation is clean and well-tested.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants