Codex ignores contents of agents file, even after explicitly asking it to read it
Resolved 💬 2 comments Opened Sep 10, 2025 by dellis23 Closed Nov 10, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.30.0
Which model were you using?
gpt-5
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
Create an AGENTS.md file that contains the following instructions, among others:
Comment style (keep only high-signal comments)
- Do not add comments that merely restate what the code already conveys (e.g., “now inferred from POC team”, “no team_id accepted by design”, “form no longer has team context”).
- Do not leave migration notes, historical rationale, or references to removed code (“used to…”, “now…”, “by design…”). Prefer clear code and tests.
- Keep comments only for non-obvious constraints, invariants, or external requirements (protocol quirks, upstream bugs, security caveats) that are not evident from the code.
- Prefer expressive names and tests over explanatory comments.
Code hygiene
- Do not leave leftover comments referencing removed code or temporary notes. Remove obsolete blocks entirely to avoid confusion.
Explicitly ask codex to read the file on startup. Ask it to perform a task.
What is the expected behavior?
Not to leave comments referencing removed code.
What do you see instead?
Comments referencing removed code.
Example:
# foo (legacy upper code removed)
Additional information
_No response_
2 Comments
The comments for removed code thing absolutely drives me up a wall. No matter how I try to tell it, either explicitly or through AGENTS.md, it always seems to come back within a couple of requests. Maddening.
Thanks for the bug report. We've shared the feedback with the team members who are responsible for training our codex models. We're tracking this feedback and similar reports so we can make the model more robust in future iterations.
If you see other model behavior that you'd like to report, please use the recently-added
/feedbackcommand in the CLI. That will provide us with additional details including logs and conversation text.