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?

  1. Type @ and start entering a filename (for example, type @REA intending to insert @README.md).
  2. When the filename appears in the completion suggestions, press Tab to accept it.
  3. The completion inserts README.md without 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_

View original on GitHub ↗

10 Comments

seratch member · 10 months ago

Codex should usually recognize files with @ when sending the prompt. What challenges did you observe without @ for files?

mkusaka contributor · 10 months ago

@seratch, thank you for your comment.

I understand that the @filename format 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:

# Input
$ codex "@READ[Tab]

# Current behavior (bug)
$ codex "README.md"     # @ is removed

# Expected behavior
$ codex "@README.md"    # @ should be preserved

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.

oyiakoumis contributor · 10 months ago

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 #2839

bolinfest collaborator · 10 months ago

I 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?

yvolovich-cyber contributor · 10 months ago

"@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.

newptcai · 10 months ago

The use of @ should be documented!

0xdevalias · 10 months ago
The use of @ should be documented!

@newptcai If you use the /mention command, it basically just inserts the @, so it's somewhat discoverable that way:

/mention  mention a file

https://github.com/openai/codex/blob/3f8184034f12e2c03013273505259999acd03423/codex-rs/tui/src/chatwidget.rs#L820-L822

mudkipdev · 9 months ago

Can it be fixed? or what is the proper way to tag files?

mudkipdev · 8 months ago

@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 /mention command 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.

vivasvan1 · 3 months ago

i kind of want this behaviour is there any plans on fixing this awkward dropping of the "@" everytime i press tab??