From 89c071baf6fcf74c38fa9a4b80ff9d46d2a83723 Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Thu, 5 Feb 2026 13:05:48 +1100 Subject: [PATCH] fix: honor --resume flag when used with --agent --chat The --resume flag was being ignored when --agent and --chat flags were used together. The if-else chain checked for chat mode first and immediately returned None, skipping the --resume check entirely. Reordered the logic to check flags.resume first, ensuring explicit --resume is always honored regardless of other flags. Fixes: --resume not working with --agent --chat --- crates/g3-cli/src/agent_mode.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/g3-cli/src/agent_mode.rs b/crates/g3-cli/src/agent_mode.rs index 0efa7ef..ec4b04f 100644 --- a/crates/g3-cli/src/agent_mode.rs +++ b/crates/g3-cli/src/agent_mode.rs @@ -41,10 +41,9 @@ pub async fn run_agent_mode( std::env::set_current_dir(&workspace_dir)?; // Check for incomplete agent sessions before starting a new one - // Skip session resume entirely when in chat mode (--agent --chat) - let resuming_session = if chat { - None // Chat mode always starts fresh - } else if let Some(ref session_id) = flags.resume { + // When --resume is explicitly provided, always honor it (even in chat mode) + // Otherwise, chat mode starts fresh (no auto-resume of incomplete sessions) + let resuming_session = if let Some(ref session_id) = flags.resume { // Explicit --resume flag takes precedence match g3_core::load_continuation_by_id(session_id) { Ok(continuation) => { @@ -63,6 +62,9 @@ pub async fn run_agent_mode( std::process::exit(1); } } + } else if chat { + // Chat mode without explicit --resume starts fresh (no auto-resume) + None } else if flags.new_session { if !chat { output.print("\nšŸ†• Starting new session (--new-session flag set)");