Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 19, 2025

Summary

This PR improves error messages when OpenAI-compatible providers fail to use tools properly, addressing issue #7226.

Problem

Users were seeing a generic "Roo is having trouble" error message when using OpenAI-compatible providers (like Qwen-3-Coder-plus) that don't properly format tool calls using XML tags. This made it difficult to understand what was going wrong and how to fix it.

Solution

  • Added specific guidance for OpenAI-compatible providers when consecutive mistakes are detected
  • Provided clearer instructions about XML tool format requirements
  • Listed common issues and solutions specific to these providers
  • Added comprehensive tests for the new error message variations

Changes

  1. Enhanced error messages in Task.ts: When the consecutive mistake limit is reached for OpenAI-compatible providers, users now get specific guidance about XML tool formatting
  2. Updated noToolsUsed response: Added provider-specific hints for OpenAI-compatible models
  3. Added tests: Created comprehensive test coverage for the new error message variations

Testing

  • ✅ All existing tests pass
  • ✅ New tests added for OpenAI-compatible provider error messages
  • ✅ TypeScript compilation successful
  • ✅ Linting passes

Impact

This change will help users better understand and resolve issues when using OpenAI-compatible providers that struggle with tool formatting, reducing frustration and support requests.

Fixes #7226


Important

Improves error messages for OpenAI-compatible providers in Task.ts and responses.ts, adding specific guidance and tests for better user understanding.

  • Behavior:
    • Enhanced error messages in Task.ts for OpenAI-compatible providers when consecutive mistakes occur, providing specific guidance on XML tool formatting.
    • Updated noToolsUsed in responses.ts to include provider-specific hints for OpenAI-compatible models.
  • Testing:
    • Added comprehensive tests in responses-openai-compatible.spec.ts for new error message variations.
  • Misc:
    • Improved guidance in Task.ts for mistake limits, listing common issues and solutions for OpenAI-compatible providers.

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

- Add specific guidance when OpenAI Compatible models fail to use tools
- Provide clearer instructions about XML tool format requirements
- Help users understand common issues with tool usage formatting
- Add tests for the new error message variations

Fixes #7226
- Add specific guidance when OpenAI-compatible models fail to use tools
- Provide clearer instructions about XML tool format requirements
- Help users understand common issues with tool usage formatting
- Add tests for the new error message variations

Fixes #7226
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 19, 2025 19:00
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 19, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Aug 19, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.

const baseMessage = `[ERROR] You did not use a tool in your previous response! Please retry with a tool use.`

// List of providers that use OpenAI-compatible APIs
const openAICompatibleProviders = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice I've duplicated this openAICompatibleProviders array in multiple places (here, in Task.ts twice, and partially in tests). Should I consider extracting this to a shared constant to avoid maintenance issues? Maybe in a constants file or the types package?


it("should include OpenAI Compatible specific hints for OpenAI-compatible providers", () => {
// Test with various OpenAI-compatible providers
const openAICompatibleProviders = ["openai", "openai-native", "fireworks", "groq", "ollama"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that I'm only testing 5 providers here while the implementation supports 13? I should either test all of them or add a comment explaining why this subset is sufficient for testing.

t("common:errors.mistake_limit_guidance"),
)
// Provide more specific guidance for OpenAI-style API providers
const openAICompatibleProviders = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've duplicated the same provider list here again. This really should be a shared constant. Also, this error message construction (lines 1568-1579) could be extracted to a helper function for better testability.


if (!didToolUse) {
this.userMessageContent.push({ type: "text", text: formatResponse.noToolsUsed() })
this.userMessageContent.push({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another duplication of the provider list. At this point, I'm just copy-pasting my own mistakes. Definitely needs to be DRY'd up.

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

Labels

bug Something isn't working 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

Archived in project

4 participants