-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: improve error messages for OpenAI-compatible providers #7227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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
There was a problem hiding this 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 = [ |
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
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({ |
There was a problem hiding this comment.
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.
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
Changes
Testing
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.tsandresponses.ts, adding specific guidance and tests for better user understanding.Task.tsfor OpenAI-compatible providers when consecutive mistakes occur, providing specific guidance on XML tool formatting.noToolsUsedinresponses.tsto include provider-specific hints for OpenAI-compatible models.responses-openai-compatible.spec.tsfor new error message variations.Task.tsfor mistake limits, listing common issues and solutions for OpenAI-compatible providers.This description was created by
for f5cdf65. You can customize this summary. It will automatically update as commits are pushed.