openai / openai/codex

Codex Desktop: false terminal workspace-mismatch warning for equivalent paths ending in `/.`

Open
#42,335 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

After running a Local Environment Build action in a Codex-managed worktree, the integrated terminal displayed:

This terminal's workspace does not match this chat's current worktree

The action's displayed command entered the intended worktree using a trailing /., and the build succeeded there. Inspecting the installed app separately confirmed that its workspace comparison treats <worktree> and <worktree>/. as different paths, causing the warning predicate to return true for those equivalent directories.

Both pwd -P and git rev-parse --show-toplevel confirm that the affected terminal is in the task’s expected worktree. Codex’s internal terminal binding has not been captured, so the independently reproduced /. comparison defect remains a suspected—not confirmed—cause of this warning.

Environment

  • Codex desktop experience in ChatGPT for macOS: 26.831.21537, build 7579
  • macOS 27.0, Apple Silicon (arm64)
  • Terminal shell: zsh
  • Observed: September 2, 2026

Observed workflow

  1. Create a task in Worktree mode with a selected Local Environment.

  2. Let its setup script complete successfully.

  3. Run its configured Build action:

    [[actions]]
    name = "Build"
    icon = "run"
    command = "mise run --skip-tools codex-action -- build"
    
  4. The terminal displays a command in this form:

    cd "<worktree>/." && mise run --skip-tools codex-action -- build
    
  5. The TypeScript/esbuild build succeeds, but the workspace-mismatch warning appears.

The build output existed in the intended worktree, and git status --porcelain remained clean. The Local Environment TOML in this setup is a private sidecar file linked into .codex/environments/; this has not yet been repeated with a plain, tracked environment file.

Isolated comparison reproduction

I extracted and evaluated the installed bundle's actual pure path-comparison helpers and warning predicate in an isolated Node VM. With matching host IDs, no dismissed target, and both the current target and workspace-roots list set to <worktree>, the results were:

Terminal binding's workspace root Same directory via fs.realpathSync App considers paths equal Warning predicate
<worktree> Yes Yes False
<worktree>/ Yes Yes False
<worktree>/. Yes No True

In this build, webview/assets/terminal-workspace-warning-state-51edff1f7aae.js uses a path comparator from app-initial-b09f80199db1.js. Its normalization removes trailing slashes but does not remove the redundant trailing /..

This is a unit-level reproduction using the installed implementation, not a clean end-to-end UI reproduction.

Expected behavior / possible fix

Equivalent workspace roots should not produce a mismatch warning. Normalize redundant trailing /. consistently when binding or comparing terminal workspace roots.

Regression coverage should accept <worktree>, <worktree>/, and <worktree>/. as equivalent while preserving warnings for genuinely different worktrees or hosts.

Related

Issue #15448 reports another workspace path-equivalence problem involving symlinks and thread visibility. It has a different symptom and is not a confirmed duplicate.

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 examining webview/assets/terminal-workspace-warning-state-51edff1f7aae.js and the path-comparison helper in app-initial-b09f80199db1.js. Re-run the isolated Node VM comparison with , /, and /. before tracing the terminal binding and warning predicate. Done means equivalent roots no longer warn while different worktrees or hosts still do, with regression coverage for all three forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.