Made codex exec resume --last consistent with codex resume --last (#9352)

PR #9245 made `codex resume --last` honor cwd, but I forgot to make the
same change for `codex exec resume --last`. This PR fixes the
inconsistency.

This addresses #8700
This commit is contained in:
Eric Traut
2026-01-16 08:53:47 -08:00
committed by GitHub
parent 131590066e
commit 9147df0e60
3 changed files with 97 additions and 4 deletions
+4
View File
@@ -119,6 +119,10 @@ pub struct ResumeArgs {
#[arg(long = "last", default_value_t = false)]
pub last: bool,
/// Show all sessions (disables cwd filtering).
#[arg(long = "all", default_value_t = false)]
pub all: bool,
/// Optional image(s) to attach to the prompt sent after resuming.
#[arg(
long = "image",
+8 -4
View File
@@ -507,17 +507,21 @@ async fn resolve_resume_path(
) -> anyhow::Result<Option<PathBuf>> {
if args.last {
let default_provider_filter = vec![config.model_provider_id.clone()];
match codex_core::RolloutRecorder::list_threads(
let filter_cwd = if args.all {
None
} else {
Some(config.cwd.as_path())
};
match codex_core::RolloutRecorder::find_latest_thread_path(
&config.codex_home,
1,
None,
&[],
Some(default_provider_filter.as_slice()),
&config.model_provider_id,
filter_cwd,
)
.await
{
Ok(page) => Ok(page.items.first().map(|it| it.path.clone())),
Ok(path) => Ok(path),
Err(e) => {
error!("Error listing threads: {e}");
Ok(None)