Code Formatting Issues Caused by Codex Modifying Code via Scripts (关于 Codex 通过脚本修改代码导致的格式混乱问题)

Resolved 💬 8 comments Opened Dec 24, 2025 by u679c 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?

codex-cli 0.77.0

What subscription do you have?

plus

Which model were you using?

gpt-5.2

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What issue are you seeing?

When using Codex, it frequently modifies my code through scripts. In these cases, the resulting code is often poorly formatted, difficult to read, or even contains character encoding errors. This behavior is very disruptive to my workflow. I would like to know whether it is possible to restrict or limit code modifications performed viascripts.

使用 Codex 时,它经常通过脚本来修改我的代码。在这种情况下,被修改后的代码格式通常非常混乱,难以阅读,甚至会出现字符编码错误。这种行为对我的开发流程造成了很大困扰。我想知道是否可以尽量限制或禁止通过脚本对代码进行修改。

What steps can reproduce the bug?

This can happen at any time when communicating in Simplified Chinese and the code contains Simplified Chinese characters.

在任何情况下都有可能复现:当使用简体中文进行对话,并且代码中包含简体中文字符时。

What is the expected behavior?

Codex should not modify code using scripts, or it should apply much stricter formatting and encoding controls to any code that is modified through scripts.

Codex 不应通过脚本来修改代码,或者至少应对通过脚本修改后的代码进行更加严格的格式和编码控制。

Additional information

_No response_

View original on GitHub ↗

8 Comments

github-actions[bot] contributor · 6 months ago

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

  • #8506
  • #6401

Powered by Codex Action

u679c · 6 months ago

<img width="1341" height="538" alt="Image" src="https://github.com/user-attachments/assets/a47ffb47-47e7-4654-a648-dd293eed2555" />
Like this.

milisp · 6 months ago

Create i18n folder with en.json and zh.json, I think you're using a i18n lib

Create a AGENTS.md to limit the code language tc("english") in zh.json and en.json, only code comment Chinese

u679c · 6 months ago
Create i18n folder with en.json and zh.json, I think you're using a i18n lib Create a AGENTS.md to limit the code language tc("english") in zh.json and en.json, only code comment Chinese

I don’t think this is related to Unicode itself. When I ask Codex to modify Unicode content, it understands my intent and can make the changes correctly. The real issue is that modifying code via scripts causes many problems, and this is just one of them.
我认为这与 Unicode 本身无关。当我让 Codex 修改这些 Unicode 内容时,它能够理解我的意图并且可以正确地进行修改。真正的问题在于通过脚本修改代码会引发很多问题,而这只是其中的一个表现。

u679c · 6 months ago

<img width="521" height="305" alt="Image" src="https://github.com/user-attachments/assets/e9244239-cff4-4792-8fb0-7c19be803a8e" />
Issues like these never occur when Codex edits code without using scripts, and when it does use scripts to edit the code, it does not show any diff of the changes.
像这些问题,在 Codex 不使用脚本编辑代码时都不会发生,而且当它通过脚本编辑代码时,也不会显示任何变更的 diff 内容。

u679c · 6 months ago

Additionally, code edited via scripts often contains a large number of unnecessary blank lines.
另外,通过脚本编辑后的代码中经常会出现大量不必要的空行。

milisp · 6 months ago

If codex used script to edit files, create a new conversion instead of continuing, it may reduce to use scripts to edit.

We should create a tool that checks how often scripts are used to edit files.

I designed https://github.com/milisp/codexia

You can review the script results, select a session then click review button or history icon

etraut-openai contributor · 6 months ago

Thanks for the issue report. What you're describing here is model behavior, not something that is being done by the codex harness itself. We'll share the feedback with the team responsible for training our codex models. We're tracking this feedback and similar reports so we can make future models more robust and efficient. And thanks for using the /feedback command. That additional information is useful.