codex resume <session-name> can resolve same-named session from another cwd

Open 💬 0 comments Opened Jul 3, 2026 by Ceasers

What version of Codex CLI is running?

codex-cli 0.142.5

What subscription do you have?

N/A for this report. The issue is in local CLI session selection before a model request is made.

Which model were you using?

N/A.

What platform is your computer?

Microsoft Windows 10.0.19044.7291

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

Not sure.

What issue are you seeing?

codex resume <session-name> appears to resolve a same-named session from another project/cwd instead of first applying the default current-cwd scoping used by nearby resume flows.

Observed shape:

  1. Start in project B.
  2. Run:
codex --dangerously-bypass-approvals-and-sandbox resume MAIN
  1. There is no intended MAIN session for the current project/cwd.
  2. Codex resumes a MAIN session from another project/cwd instead.

This is surprising because the local resume picker and resume --last behavior appear to be cwd-scoped by default, with --all serving as the explicit opt-in for global session selection. Passing an explicit session name seems to bypass that cwd scoping and perform a global name lookup.

What steps can reproduce the bug?

One possible repro shape:

  1. Create or have a saved session named MAIN in project A.
  2. Create or enter a different project B.
  3. Ensure project B does not have the intended saved session named MAIN, or at least that the global name lookup can see a same-named session from project A.
  4. From project B, run:
codex resume MAIN

Current behavior: Codex can resume the MAIN session from project A.

Expected behavior: Codex should first look for a saved session named MAIN in the current cwd/project. If no current-cwd match exists, it should report that no matching session was found for the current cwd and suggest running the picker or using --all/a UUID for global selection.

What is the expected behavior?

For local sessions, name-based resume should preserve the same cwd scoping model as the default resume picker and resume --last:

  • codex resume <name> should prefer or restrict to the current cwd by default.
  • codex resume --all <name> or another explicit global mode should be required to resolve a same-named session from another cwd.
  • If multiple same-named sessions exist, the current-cwd match should win over unrelated cwd matches.
  • If no current-cwd match exists, Codex should avoid silently resuming an unrelated project session.

This would keep --all as the explicit opt-in for global session selection and avoid accidentally entering the wrong project context when users use common session names like MAIN.

Additional information

I searched for existing issues and did not find an exact duplicate for codex resume <session-name> crossing cwd boundaries. Related but different items:

  • #19931 moved local /resume cwd filtering into thread/list, but explicitly listed codex resume <id> as not affected.
  • #21089 fixed fork --last cwd filtering and preserved --all as the explicit global latest-session selection.
  • #20945 reported the corresponding fork --last issue where a command could select a session from another project.
  • #15943 covered name-based resume shadowing/unsaved name entries, but not cwd scoping for same-named sessions across projects.
  • #22037 and #28559 cover cwd-filtered /resume picker/listing behavior, but not explicit name lookup.

A narrow fix direction may be to apply the same cwd filter used by nearby resume flows before resolving name-based local sessions, while preserving UUID lookup precedence and explicit global behavior under --all.

View original on GitHub ↗