Fix: Prevent Search API Key from resetting when saving other settings#12243
Merged
amanape merged 10 commits intoOpenHands:mainfrom Jan 8, 2026
Merged
Fix: Prevent Search API Key from resetting when saving other settings#12243amanape merged 10 commits intoOpenHands:mainfrom
amanape merged 10 commits intoOpenHands:mainfrom
Conversation
malhotra5
previously requested changes
Jan 2, 2026
Collaborator
malhotra5
left a comment
There was a problem hiding this comment.
Thank you for the contribution! It would be great if we can add a unit test that replicates this bug and is then passing from the code changes
Contributor
Author
|
Thanks for the review! I'm working on adding a unit test for this case right now. |
…-20/OpenHands into fix/settings-api-key-reset
Contributor
Author
|
@malhotra5 I have updated the PR with the following changes: Unit Testing: I added a comprehensive unit test (tests/unit/server/routes/test_settings_api.py) that successfully reproduces the original issue and verifies the fix. Code Quality: I have resolved all linting and formatting issues to ensure compliance with the project's style guidelines. All CI checks are now passing. This pull request is ready for your final review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of PR
This PR fixes a bug where the
search_api_keywould be unintentionally deleted (reset to an empty string) when a user saved other settings (like the LLM model) without re-entering the key.The issue occurred because the backend only checked if the key was
None, but the frontend sends an empty string""for unmodified password fields. I updated the logic to ensure that bothNoneand empty strings are ignored, preserving the existing key in the database.Change Type
Checklist
Fixes
Resolves #9497
Release Notes
Description: Fixed a bug where the Search API Key was getting reset when saving other settings.