Fix: TUI starting in wrong CWD (#23538)

This fixes a regression wher codex could start in the wrong directory
when a live local app-server socket was present. The issue was that
implicit local socket reuse was being treated like an explicit remote
workspace session, which dropped the invoking cwd unless --cd was
passed.

The change separates local socket transport from true remote workspace
semantics.
- Plain local startup keeps local cwd, trust, resume, picker, and
config-refresh behavior.
- Explicit --remote keeps the existing remote cwd behavior.
- Added coverage for launch target selection and local-session
filtering/cwd behavior.

Steps to test:
- Start a local app-server from a different directory than the repo you
want to use.
  - Launch codex from a project/worktree without --cd.
- Confirm the session starts in the invoking directory, not the
app-server process directory.
- Confirm explicit codex --remote ... still preserves existing remote
behavior.
This commit is contained in:
canvrno-oai authored and GitHub committed 2026-05-19 15:48:40 -07:00
1 parent d86352d520
commit 27c4c67b15
8 files changed
+343 -91

No files matched your search

+1 -1
View File
@@ -633,7 +633,7 @@ impl App {
}
let current_cwd = self.config.cwd.to_path_buf();
let resume_cwd = if self.remote_app_server_endpoint.is_some() {
let resume_cwd = if self.app_server_target.uses_remote_workspace() {
current_cwd.clone()
} else {
match crate::session_resume::resolve_cwd_for_resume_or_fork(