codex really likes spaces, in a bad way

Resolved 💬 3 comments Opened Sep 18, 2025 by lattwood Closed Nov 11, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

main/tip

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

Get OpenAI Codex to modify any Go code.

It uses spaces.

What is the expected behavior?

Tabs.

What do you see instead?

Spaces.

Additional information

In #3099 they said to use AGENTS.md, which would be appropriate for a project or company convention.

There is no universe in which Go code can be considered "correct", if it is not using tabs for indentation. There's no charitable interpretation otherwise here.

View original on GitHub ↗

3 Comments

spotshare-nick · 11 months ago

Mine also uses spaces as that's fairly normal, but I understand your desire to use tabs. Two suggestions to try which might be out of scope, but might also address your issue. Consider first that AGENTS.md can exist in many places, including your user's home directory. So if you have a personal rule that Codex is supposed to follow, you can put an AGENTS file in ~/.codex/AGENTS.md (same directory you put your MCP servers and other configs). You might be able to use AGENTS to tell it to use tabs. But with that said, Codex (and others) have a habit of not listening to their own rules, so the better method is to add a "test" and tell the AI to run the test after making any code. You can then have that test search the code base or files modified to search for <space><space> and then the AI can self fix itself.

Tests are how you can get Codex to run for 7 hours without interruption. It will keep making mistakes until the tests pass.

Again, just my 2 cents...

lattwood · 11 months ago
Mine also uses spaces as that's fairly normal, but I understand your desire to use tabs.

Personally I don't care, but the Go community has settled on gofmt as the canonical formatting style for the code.

What blows my mind, is that all Go code on the internet/in training data, uses tabs for indentation, but GPT-5/Codex insists on using four spaces which is curiously the same as how most editors display tabs when editing Go- not the "canonical" 8 spaces.

etraut-openai contributor · 9 months ago

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 /feedback command in the CLI. That will provide us with additional details including logs and conversation text.