From c4c4dfa4cb8fd31187bc5eb5e334a4e4f464a5a7 Mon Sep 17 00:00:00 2001 From: jalateras Date: Fri, 12 Sep 2025 14:10:32 +1000 Subject: [PATCH] fix: return non-zero exit code when CLI session ends with error When a session fails due to an error (e.g., invalid temperature parameter), the CLI now exits with code 1 instead of 0. This allows scripts and automation tools to properly detect when goose encounters an error. Previously, the error was only printed to stderr but the process would exit successfully with code 0, making it impossible to detect failures in automated environments. Fixes #4612 Signed-off-by: jalateras --- crates/goose-cli/src/cli.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/goose-cli/src/cli.rs b/crates/goose-cli/src/cli.rs index 477d52ddebb9..cf29fd980327 100644 --- a/crates/goose-cli/src/cli.rs +++ b/crates/goose-cli/src/cli.rs @@ -1196,6 +1196,7 @@ pub async fn cli() -> Result<()> { .await; if let Err(e) = session.interactive(None).await { eprintln!("Session ended with error: {}", e); + std::process::exit(1); } Ok(()) };