Codex using Python to make edits to files #3057
Replies: 20 comments 19 replies
|
From a User Experience angle it's not great, as you can't see the immediate diff made like with the file edit tool. I've also found the changes that codex makes using this approach is more sloppy than if it actually edits the file, and I think its indexing too hard on the feedback of print('patched move & removed guide') which it creates for itself as signal the change was successful. |
|
I'm having this happen to me a lot. For some reason > 80% edits are achieved via Python and Bash rather than the built in tool. Occasionally telling it to please edit via built in file edit tools and not via Python or via direct Bash calls works. But in this last case, I specifically asked at the start and it went ahead and changed ~250 lines over 7 files all outside of the expected workflow Sure, I can review the work looking at the diff, but it's just odd that it consistency picks ways to edit files that don't align with the intended UX. |
|
I have the same problem in Windows, and it's pretty annoying because these changes require quite a few iterations before they actually work using a custom Python script. Sometimes it also tries to do it using some strange PowerShell commands that don't work properly with line breaks or multi-line changes. Why not simply use the built in EDIT Tool, or similarly the diff+merge tool like it is done when using from VSCode? |
|
I personally think its a product of the RL environment that OpenAI is using to train gpt5, where it probably doesn't have access to the typical file edit tool, so it tries to use alternatives like trying to edit files with ephemeral scripts it makes. So from my perspective its either the File Edit tool in codex is either not "ergonomic" enough for the model to use, or its a problem with the model itself that cant be fixed with codex. |
|
Same here on macOS. Doesn't that make the already slow Codex even slower? |
|
Do I have to give it permissions to use file edit? Because I'm having the same problem. |
|
Also was surprised by that. Some people told me using and MCP server for file editing could help, but didn't have a chance to try. |
|
Is there an open issue for this? |
|
Sometimes it's using git diff tool to edit files. Weird but works fine most of the time |
|
Changing the model from gpt-5-codex / medium to gpt-5 / medium fixed this for me. |
|
I personally think this is really cool. There’s something beautiful about AI made with code using code to write more code. Full circle moment if you ask me. I was hesitant at first, telling it to “stop using python to edit files” in my AGENTS.md, but, low and behold, Codex started using Ruby to edit files. Honestly, just let it do its thing. It’s an incredible model. |
|
#如果您尝试在不支持其本机沙盒机制的环境(例如较旧的 Linux 内核或 Windows)中使用 Codex,则可能还需要使用此选项。 在配置文件中添加这个,一切都好使了. |
|
Yeah this is really frustrating me as well. It will go through Python, Node and others before making 'normal' file edits, sometimes even (trying to) use git commands to revert entire files... Maybe it's a way to make the context window fill less quickly? It seems to be reading less file contents (but that might just be me). Anyway it's VERY annoying as it basically strips immediate verifyability. 'What happened here?', 'When did this function get edited' are questions I find myself asking frequently lately, due to the opaque mass editing being done. |
|
the fact that this still isn't fixed yet - maybe AI has led me to lose my patience, but simple stuff takes forever for it to do as it starts spamming python to read using a for loop python - <<'PY' this has been running forever it may be stuck in an inf loop |
|
Did this ever get addressed guys? |
|
I've had it use everything from cat to node to do file edits recently Everything except the built in tool. Crazy. Opencode does not have this problem when using the codex model. Baked in tool prompt issue? |
|
Thanks all, and thanks @etraut-openai for confirming the behavior In my experience this is not having a negative impact on my user experience anymore and haven't observed this problem, so I am closing the discussion |
|
The latest codex |
|
guys we've achieved AGI, but can't fix codex, to edit files like normal intelligent being |
That's the part with real consequences, separate from the aesthetics of the choice. When edits go through a scripted path rather than the edit tool, two things stop being Whatever the tool ends up doing, the property worth insisting on is that the run leaves
Concretely as a user-side check right now: after a Codex run, Related: the review side of the same problem is that "the agent said it edited the file" |
Uh oh!
There was an error while loading. Please reload this page.
I have found that instead of using the File Edit tool which it has, it runs python to make the changes.
This is quite interesting behavior, has anyone else seen this happen in their Codex Usage?
Could this because of a problem with the file edit tool, so codex prefers to script the changes with python?
All reactions