@ file selector ignores path prefix instead of listing files relative to the provided path
What version of Codex is running?
<!-- Fill in with codex --version -->
Which Codex surface are you using?
Codex CLI / TUI
What platform is your computer?
<!-- Example: Linux x86_64, Ubuntu 24.04, bash -->
What issue are you seeing?
The @ file selector does not appear to treat path-like input as a path prefix. Instead of listing files relative to the path provided after @, it behaves like a global fuzzy filename search and returns unrelated matches.
Steps to reproduce
- Start Codex in a workspace with nested directories, for example:
``text``
repo/
docs/
api.md
architecture.md
src/
main.rs
config.rs
- In the Codex composer, type:
``text``
@docs
- Observe the selector results.
- Type a more specific path prefix:
``text``
@docs/a
- Observe the selector results.
Expected behavior
The @ selector should list files relative to the path provided.
For example:
@docs
should list files/directories under docs/, such as:
docs/api.md
docs/architecture.md
And:
@docs/a
should list files under docs/ matching the a prefix, such as:
docs/api.md
docs/architecture.md
The selector should distinguish path-like input from global fuzzy search input. Bare input can continue using fuzzy matching, but once the user provides a path prefix, the selector should anchor results to that path.
Actual behavior
The selector returns fuzzy/global filename matches instead of listing files relative to the path typed after @.
This means a path-like selector input such as:
@docs/a
can return unrelated files from elsewhere in the workspace, instead of only files under docs/.
Why this matters
Path-relative selection is important in large codebases. Without it, the @ selector is unpredictable when multiple files have similar names across different directories, and it becomes harder to attach the intended file as context.
Suggested behavior
Use path-aware matching when the input after @ contains path syntax or resolves to a directory/prefix:
@docsshould list files underdocs/whendocsis a directory.@docs/ashould list files underdocs/matchinga.@./docsshould resolve relative to the current Codex working directory.@../docsshould resolve relative to the current Codex working directory.- Bare strings that are not path prefixes can keep the current fuzzy filename search behavior.
Related issues
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗