Codex CLI emits unescaped paths; zsh globbing breaks on `()`/`[]`

Resolved 💬 5 comments Opened Dec 13, 2025 by PaulRBerg Closed Mar 29, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.72.0 (Homebrew)

What subscription do you have?

Which model were you using?

N/A (shell command generation issue, affects all models)

What platform is your computer?

macOS Tahoe v26.1

What issue are you seeing?

Codex emits unquoted paths containing glob metacharacters ((), [], *, ?). zsh interprets these as glob patterns and fails:

sed -n '1,220p' portal/app/(home)/_ui/ActivityList.tsx
# zsh:1: no matches found: portal/app/(home)/_ui/ActivityList.tsx

What steps can reproduce the bug?

  1. Have a file with parentheses in path (e.g., Next.js route group): app/(home)/page.tsx
  2. Let Codex try to read it
  3. zsh fails on the unquoted glob pattern

What is the expected behavior?

Paths should be quoted or escaped:

sed -n '1,220p' 'portal/app/(home)/_ui/ActivityList.tsx'

Additional information

Impact: Breaks Next.js App Router projects (route groups use (), dynamic routes use []).

Fix: Either shell-escape paths or avoid shell execution for file reads (use argv arrays instead).

Workarounds: Add AGENTS.md rule to quote paths, or change zsh config—neither acceptable as default UX.

View original on GitHub ↗

5 Comments

etraut-openai contributor · 8 months ago

Please use the /feedback slash command to upload a session where you see this occurring and post the thread ID here. We'll need to determine whether this is the codex harness or model behavior.

PaulRBerg · 8 months ago

Thread ID 019b17d5-6eca-7b62-9abd-5e32016b9201

titouv · 8 months ago

I get the exact same issue, so +1 on this one. It's happening every time on my side since most of my files are inside Next.js group folders, and it seems to make the Codex CLI workflow way slower because it requires a new roundtrip for every file read. I suspect I affects a lot of users of Codex because of the popularity of NextJS.

I've used the feedback as you asked, thread id is the following 019b46c0-7baf-7050-bd71-fd369f7716b9

<img width="873" height="236" alt="Image" src="https://github.com/user-attachments/assets/55b19b7a-38a6-4599-8e2d-07a92722358e" />

PaulRBerg · 8 months ago
I suspect I affects a lot of users of Codex because of the popularity of NextJS.

Indeed. And the majority of users don't notice the issue/performance hit because it's subtle and Codex proceeds anyway.

etraut-openai contributor · 5 months ago

This bug report hasn't received any upvotes or additional posts in three months. Closing.