From 2cb57e6b2db41a22a87b7c4f2440e28123eb93a5 Mon Sep 17 00:00:00 2001 From: "Darren.Zeng" Date: Thu, 12 Mar 2026 12:34:32 +0800 Subject: [PATCH] fix(cli): honor config default_temperature in agent command (#3106) * fix(cli): honor config default_temperature in agent command Fixes #3033 The agent command was using a hardcoded default_value of 0.7 for the --temperature parameter, which ignored the default_temperature setting in the config file. Changes: - Changed temperature from f64 to Option - Removed hardcoded default_value - Use config.default_temperature when --temperature is not provided Users can now set default_temperature in config.toml and have it honored when running 'zeroclaw agent' without --temperature. Risk: low (behavior change: now honors config instead of hardcoded value) * fix: resolve moved value error for config in agent command Extract final_temperature before passing config to agent::run() to avoid use-of-moved-value error (config is moved as the first argument while config.default_temperature was being accessed in the same call). Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: argenis de la rosa Co-authored-by: Claude Opus 4.6 --- src/main.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index bd703c2cf..80a74f8e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -188,7 +188,7 @@ Examples: #[arg(long)] model: Option, - /// Temperature override (0.0 - 2.0). Defaults to config.default_temperature when omitted. + /// Temperature (0.0 - 2.0, defaults to config default_temperature) #[arg(short, long, value_parser = parse_temperature)] temperature: Option, @@ -819,10 +819,6 @@ async fn main() -> Result<()> { temperature, peripheral, } => { - // Implement temperature fallback logic: - // 1. Use --temperature if provided - // 2. Use config.default_temperature if --temperature not provided - // 3. Use hardcoded 0.7 if config.default_temperature not set (from Config::default()) let final_temperature = temperature.unwrap_or(config.default_temperature); agent::run(