v0.131 regression: codex starts in the wrong folder
Resolved 💬 14 comments Opened May 18, 2026 by howardjohn Closed May 21, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
v0.131.0
What subscription do you have?
Pro
Which model were you using?
gpt-5.5
What platform is your computer?
Linux
What terminal emulator and version are you using (if applicable)?
_No response_
Codex doctor report
What issue are you seeing?
I have a folder structure like
repo/
some-folder/
.worktrees/some-branch1/some-folder
.worktrees/some-branch2/some-folder
Before v0.131: I open codex in repo/.worktrees/some-branch1 folder. It runs in repo/.worktrees/some-branch1
After: v0.131: I open codex in repo/.worktrees/some-branch1 folder. It runs in repo/ silently ignoring my current directory. I run commands against the wrong branch and chaos ensues.
What steps can reproduce the bug?
See above
What is the expected behavior?
As a user I expect codex to run in the folder I told it to run from
Additional information
_No response_
14 Comments
Walking the v0.130 → v0.131 cwd flow to help triage this.
The cwd path is intact on paper
The default-cwd plumbing (no
--cdpassed) is:--cdisNone—shared_options.rs:61.ConfigOverrides { cwd: shared.cwd, ... }—cli/src/main.rs:1699.ConfigBuilderresolvescwd_override.unwrap_or(env::current_dir())—config/mod.rs:1094-1099, finalresolved_cwdatconfig/mod.rs:2536-2553(normalize_for_native_workdiris a no-op on Linux perpath-utils/src/lib.rs:139-145).config.cwd = resolved_cwd—config/mod.rs:3360.session_configuration.cwd = config.cwd.clone()—session/mod.rs:624.SessionConfiguredEvent.cwd = session_configuration.cwd.clone()—session/session.rs:996.self.current_cwd = Some(session.cwd.to_path_buf()); self.config.cwd = session.cwd.clone();—chatwidget/session_flow.rs:34-35.Nothing in that chain reassigns
cwdto the main-repo root, so on a clean fresh-session invocation the reported symptom shouldn't be possible byenv::current_dir()alone.Two likely culprits introduced in the v0.130→v0.131 window
a. Worktree-aware project-layer loader (#21969,
934a40c7d9). Addsfind_git_checkout_root(loader/mod.rs:1094-1109) and routes project-hook config through the main-repo.codex/. The PR is hook-scoped by design, but it changes which.codex/folder backs the project layer for linked worktrees — if any later code derives an "effective directory" from the project-layer source path instead ofconfig.cwd, that's where the worktree path would be lost.b. Workspace-roots-in-profiles series (#22610, #22611, #22612, #22624). v0.131 surfaces
effective_workspace_roots()in several user-visible places (status line, exec summaries). If the active permission profile resolves:workspace_rootssymbolically and the resulting first root is the canonicalized main-repo root (viaresolve_root_git_project_for_trust, which deliberately walks worktrees back to the main repo), the user could perceive Codex as "running inrepo/" even whenconfig.cwditself is correct — depending on which surface they read it from.Note
resolve_root_git_project_for_trustwas designed to return the main repo root from inside a worktree — that's correct for trust lookups, but anywhere it's used to derive an operating directory would produce exactly this symptom.Questions for @howardjohn that would localize this fast
codex doctor(from insiderepo/.worktrees/some-branch1) reportcwd:as the worktree path or the main-repo path?repo/" — the status-line/header text, the agent's actual shell-toolpwd, or files the agent reads/writes? Each surface goes through a different code path.--cd $PWDon the v0.131 invocation make the symptom go away? If yes → theenv::current_dir()→resolved_cwdpath is fine and the regression is downstream; if no → the regression sits in something that overridescwdafterConfigBuilder..codex/folder, and is there a.codex/atrepo/? Different combinations exercise different branches ofload_project_layers.Offer
Happy to drive a bisect across
rust-v0.130.0..rust-v0.131.0against a reproduction fixture and submit a PR if a maintainer would like to invite one.I have read the CLA Document and I hereby sign the CLA
I’ve run into similar tonight, running 0.131.0 and launching codex from ~/projects/some-project is loading codex cli with cwd set to
~shown in the status line and evidenced by gpt-5.5 having no idea what I’m talking about and acting from the root dir of my account.I’m suspect of some kind of conflict between Codex App running on same MBP maybe starting an app-server instance or something that is getting inherited. Haven’t dug deeper yet, but definitely nothing weird in my toml and it’s definitely since upgrading to 0.131.0
Edit: Reverting the codex cli binary back to 0.130.0 solves the problem, this only changes the version i run with the codex terminal command, bundled binary in the Codex App on my mac remains 0.131.0-alpha.9
Same here. can't believe such a serious problem appeared in the prod version. My session history is in chaos. Didn't you test it?
Same issue here, in really bad shape. Using --cd $PWD is the only way to get it started where I expect, but when I use the "implement plan in new session" coming out of plan mode, the new session just lands me in random cwd's then chaos ensues.
Interestingly this cwd issue is related to another post-0.131 bug: my skill picker suddenly shows "no available skills" despite the skills themselves being present in the prompt as expected. Somehow using --cd $PWD fixed this skill picker issue. Hopefully this helps your investigation.
I restarted my macbook pro and then re-upgraded again to 0.131.0 (I had rolled back to 0.130.0) and the directory issue has gone away. I suspect an older versioned
codex app-serverorcodex remote-controlprocess was being detected and used when launching the updated 0.131.0 version... pure speculation, but curious if it fixes it for anyone else? Or perhaps closing Codex App and or killing other codex processes to zero running and then try launching 0.131.0 CLI?Possibly related, I have a session that started in dir1 that I've been using from dir2 with resume. When I resume now it doesn't give me the picker to run in the alternate dir2 (cwd), it uses dir1. Then I get
Failed to read thread goal: thread/goal/get failed in TUIwhen trying to start a goal. v0.131.0 CLI on Linux.All my CLI sessions' cwd becomes
~/. It's horrible.It seems that the cwd will be wrong once there's a live app server. And the issue exists whether the app server is started by App or by hand.
Another issue I realize is: the root dir is not trusted, but the cli can still choose it as working dir and start the session.
Looking up and killing all
codexprocesses through macOS Activity Monitor fixed it for meSeems that #23538 fixed the issue. But why doesn't 132 have it? Isn't this a serious issue?
This issue also causes the bubblewrap warning
Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager.if thebwrapis installed under user home directory. Because this line ignores thebwrapinstalled in the cwd or the subdirectory of the cwd which is user home directory.I had this issue when updating from v0.130 to v0.132, killing the existing
codex app-serverprocess seems to have fixed it (at least for now).This will be fixed in the next release.
This is a bug, yes, it has been fixed, but isn't there any compensation?
After all, everyone pays for it.
@tibo-openai