Linux: long-lived Codex session appears to accumulate memory and can hard-freeze host
Open 💬 0 comments Opened Apr 5, 2026 by vladk-ml
What version of Codex CLI is running?
0.118.0
What subscription do you have?
Plus
Which model were you using?
gpt-5.4
What platform is your computer?
cachyos
What terminal emulator and version are you using (if applicable)?
kitty
What issue are you seeing?
Environment
- OS: CachyOS Linux
- Session: Wayland / niri
- Terminal: kitty
- Codex version: codex-cli 0.118.0
- RAM: 64 GiB
- GPU: NVIDIA
Summary
- A long-lived Codex session was left open in a single terminal for most of the day.
- Near the end of the session, the machine hard-froze.
- Recovery required a full power cut.
- The first reboot attempt produced no display output.
- The second reboot completed successfully.
Observed evidence
- The prior boot journal shows the terminal scope reaching a very large memory peak:
Apr 04 20:39:11 ... kitty-20694-0.scope: Consumed 2h 59min 55.297s CPU time over 10h 43min 8.879s wall clock time, 49.4G memory peak, 3.1G memory swap peak.
- The parent launcher scope remained small:
Apr 04 20:39:11 ... app-niri-inir-20694.scope: ... 136.9M memory peak
- The long-lived Codex thread in that same terminal had very large token totals by approximately 2026-04-04 20:05 PDT:
- input_tokens: 64,403,106
- cached_input_tokens: 62,698,496
- output_tokens: 255,556
- reasoning_output_tokens: 88,037
- total_tokens: 64,658,662
- That thread shut down around 20:37:41 PDT, roughly 90 seconds before the host froze.
What was not observed
- No kernel panic
- No OOM killer event
- No systemd-oomd event
- No thermal shutdown
- No NVMe/storage fault
- No machine check / hardware error
- No NVIDIA Xid before the freeze
Interpretation
- This does not look like a normal kernel-level crash.
- The strongest signal is memory growth inside a long-lived terminal scope hosting a long-lived Codex session.
- kitty may contribute via scrollback or terminal state, but the issue appears correlated with Codex session lifetime/size.
Expected behavior
- Long-running Codex sessions should degrade more safely.
- A CLI session should not be able to silently grow until it destabilizes a 64 GiB workstation.
Actual behavior
- Memory usage appears to grow large enough to hang the machine.
- The host became unresponsive and required hard power cycling.
Notes
- This was a heavy all-day session, not a short normal run.
- Project-specific details are intentionally omitted.
- More sanitized logs can be provided if needed.
What steps can reproduce the bug?
- Start a Codex session on Linux in kitty.
- Keep the same session/thread open for a long period, with repeated interactive use across the day.
- In this case, the session lived for about 10h 43m.
- The affected long-lived thread had very large token totals by around 2026-04-04 20:05 PDT:
- input_tokens: 64,403,106
- cached_input_tokens: 62,698,496
- output_tokens: 255,556
- reasoning_output_tokens: 88,037
- total_tokens: 64,658,662
- Near the end of the session, the host hard-froze.
- Recovery required a full power cut.
- The first reboot attempt produced no display output.
- The second reboot succeeded.
Empirical evidence from the previous boot journal:
Apr 04 20:39:11 ... kitty-20694-0.scope: Consumed 2h 59min 55.297s CPU time over 10h 43min 8.879s wall clock time, 49.4G memory peak, 3.1G memory swap peak.
Apr 04 20:39:11 ... app-niri-inir-20694.scope: ... 136.9M memory peak
Codex version:
codex-cli 0.118.0
What is the expected behavior?
- A long-running Codex session should not silently grow until it destabilizes the host.
- If session state becomes unusually large, Codex should fail more gracefully, warn, or limit resource growth.
- A CLI session should not be able to hard-freeze a 64 GiB workstation during normal interactive use.
Additional information
- Environment:
- CachyOS Linux
- Wayland / niri
- kitty
- NVIDIA GPU
- 64 GiB RAM
- No matching kernel panic, OOM killer, systemd-oomd, thermal shutdown, NVMe/storage fault, machine check, or NVIDIA Xid was found before the freeze.
- This appears more consistent with memory growth inside a long-lived terminal scope hosting a long-lived Codex session than with a normal kernel-level crash.
- Project-specific details intentionally omitted, but more sanitized logs can be provided if useful.
Additional information
_No response_