OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Fix issue #6940: [Bug]: Incorrect Provider Name on Advanced Setting Toggle

Open openhands-agent opened this issue 10 months ago • 1 comments

This pull request fixes #6940.

The issue has been successfully resolved based on the following concrete changes and their effects:

  1. The core bug was fixed by modifying the handleChangeProvider function to properly map display names to internal provider keys. When "Mistral AI" is selected, it now correctly maps to "mistral" internally through the new lookup logic:
const providerKey = Object.entries(MAP_PROVIDER).find(
  ([_, displayName]) => displayName === provider
)?.[0] || provider;
  1. The changes ensure that the internal state uses the correct provider key ("mistral") while maintaining the display name ("Mistral AI") in the UI, preventing the settings page from incorrectly switching to advanced mode.

  2. The fix was verified with a new test case that specifically checks the Mistral AI provider selection workflow, confirming:

  • Provider selection works correctly
  • Model dropdown becomes enabled
  • Correct Mistral models are available
  1. The implementation addresses both reported issues:
  • Prevents unwanted switching to advanced mode by using correct internal provider keys
  • Fixes the provider name changing to incorrect values by properly maintaining the mapping between display names and internal keys

The changes directly target and resolve the reported behavior problems through proper provider name handling and state management.

Automatic fix generated by OpenHands 🙌


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:38f1b56-nikolaik   --name openhands-app-38f1b56   docker.all-hands.dev/all-hands-ai/openhands:38f1b56

openhands-agent avatar Feb 25 '25 16:02 openhands-agent

@amanape is this still in progress?

mamoodi avatar Mar 10 '25 16:03 mamoodi

Another ping @amanape

mamoodi avatar Mar 24 '25 13:03 mamoodi

Yes, a few other things went up the list though 😢 . I'll try to look into this soon

amanape avatar Mar 24 '25 20:03 amanape

This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 24 '25 02:04 github-actions[bot]

Fixed in #7929

amanape avatar Apr 24 '25 12:04 amanape