fix: handle missing resume session id gracefully (#5329)
Exit when a requested resume session is missing after restoring the terminal and print a helpful message instructing users how to resume existing sessions. Partially addresses #5247.
This commit is contained in:
committed by
GitHub
parent
a182c1315c
commit
11c019d6c5
@@ -437,7 +437,20 @@ async fn run_ratatui_app(
|
|||||||
Some(path) => resume_picker::ResumeSelection::Resume(path),
|
Some(path) => resume_picker::ResumeSelection::Resume(path),
|
||||||
None => {
|
None => {
|
||||||
error!("Error finding conversation path: {id_str}");
|
error!("Error finding conversation path: {id_str}");
|
||||||
resume_picker::ResumeSelection::StartFresh
|
restore();
|
||||||
|
session_log::log_session_end();
|
||||||
|
let _ = tui.terminal.clear();
|
||||||
|
if let Err(err) = writeln!(
|
||||||
|
std::io::stdout(),
|
||||||
|
"No saved session found with ID {id_str}. Run `codex resume` without an ID to choose from existing sessions."
|
||||||
|
) {
|
||||||
|
error!("Failed to write resume error message: {err}");
|
||||||
|
}
|
||||||
|
return Ok(AppExitInfo {
|
||||||
|
token_usage: codex_core::protocol::TokenUsage::default(),
|
||||||
|
conversation_id: None,
|
||||||
|
update_action: None,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if cli.resume_last {
|
} else if cli.resume_last {
|
||||||
|
|||||||
Reference in New Issue
Block a user