openai / openai/codex

[WSL] Resumed sessions get a lowercased /mnt cwd from the state DB, breaking project trust and approval matching

Open
#38,591 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI session windows-os
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

0.147.0

What subscription do you have?

plus

Which model were you using?

No response

What platform is your computer?

No response

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

No response

Codex doctor report

What issue are you seeing?

On WSL2, when a project lives on a Windows drive mounted under /mnt/<drive> and the path contains mixed-case components, every resumed session restores an all-lowercased cwd. For example, the original cwd /mnt/m/2026/TesT becomes /mnt/m/2026/test after resume.

This is not just cosmetic — it breaks permission management:

  1. Project trust is lost. ~/.codex/config.toml stores trusted projects keyed by the original-case path ([projects."/mnt/m/2026/TesT"] trust_level = "trusted"), but the resumed session's cwd is lowercase test, so the trust lookup misses. The trust screen is shown again and project-local config / hooks / exec policies are treated as untrusted.
  2. Commands require approval every time. Path-based access checks compare against workspace roots / recorded paths that still carry the original casing, so they no longer match. Commands that previously ran without prompting now ask for approval — even though on the drvfs mount test and TesT resolve to the same directory.
Image Image
What steps can reproduce the bug?
  1. On WSL2 create a mixed-case dir on a Windows drive: mkdir -p /mnt/<drive>/path/TesT && cd /mnt/<drive>/path/TesT
  2. Start codex, send any message, and trust the project when prompted (writes the original-case key into config.toml). Let a command get approved/run.
  3. /new in the same window.
  4. Exit, then resume the session (codex resume or /resume).
What is the expected behavior?

No response

Additional information

I successfully fixed this issue at https://github.com/scmmm/codex/tree/fix/wsl-resume-cwd-case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how resumed sessions load the cwd from the state DB and compare it with the original-case project key in ~/.codex/config.toml. Reproduce the mixed-case WSL2 path scenario, then verify that resuming preserves the cwd casing and continues matching project trust and approval paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.