π OpenHands: AI-Driven Development
Now printing a warning message when a config has an unknown key (#3428)
tofarrb2221f135f36
diff --git a/opendevin/core/config.py b/opendevin/core/config.pyindex f5d15c4848..69b482fdd9 100644--- a/opendevin/core/config.py+++ b/opendevin/core/config.py@@ -514,7 +514,7 @@ def load_from_toml(cfg: AppConfig, toml_file: str = 'config.toml'):)agent_config = AgentConfig(**nested_value)cfg.set_agent_config(agent_config, nested_key)- if key is not None and key.lower() == 'llm':+ elif key is not None and key.lower() == 'llm':logger.opendevin_logger.info('Attempt to load default LLM config from config toml')@@ -530,11 +530,17 @@ def load_from_toml(cfg: AppConfig, toml_file: str = 'config.toml'):)llm_config = LLMConfig(**nested_value)cfg.set_llm_config(llm_config, nested_key)+ elif not key.startswith('sandbox') and key.lower() != 'core':+ logger.opendevin_logger.warning(+ f'Unknown key in {toml_file}: "{key}"'+ )except (TypeError, KeyError) as e:logger.opendevin_logger.warning(f'Cannot parse config from toml, toml values have not been applied.\n Error: {e}',exc_info=False,)+ else:+ logger.opendevin_logger.warning(f'Unknown key in {toml_file}: "{key}')try:# set sandbox config from the toml filediff --git a/opendevin/core/utils/singleton.py b/opendevin/core/utils/singleton.pyindex 0be62f761e..7cf25ad62f 100644--- a/opendevin/core/utils/singleton.py+++ b/opendevin/core/utils/singleton.py@@ -1,5 +1,5 @@import dataclasses-+from opendevin.core import loggerclass Singleton(type):_instances: dict = {}@@ -13,7 +13,10 @@ class Singleton(type):# useful for pre-defined groups of settingsinstance = cls._instances[cls]for key, value in kwargs.items():- setattr(instance, key, value)+ if hasattr(instance, key):+ setattr(instance, key, value)+ else:+ logger.opendevin_logger.warning(f'Unknown key for {cls.__name__}: "{key}"')return cls._instances[cls]@classmethod