Autocomplete after '@' drops '@' when pressing Tab
Resolved 💬 10 comments Opened Aug 27, 2025 by mkusaka Closed Dec 25, 2025
💡 Likely answer: A maintainer (seratch, member)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.25.0
Which model were you using?
gpt-5
What platform is your computer?
Darwin 24.5.0 arm64 arm
What steps can reproduce the bug?
- Type
@and start entering a filename (for example, type@REAintending to insert@README.md). - When the filename appears in the completion suggestions, press Tab to accept it.
- The completion inserts
README.mdwithout the@prefix.
What is the expected behavior?
The completion should preserve the @ prefix and insert @README.md.
What do you see instead?
The completion removes the @ prefix and inserts README.md.
Additional information
_No response_
10 Comments
Codex should usually recognize files with
@when sending the prompt. What challenges did you observe without@for files?@seratch, thank you for your comment.
I understand that the
@filenameformat is how Codex recognizes files, and that's exactly what I want to use.The issue I'm reporting is that when I type
@followed by a file path and press Tab for completion, the@gets removed:I'm starting my input with
@because I want to use that notation, but the completion removes it, forcing me to manually re-add the@every time.Yep. Preserving the
@prefix after accepting a suggestion ensures you can continue modifying the path without having to jump back to the beginning and manually reinsert the@. This makes editing smoother.I’ve opened a quick PR to address this: Fix: Preserve
@prefix in file path autocomplete #2839I can see where having the
@is helpful to edit an existing path.Though I don't know if the
@is helpful for the model: it feels more likely to confuse it.Perhaps a better solution would be to annotate this internally so the composer "knows" the string was autocompleted and restarts the autocomplete logic when you start editing that text again, though admittedly that makes bookkeeping complex.
@easong-openai what do you think here?
"@filename" ideally would explicitly tell the model that the file is available via read tool, maybe even proactively tell the file size and number of lines.
The use of
@should be documented!@newptcai If you use the
/mentioncommand, it basically just inserts the@, so it's somewhat discoverable that way:https://github.com/openai/codex/blob/3f8184034f12e2c03013273505259999acd03423/codex-rs/tui/src/chatwidget.rs#L820-L822
Can it be fixed? or what is the proper way to tag files?
@etraut-openai correct me if I'm wrong but there is no way to tag a file right now and have the agent immediately read it? There is a
/mentioncommand but this just inserts a@character. From what I understand the@character only enables autocomplete but it does not read the file into the agent's context when used.If this is correct then @mkusaka should probably rename the issue.
i kind of want this behaviour is there any plans on fixing this awkward dropping of the "@" everytime i press tab??