codex - 💡(How to fix) Fix Prioritize recent file references in Codex chat autocomplete for @file mentions [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17255Fetched 2026-04-10 03:43:18
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2renamed ×1
RAW_BUFFERClick to expand / collapse

What version of the IDE extension are you using?

26.325.31654

What subscription do you have?

Pro

Which IDE are you using?

Cursor

What platform is your computer?

Windows

What issue are you seeing?

Issue description When referencing files in Codex chat, autocomplete does not prioritize files that were referenced very recently in the same workflow. This is especially painful for long filenames that I repeatedly use across multiple prompts.

For example, if I recently referenced GenerateQuestionsPage.tsx, and then start typing part of that filename again, Codex should strongly favor that same file in the top suggestions. Instead, the suggestion list often surfaces other similarly named files first, forcing me to continue typing much more of the full filename again and again.

This makes repeated file referencing unnecessarily slow and frustrating, particularly in real projects where long filenames are common and the same few files are referenced repeatedly during a session.

This feels like the ranking logic is underweighting a very strong signal: recent file references in Codex chat. Cursor chat handles this better. Browser URL bars are another good analogy: recently and frequently accessed items are typically ranked very highly once the typed prefix overlaps.

Expected behavior If a file exists in the user’s recently referenced files in Codex chat, that recency should strongly influence autocomplete ranking.

At minimum:

the top 1–2 suggestions should prefer files referenced most recently this should apply when the typed text partially matches one of the last several referenced files recent-reference ranking should be especially strong for long filenames and repeated use within the same session

A reasonable heuristic would be:

maintain a rolling set of the last X referenced files in Codex chat, for example 10 when the user types a partial filename matching one of those files, boost those recent files above generic similarity matches combine recency with prefix match quality, rather than using only fuzzy matching or global filename similarity

Actual behavior Autocomplete appears to rank based mostly on generic name matching, without giving enough weight to files I referenced just moments ago. As a result, for long filenames with similar alternatives, I often have to type nearly the full filename every time.

Why this matters This adds friction to a very common workflow:

reference a file ask Codex to modify or inspect it reference the same file again in the next prompt

When that loop repeats across several prompts, the autocomplete behavior noticeably slows down usage and makes Codex feel less context-aware than it should.

Concrete example I repeatedly reference GenerateQuestionsPage.tsx in Codex chat. Even after recently using it, I still have to type a large portion of the filename again before it becomes the top suggestion.

Suggested fix Update file mention autocomplete ranking to include a strong recency signal from Codex chat history. Recently referenced files should be boosted into the top suggestions when the user types a matching prefix or partial name.

A simple ranking improvement could be:

  1. exact prefix match
  2. recent references in current session
  3. recent references across recent sessions
  4. frequency of prior references
  5. then generic fuzzy match
<img width="467" height="335" alt="Image" src="https://github.com/user-attachments/assets/e13f1ede-033c-463d-bdc4-3c71f0791e32" />

What steps can reproduce the bug?

  1. Open Codex chat in a repo containing multiple files with similar names, including one with a relatively long filename.
  2. Reference a long file, for example GenerateQuestionsPage.tsx.
  3. Send a prompt using that file reference.
  4. In the next prompt, start typing the same filename again using only an initial partial string, such as Gener or GenerateQ.
  5. Observe the autocomplete suggestions.

Actual result The recently referenced file is not reliably prioritized, and I often need to type much more of the full filename before it appears at the top.

What is the expected behavior?

Expected result The file that was referenced most recently, such as GenerateQuestionsPage.tsx, should appear in the top 1–2 suggestions.

Additional information

Cursor chat gets it better, you can also use the algorithm of browser typed suggestions to create a good useful and intuitive solution.

extent analysis

TL;DR

Update the file mention autocomplete ranking to prioritize recently referenced files in Codex chat, especially for long filenames and repeated use within the same session.

Guidance

  • Implement a recency signal from Codex chat history to boost recently referenced files into the top suggestions when the user types a matching prefix or partial name.
  • Consider a ranking improvement with the following steps: exact prefix match, recent references in the current session, recent references across recent sessions, frequency of prior references, and then generic fuzzy match.
  • Maintain a rolling set of the last X referenced files in Codex chat (e.g., 10) to inform the autocomplete ranking.
  • Combine recency with prefix match quality to provide a more intuitive and useful solution.

Example

A possible ranking function could be implemented as follows:

def rank_suggestions(files, typed_text, recent_references):
    # Exact prefix match
    exact_matches = [file for file in files if file.startswith(typed_text)]
    
    # Recent references in current session
    recent_matches = [file for file in recent_references if typed_text in file]
    
    # Combine recency with prefix match quality
    suggestions = exact_matches + recent_matches + [file for file in files if typed_text in file]
    
    return suggestions

Notes

The provided image is not directly relevant to the suggested fix, but it may be useful for illustrating the issue. The Cursor chat and browser typed suggestions can serve as a reference for creating a more intuitive solution.

Recommendation

Apply a workaround by implementing a custom autocomplete ranking function that prioritizes recently referenced files, as described in the guidance section. This should improve the usability of Codex chat, especially for long filenames and repeated use within the same session.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Prioritize recent file references in Codex chat autocomplete for @file mentions [1 participants]