You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When handing off to an existing wortree the task CWD does not change #47394
What version of the Codex App are you using (From “About Codex” dialog)?
26.917.51856
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.5.0 arm64 arm
What issue are you seeing?
After creating a local task in the MacOS app, I'm trying to hand-off to an existing worktree. That succeeds but the CWD of the task does not change to the worktree root.
This is very frustrating when trying to continue existing worktree work in a new chat for context management purposes. With the CLI this is not an issue since one can start the session from the workree directory but there is no comparable mechanism in the desktop client which is otherwise excellent.
What steps can reproduce the bug?
Create a worktree (either managed from a previous Codex task chat OR separately with git worktree add
Start a local new task chat in the project
Select "Move to a worktree" action
Codex shows your previously created worktree. Select it and click Handoff
Observed behavior:
The chat task moves to the new worktree as expected
BUT the working directory of the chat DOES not move to the worktree.
What is the expected behavior?
The chat task moves to the new worktree
AND the working directory of the chat ALSO MOVES to the worktree.
Additional information
Interestingly enough launch a terminal session from this chat does lauch the terminal session in the correct worktree.
I found a lower-level behavior that may help narrow this down. This is an app-server test on Linux/WSL2 with the official Codex CLI 0.156.1 binary, not a reproduction of the macOS Handoff UI.
Using a disposable repo A and an existing linked worktree B:
Start a thread in A and run a read-only thread/shellCommand to record pwd and Git identity.
Keep that thread loaded and subscribed in the same client connection, with no active turn.
Call thread/resume with the same thread ID and cwd: B.
The response cwd and thread.cwd both remain A. Another thread/shellCommand, with no directory override, also runs in A.
Restart only the app-server process and resume the same persisted thread with cwd: B: both the response and actual shell execution now use B.
This appears consistent with the handling in resume_running_thread:
When the requested resume overrides differ from the loaded thread config, the implementation can keep the existing loaded thread if a subscriber is still attached, and logs:
thread/resume overrides ignored for loaded thread
So at least at the app-server level, a cwd override can be ignored for an already-loaded subscribed thread, while the same persisted thread accepts the new cwd after the app-server is restarted and cold-resumed.
Does Desktop Handoff update the live thread's execution environment through a separate path, or does it eventually rely on this resume path?
If it uses thread/resume, checking the returned cwd / thread.cwd before updating the task UI may help detect this mismatch.
I haven't verified which path the desktop app uses.
Activity
ekusiadadus commentedon Sep 24, 2026
I found a lower-level behavior that may help narrow this down. This is an app-server test on Linux/WSL2 with the official Codex CLI 0.156.1 binary, not a reproduction of the macOS Handoff UI.
Using a disposable repo A and an existing linked worktree B:
thread/shellCommandto recordpwdand Git identity.thread/resumewith the same thread ID andcwd: B.cwdandthread.cwdboth remain A. Anotherthread/shellCommand, with no directory override, also runs in A.cwd: B: both the response and actual shell execution now use B.This appears consistent with the handling in
resume_running_thread:https://github.com/openai/codex/blob/rust-v0.156.1/codex-rs/app-server/src/request_processors/thread_processor.rs#L4085-L4132
When the requested resume overrides differ from the loaded thread config, the implementation can keep the existing loaded thread if a subscriber is still attached, and logs:
thread/resume overrides ignored for loaded threadSo at least at the app-server level, a
cwdoverride can be ignored for an already-loaded subscribed thread, while the same persisted thread accepts the newcwdafter the app-server is restarted and cold-resumed.Does Desktop Handoff update the live thread's execution environment through a separate path, or does it eventually rely on this resume path?
If it uses
thread/resume, checking the returnedcwd/thread.cwdbefore updating the task UI may help detect this mismatch.I haven't verified which path the desktop app uses.