From 4456a872de2b6f2ff6db9b3dbcfc465d908b1d2e Mon Sep 17 00:00:00 2001 From: Nandan Priyadarshi Date: Sat, 28 Mar 2026 23:56:35 +0800 Subject: [PATCH] fix: [#102] Fix configuration priority order to match documentation The resolve_config_value function was checking ENV before Config, but the README documents the priority as: CLI > Configuration file > Environment variables > Default values This commit reorders the checks to match the documented priority: CLI > Config > ENV > Default --- trae_agent/utils/config.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trae_agent/utils/config.py b/trae_agent/utils/config.py index d9502690..8938d7f2 100644 --- a/trae_agent/utils/config.py +++ b/trae_agent/utils/config.py @@ -397,14 +397,14 @@ def resolve_config_value( config_value: int | str | float | None, env_var: str | None = None, ) -> int | str | float | None: - """Resolve configuration value with priority: CLI > ENV > Config > Default.""" + """Resolve configuration value with priority: CLI > Config > ENV > Default.""" if cli_value is not None: return cli_value - if env_var and os.getenv(env_var): - return os.getenv(env_var) - if config_value is not None: return config_value + if env_var and os.getenv(env_var): + return os.getenv(env_var) + return None