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
This commit is contained in:
@@ -41,10 +41,9 @@ pub async fn run_agent_mode(
|
|||||||
std::env::set_current_dir(&workspace_dir)?;
|
std::env::set_current_dir(&workspace_dir)?;
|
||||||
|
|
||||||
// Check for incomplete agent sessions before starting a new one
|
// Check for incomplete agent sessions before starting a new one
|
||||||
// Skip session resume entirely when in chat mode (--agent --chat)
|
// When --resume is explicitly provided, always honor it (even in chat mode)
|
||||||
let resuming_session = if chat {
|
// Otherwise, chat mode starts fresh (no auto-resume of incomplete sessions)
|
||||||
None // Chat mode always starts fresh
|
let resuming_session = if let Some(ref session_id) = flags.resume {
|
||||||
} else if let Some(ref session_id) = flags.resume {
|
|
||||||
// Explicit --resume flag takes precedence
|
// Explicit --resume flag takes precedence
|
||||||
match g3_core::load_continuation_by_id(session_id) {
|
match g3_core::load_continuation_by_id(session_id) {
|
||||||
Ok(continuation) => {
|
Ok(continuation) => {
|
||||||
@@ -63,6 +62,9 @@ pub async fn run_agent_mode(
|
|||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if chat {
|
||||||
|
// Chat mode without explicit --resume starts fresh (no auto-resume)
|
||||||
|
None
|
||||||
} else if flags.new_session {
|
} else if flags.new_session {
|
||||||
if !chat {
|
if !chat {
|
||||||
output.print("\n🆕 Starting new session (--new-session flag set)");
|
output.print("\n🆕 Starting new session (--new-session flag set)");
|
||||||
|
|||||||
Reference in New Issue
Block a user