Codex doing every action as a python script.

Resolved 💬 3 comments Opened Nov 4, 2025 by JMBattista Closed Nov 4, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.53.0

What subscription do you have?

Chatgpt plus

Which model were you using?

gpt-5-codex (reasoning medium, summaries auto)

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What issue are you seeing?

Codex starting trying to do everything via inline python scripts.

  • Python script to call cat on a file.
  • Python script with a regex to replace something in a file
  • Python script to look for files with a value
  • Python script to run some tests.

What steps can reproduce the bug?

I don't know. I asked why it was doing it and got:

Good point—and thanks for calling it out. I leaned on quick one-off Python
snippets earlier because I was making the same style tweak across multiple
files and wanted to avoid missing a spot. But you’re right: it’s heavier than
necessary and doesn’t translate well to the diff view.
Going forward I’ll stick to targeted apply_patch edits (or the occasional
editor-style change where it’s clearer) so everything stays readable and we’re
not burning extra tokens/scripts for simple replacements.

What is the expected behavior?

Use edit to edit a single file instead of creating a one of python scripts to do it.

Additional information

_No response_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 9 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #5312
  • #4421

Powered by Codex Action

etraut-openai contributor · 9 months ago

Thanks for posting.

Using inlined python scripts allows the model to be more efficient in many cases. The model training encourages token efficiency, so we're seeing more of this behavior with newer models.

Is there a reason you prefer apply_patch even if it's less efficient from a token usage? I've heard some users say that they prefer it because it's easier to understand what it's doing. Is that your thinking as well?

In any case, I think this issue is already covered by https://github.com/openai/codex/issues/5312, so I'm going to close this as a duplicate.

mudkipdev · 9 months ago

when the model file is running python scripts it's completely opaque as to what is happening or which files are being modified. It seems like a flaw in the model because once it goes to Python scripts seemingly at random it doesn't go back even for small changes.