codex icon indicating copy to clipboard operation
codex copied to clipboard

High GPU usage while the app is “thinking” due to tiny useless animation

Open homm opened this issue 8 months ago • 58 comments

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.325.31654 (1272)

What subscription do you have?

Plus

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

I see high GPU usage while using the Codex app, and it looks like it is caused by the tiny animation, which does not deserve such an amount of energy consumption.

What steps can reproduce the bug?

  1. Open any GPU monitoring tool. For example, macmon, since it allows 250 ms updates. I'm using my own tool StillCore since it allows 100 ms updates.
  2. Open the app and ask anything. It starts "thinking," consuming much more GPU power than expected. It's about 70% utilization and up to 1.5 W power on my M4 Pro.
  3. Hide this spinner. You have two options: you can toggle the sidebar or collapse the chats group.
Image

Codex will still be thinking, but GPU consumption will drop to a low level, with spikes on UI updates.

  1. Reveal the spinner again (toggle the sidebar or uncollapse the chats group). You will see how the GPU level returns to high.

You can clearly distinguish all three steps in the screenshot. The red line is GPU frequency, and the red area is GPU utilization.

Image

What is the expected behavior?

The application should not consume this much GPU power for such simple tasks. This is significant, since even Civilization VI with a 60 FPS cap consumes less than 1 W of power during the first turns.

Additional information

No response

homm avatar Apr 05 '26 16:04 homm

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

  • #16099

Powered by Codex Action

github-actions[bot] avatar Apr 05 '26 16:04 github-actions[bot]

This did help thanks! I did also have to hide the "thinking" animation. GPU usage does go up a lot when scrolling too but at least I can use this and keep on screen without it eating through battery excessively. Hopefully they get this fixed soon!!

jdrharrison-ai avatar Apr 07 '26 16:04 jdrharrison-ai

That's hilarious. Was wondering why my FPS was just dropping like crazy when playing path of exile while codex was doing stuff

N3RDMJ avatar Apr 08 '26 08:04 N3RDMJ

Good thing i use tui 🤣

kvcop avatar Apr 08 '26 13:04 kvcop

@etraut-openai Could you please take a look on this?

homm avatar Apr 09 '26 08:04 homm

@etraut-openai How to catch your attention?

homm avatar Apr 10 '26 08:04 homm

The Codex TUI has a similar bug where a useless animation costs way too many resources, but it's definitely a different area of code. #11877. It was originally redrawing the entire TUI screen every 32ms. That one has a Codex-created fix, but user PR's aren't considered anymore. It was originally memory leaking 20GB (!) over 2-3 days under the right circumstances under tmux, but a code change for an unrelated reason happened to substantially reduce that. Now, it's just unnecessary resource usage but not a horrible memory leak.

Anyways, I took care of that one by cloning Codex and having it build itself, analyze the situation, and fix it.

In case OpenAI doesn't fix this, since you're using the non-open source GUI, I don't know if Codex will be able to see everything it would need to analyze and change. It's made in Electron, which makes me think it might be possible for Codex to come up with a fix for you, but I'm not very familiar with Electron. Maybe it can disable the animation, or maybe it can figure out how to make it use way less.

Unfortunately, you'd have to have Codex re-fix itself every time the app was updated, if OpenAI doesn't fix it.

darlingm avatar Apr 10 '26 16:04 darlingm

:/

h0lybyte avatar Apr 11 '26 21:04 h0lybyte

Profiled this on M3 Pro / macOS 26.4.1 / Codex 26.409.20454. Confirms the root cause.

What's happening

The thinking/shimmer animation is an infinite CSS animation that keeps Chromium's compositor subscribed to VSync indefinitely. The compositor correctly ticks every frame (~60 Hz) because cc::SchedulerStateMachine::BeginFrameNeeded() returns true as long as any animation is on the ticking list. Each tick forces a full GPU present cycle.

This is Chromium working as designed — the bug is the app never pausing the animation when it's not visible or not needed.

Profiling data

5-second sample at 1ms intervals + ioreg AGX stats + vmmap:

Metric Value
GPU Device Utilization 62–68% sustained
GPU Memory In-Use 1.2 GB
GPU Memory Allocated 3.9 GB
Compositor thread (renderer) 92% idle (kevent64), 8% active — wakes every VSync
GPU process CPU time (accumulated) 42 min
WindowServer CPU 52%
IOSurface regions (GPU process) 162 regions, 277 MB resident
IOAccelerator regions 1466 regions, 40 MB resident

GPU process main thread call chain on each composite:

CA::Transaction::commit()
  → CA::Context::commit_transaction()
    → CA::Layer::commit_if_needed()  [6 layers deep, recursive]
      → CA::Render::Surface::Surface(__IOSurface*)
      → CA::Render::Encoder::send_message()  → mach_msg to WindowServer
        → [AGXG15XFamilyCommandBuffer renderCommandEncoderWithDescriptor:]
          → AGX::RenderContext::beginRenderPass()
          → AGX::RenderUSCStateLoader::setupRenderCommand()

Hiding the sidebar (collapsing the spinner) removes the animation from the ticking list → compositor stops subscribing to VSync → GPU drops to near zero. Exactly what @homm reported.

Fix

The animation should either:

  • be paused/removed when not in viewport (Intersection Observer)
  • respect prefers-reduced-motion (it currently doesn't without the launch flag)
  • use will-change: transform with compositor-only properties and avoid full-layer invalidation

Workaround: --force-prefers-reduced-motion on launch.

Related: #10432, #16099, #10885

RedesignedRobot avatar Apr 15 '26 00:04 RedesignedRobot

Codex problems need codex to solve.

Try this prompt, it looks good to me.

Patch the installed macOS app at `/Applications/Codex.app` to mitigate the high-GPU “T
hinking” bug from https://github.com/openai/codex/issues/16857.

Approach:
- Treat this as an installed Electron app patch, not a source-repo change.
- Unpack `Contents/Resources/app.asar`, search the web UI bundles for
`thinkingShimmer.default` / `loading-shimmer-pure-text`.
- Root cause: the tiny “Thinking” status uses a shimmer text animation in the Electron
UI, and that animation appears to drive unnecessary GPU usage.
- Apply a minimal fix: in the compiled CSS, disable the shimmer animation only for
Electron (for classes like `.loading-shimmer-pure-text`, `.loading-shimmer`, optionally
`.loading-shimmer-pure-text-inverted`) and render them as static text instead.
- Repack `app.asar`.
- Update `Contents/Info.plist` `ElectronAsarIntegrity` with the correct ASAR header
SHA256 hash, not the whole file hash.
- Re-sign the app and verify it launches.

Kare-Udon avatar Apr 15 '26 06:04 Kare-Udon

same, when I switch to codex interface, gpu up to 100%

minured avatar Apr 15 '26 20:04 minured

Same issue here, i really thought it was doing some sort of local processing embedding or something like that but it seems its just bad UI lmao.

crafael23 avatar Apr 17 '26 02:04 crafael23

@etraut-openai any updates?

homm avatar Apr 17 '26 12:04 homm

Hello? this makes the codex app unusable on battery. please address this asap!

ninjiez avatar Apr 18 '26 00:04 ninjiez

This has been going on for months. Seems utterly ignored. Sometimes they mistake it for high CPU usage instead of GPU. Long live automated issue tracking. For those interested, you can create a wrapper app using Automator, that runs as a shell script the command open "/Applications/Codex.app" --args --force-prefers-reduced-motion. You can then switch its icon with the codex one, by opening the info of both and copy/pasting the small icon in the top left. Hope someone will take the apparently little time it takes to get this sorted. At least a settings toggle, if nothing else.

schniper avatar Apr 23 '26 09:04 schniper

Image imaging codex app fuck my gpu even more than my game

H3artdown avatar Apr 24 '26 21:04 H3artdown

19 days and nothing from OpenAI

Risengan avatar Apr 24 '26 22:04 Risengan

Just hovering over the loading animation makes the usage go back to normal. Very strange bug

willmarkman avatar Apr 28 '26 13:04 willmarkman

Just hovering over the loading animation makes the usage go back to normal. Very strange bug

That is probably because you are changing the loading button to an archive button. You probably shouldn't have more than two loading screens running at the same time.

melong0124 avatar Apr 29 '26 23:04 melong0124

Are you by any chance using external monitors, 4k scaled, high refresh rates? Playing with the scaling and frequency makes a difference. In my case (Corsair Xeneon 4k 32" 144hz, running 3008x1692 120hz through usb-c on a mac mini m4), using native 4k and 60hz somewhat alleviates the issue. Also, it is not limited to Codex. Happens in Claude desktop, happens in Edge and Chrome on websites with similar animations. So it is either a Chromium compatibility issue with Mac OS (running latest 26.4.1) or a Mac OS introduced issue.

Anyway, quickest fix would be a toggle for reduce motion in Settings. I am doing web work, so globally enabling Reduce motion is something I would avoid. But which also should work, by the way; at least in Edge, it does.

schniper avatar May 07 '26 06:05 schniper