When I `resume` a session that was previously started with `--cd`; it should respect that original directory (or at least prompt me to confirm which I want)

Resolved 💬 3 comments Opened Oct 4, 2025 by 0xdevalias Closed Nov 25, 2025

What version of Codex is running?

codex-cli 0.42.0

Which model were you using?

N/A

What platform is your computer?

Darwin 23.6.0 x86_64 i386

What steps can reproduce the bug?

Start a new session using --cd:

codex --cd /foo/bar/baz

Do some things in the session then close, it; noticing the suggested resume command:

..snip..

Token usage: total=2,602 input=2,094 (+ 17,408 cached) output=508 (reasoning 256)
To continue this session, run codex resume 0199a9d9-f5f2-7691-8920-cfdb4384ab3e.

Run codex resume and notice that the directory is set to your current working directory, and not the directory you originally --cd'd to in that session.

What is the expected behavior?

If the session was previously run in a directory other than my current working directory, when I resume a session, it would be nice if codex noticed this, and asked me if I wanted to use the old directory or my CWD.

If I explicitly pass --cd while resume'ing a session then it might be fine to assume I know what I am doing and bypass this confirmation step; but sometimes maybe it would still be useful even then (perhaps that could be a config option?)

As a minimal partial workaround in the meantime, I wonder if that 'onClose' message about resume could include a --cd with the directory it was running in as well.

So instead of:

To continue this session, run codex resume 0199a9d9-f5f2-7691-8920-cfdb4384ab3e.

It would be:

To continue this session, run codex resume --cd /foo/bar/baz 0199a9d9-f5f2-7691-8920-cfdb4384ab3e.

What do you see instead?

The existing working directory of the resume'd session is ignored, and the current working directory is used.

Additional information

N/A

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗