Skip to content

Conversation

@elianiva
Copy link
Contributor

@elianiva elianiva commented Jun 3, 2025

Related GitHub Issue

Closes: #2577

Description

Previously the model id error displayed is a bit ambiguous since it is placed below the provider selector, making users confused which input is actually needs correction. This PR puts the error message where it is more relevant.

There was also an issue where if you change the provider, the invalid one will still get selected. This PR makes it so that invalid values get reset into empty.

Test Procedure

Added some unit tests and tested it manually.

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

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.
  • Code Quality:
    • My code adheres to the project's style guidelines.
    • There are no new linting errors or warnings (npm run lint).
    • All debug code (e.g., console.log) has been removed.
  • Testing:
    • New and/or updated tests have been added to cover my changes.
    • All tests pass locally (npm test).
    • The application builds successfully with my changes.
  • Branch Hygiene: My branch is up-to-date (rebased) with the main branch.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Changeset: A changeset has been created using npm run changeset if this PR includes user-facing changes or dependency updates.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Before:

87264

After:

35256


Important

Improves error message placement and handling of invalid model selections in model configuration components.

  • Behavior:
    • Moves error message in ModelPicker to be more contextually relevant.
    • Resets invalid model selections to empty when provider changes in ApiOptions.
  • Components:
    • Updates ModelPicker to display error messages below the model selector.
    • Modifies ApiOptions to use validateApiConfigurationExcludingModelErrors() and getModelValidationError().
    • Updates provider components (Glama.tsx, LiteLLM.tsx, OpenAICompatible.tsx, OpenRouter.tsx, Requesty.tsx, Unbound.tsx) to pass modelValidationError to ModelPicker.
  • Tests:
    • Adds tests in ModelPicker.test.tsx for error message display.
    • Adds tests in validate.test.ts for new validation functions.
  • Validation:
    • Adds getModelValidationError() and validateApiConfigurationExcludingModelErrors() in validate.ts to separate model-specific errors from general API configuration errors.

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

@elianiva elianiva requested review from cte and mrubens as code owners June 3, 2025 23:10
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jun 3, 2025
@elianiva elianiva force-pushed the fix/ambiguous-model-id-error branch from 871637c to 056eca6 Compare June 3, 2025 23:31
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 3, 2025
@elianiva
Copy link
Contributor Author

elianiva commented Jun 4, 2025

will fix lint errors in a bit, not in front of computer rn, somehow it didn't catch on earlier on my machine

@elianiva
Copy link
Contributor Author

elianiva commented Jun 4, 2025

brought back glama since #4269 is closed, this PR should be ready to review

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 4, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 5, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Hey @elianiva, Thank you for taking this issue! Sorry that it took so long to review your contribution!

I reviewed your PR and left some questions, I would like to know what you think.

I also tested the implementation and I see that while a default model is selected when I enter a non-existent model, the model I entered is persisted while the default is not:

2025-06-07.09-54-34.mp4

Might be worth taking a look.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Draft / In Progress] in Roo Code Roadmap Jun 7, 2025
@daniel-lxs daniel-lxs marked this pull request as draft June 7, 2025 15:00
@elianiva elianiva force-pushed the fix/ambiguous-model-id-error branch from c8e1dce to 004cb26 Compare June 10, 2025 07:52
@elianiva elianiva force-pushed the fix/ambiguous-model-id-error branch from 89faa67 to 836a519 Compare June 10, 2025 16:51
@elianiva
Copy link
Contributor Author

i've addressed the comments, i ended up removing the (invalid) suffix since it is redundant when we already have the error message, less clutter is better

@elianiva
Copy link
Contributor Author

Just a heads up, I've addressed all the change requests, so this PR should be labeled needs review instead 🙂

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 14, 2025
@daniel-lxs
Copy link
Member

Hey @elianiva, I might be doing something wrong here but the invalid model is not resetting when switching providers.

2025-06-14_14-10-20.mp4

Is this intended?

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 14, 2025
@elianiva
Copy link
Contributor Author

elianiva commented Jun 14, 2025

Hey @elianiva, I might be doing something wrong here but the invalid model is not resetting when switching providers.
2025-06-14_14-10-20.mp4

Is this intended?

Yes, I decided to remove it based on your previous feedback. I thought it was a good idea at first, but then decided to let it be invalid so the users know and then fix it themselves. It's better to have this behaviour rather than implicitly reset the model. That behaviour might leave users questioning "why this model got reset" without further explanation.

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Review] in Roo Code Roadmap Jun 14, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 14, 2025
}
break
>
> = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably pull this out into a constant and strengthen the typing using this: https://github.com/RooCodeInc/Roo-Code/blob/main/packages/types/src/provider-settings.ts#L263

Copy link
Collaborator

@cte cte left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

@cte cte merged commit b8505fe into RooCodeInc:main Jun 17, 2025
25 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 17, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 17, 2025
@elianiva elianiva deleted the fix/ambiguous-model-id-error branch June 18, 2025 03:52
valekseev pushed a commit to valekseev/Roo-Code that referenced this pull request Jun 18, 2025
cte pushed a commit that referenced this pull request Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Settings wouldn't allow a save until I changed the Model (that previously worked) - UI issue

5 participants