Why does Codex trigger "Context automatically compacted" so frequently?

I’m seeing “Context automatically compacted” extremely frequently in Codex.

In many cases the agent only:

  • Reads a few files
  • Runs a few commands
  • Makes a small code change

Yet auto-compaction happens repeatedly.

Do you tend to use only 1 session?

How many artifacts are you dragging around typically in a session?

Those are my first two questions I’d be troubleshooting with if this were happening to me.

Anything over 20-30 is usually a bit much, depending on the scope of your work…

Oh, I ran into the exact same situation where tokens were going down the drain and Codex itself couldn’t do anything useful. All I saw were messages in this sequence:

I’ll look into the issue now. Searching…
Context automatically compacted.
After the context compression, I’ll figure out where we left off.
Context automatically compacted
It looks like the context was compressed, and I’ll continue working.
Context automatically compacted

Anyway, just like with many other people I found facing this problem, no one had posted a solution.

And after 8 hours—having deleted VS Code and Cursor, and scrubbed every directory of all MCPs and skills—I was back to square one…

Context automatically compacted
Context automatically compacted
Context automatically compacted

That turned out not to be the problem.

In the Codex chat, you need to click the gear icon and go to Codex Settings.
Select the “Personalization” tab there.

Look at the “Custom instructions” text field.

Since I write in Cyrillic rather than English, one MCP had inserted rules using Cyrillic text; naturally, this became unreadable due to an encoding error, turning all the Cyrillic characters into gibberish.

When this situation started, the first thing I saw were messages claiming my requests looked like a system hack attempt, and it started blocking all requests. Then something changed—requests started getting through, but the “Context automatically compacted” message appeared.

It’s hard to believe that a broken encoding issue could cause such problems for people who don’t work in English, but the fact is: I deleted all the text with the corrupted encoding from that field, kept only the English versions, and everything is working perfectly again.

Wiping away a cold sweat.