Codex trying to use python scripts to read files.
Resolved 💬 3 comments Opened Dec 24, 2025 by lgjsd Closed Dec 24, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.77
What subscription do you have?
Pro
Which model were you using?
gpt-5.2 xhigh
What platform is your computer?
Ubuntu 24, WSL2
What issue are you seeing?
Codex tried to read files using ad-hoc python scripts. See thread details.
What steps can reproduce the bug?
Uploaded thread: 019b4ea8-ba2a-78e2-a64d-8f73cfd9f24f
What is the expected behavior?
Just read files as it used to be
Additional information
_No response_
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Out of curiosity, why do you not want the agent to use python to read files?
There are times when running small python scripts to find specific information is much more token efficient than reading chunks of files into the context window. Would you prefer that the agent avoid using python scripts even if it means that it will consume more of your token usage to accomplish the task?
I looked at your session details (thanks for uploading!), and it looks like this is what is happening in this case. The model likely decided that it was more efficient to use a small python script rather than using the more typical approach of using "grep" or "rg" to search files for specific contents.
Token usage is not my primary concern. I am more focused on consistency and adherence to instructions. I initially recalled that, according to the system prompt, Codex is not allowed to use Python scripts to read files. Based on that recollection, I first assumed this was an instruction-following issue (maybe codex have done this multiple times but this maybe the first time I realize it so I thougth it was also a consistency issue). However, after reviewing the system prompt more carefully, I realized that only reading large chunks of code via Python is prohibited. Therefore, this does not appear to be a case of model misbehavior. Closing.