Allow codex resume to resume exec sessions

Resolved 💬 4 comments Opened Mar 13, 2026 by yiteng-guo Closed May 2, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.114.0

What subscription do you have?

API

Which model were you using?

gpt-5.3-codex

What platform is your computer?

linux

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

codex resume doesn't show session that's started by codex exec. I also tried codex resume --all and it's not there either. However, I could run codex exec <session-id> to resume the session where the session id can be found at the top of codex exec.

IMO, we still keep the current behavior for codex exec (i.e. not show exec session) to keep it clean and show exec session in codex resume --all.

What steps can reproduce the bug?

codex exec hello

codex resume --all
# or codex resume

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

4 Comments

edenfunf · 5 months ago

Root Cause Analysis

I traced through the codebase and found the underlying issue.

Where exec sessions are recorded:

In codex-rs/core/src/thread_manager.rs (line 254), codex exec sessions are persisted with session_source: SessionSource::Exec.

Where the resume picker filters:

In codex-rs/core/src/rollout/mod.rs:

pub const INTERACTIVE_SESSION_SOURCES: &[SessionSource] =
    &[SessionSource::Cli, SessionSource::VSCode];

In codex-rs/tui/src/resume_picker.rs, the picker calls RolloutRecorder::list_threads(...) with INTERACTIVE_SESSION_SOURCES hardcoded as the allowed_sources filter. This constant only includes Cli and VSCode — Exec is intentionally excluded.

The show_all flag today only affects the working-directory filter (filter_cwd), not the session-source filter. So even with --all, exec sessions are filtered out at the backend query level before they can ever reach the picker.

Proposed Fix

Add a second constant for the --all case:

// codex-rs/core/src/rollout/mod.rs
pub const INTERACTIVE_SESSION_SOURCES: &[SessionSource] =
    &[SessionSource::Cli, SessionSource::VSCode];

pub const ALL_RESUMABLE_SESSION_SOURCES: &[SessionSource] =
    &[SessionSource::Cli, SessionSource::VSCode, SessionSource::Exec];

Then in resume_picker.rs, pre-compute which sources to use (similar to how filter_cwd is computed) and capture it in the page-loader closure:

let session_sources: &'static [SessionSource] = if show_all {
    ALL_RESUMABLE_SESSION_SOURCES
} else {
    INTERACTIVE_SESSION_SOURCES
};

// ...inside the closure:
let page = RolloutRecorder::list_threads(
    &config,
    PAGE_SIZE,
    request.cursor.as_ref(),
    request.sort_key,
    session_sources,           // <-- was INTERACTIVE_SESSION_SOURCES
    Some(provider_filter.as_slice()),
    request.default_provider.as_str(),
    None,
)

This matches the reporter's suggested UX:

  • codex resume — shows only interactive (Cli/VSCode) sessions, keeping the list clean
  • codex resume --all — additionally shows Exec sessions

The change is minimal and isolated to the session-source filter logic. No schema or config changes needed.

Happy to submit a PR if that would be helpful.

etraut-openai contributor · 5 months ago

The current behavior is by design.

I understand the argument that codex resume should show exec sessions, but the issue is more complex than what's discussed above. This would open up questions about whether exec sessions should be enumerated by the app server via the threads/list api, which would in turn dictate whether exec sessions show up in the IDE Extension, app, and other app server clients. Plus, we're working on moving the TUI on top of the app server.

I've changed this from a bug report to a feature request to see if other users want this as well. If not, we'll probably close it.

yiteng-guo · 5 months ago

Thanks for the context. Agree that it could be annoying to see exec sessions by default. I'd hide this either behind --all or a new flag --include-exec, but yea this is more a feature request.

etraut-openai contributor · 3 months ago

This feature request hasn't received enough upvotes, so I'm closing it.