π OpenHands: AI-Driven Development
fix: Conversation creation accessing secret without unwrapping (#6335)
Calvin Smithf07ec7a09c73
diff --git a/openhands/runtime/impl/remote/remote_runtime.py b/openhands/runtime/impl/remote/remote_runtime.pyindex 41e1620e29..5494772020 100644--- a/openhands/runtime/impl/remote/remote_runtime.py+++ b/openhands/runtime/impl/remote/remote_runtime.py@@ -60,12 +60,6 @@ class RemoteRuntime(ActionExecutionClient):)self.session.headers.update({'X-API-Key': self.config.sandbox.api_key})- if self.config.workspace_base is not None:- self.log(- 'debug',- 'Setting workspace_base is not supported in the remote runtime.',- )-self.runtime_builder = RemoteRuntimeBuilder(self.config.sandbox.remote_runtime_api_url,self.config.sandbox.api_key,@@ -76,6 +70,12 @@ class RemoteRuntime(ActionExecutionClient):self.available_hosts: dict[str, int] = {}self._runtime_initialized: bool = False+ if self.config.workspace_base is not None:+ self.log(+ 'debug',+ 'Setting workspace_base is not supported in the remote runtime.',+ )+def log(self, level: str, message: str) -> None:message = f'[runtime session_id={self.sid} runtime_id={self.runtime_id or "unknown"}] {message}'getattr(logger, level)(message, stacklevel=2)diff --git a/openhands/server/routes/manage_conversations.py b/openhands/server/routes/manage_conversations.pyindex 767c52b706..3d8c0fe152 100644--- a/openhands/server/routes/manage_conversations.py+++ b/openhands/server/routes/manage_conversations.py@@ -51,7 +51,10 @@ async def _create_new_conversation(session_init_args = {**settings.__dict__, **session_init_args}# We could use litellm.check_valid_key for a more accurate check,# but that would run a tiny inference.- if not settings.llm_api_key or settings.llm_api_key.isspace():+ if (+ not settings.llm_api_key+ or settings.llm_api_key.get_secret_value().isspace()+ ):logger.warn(f'Missing api key for model {settings.llm_model}')raise LLMAuthenticationError('Error authenticating with the LLM provider. Please check your API key'