Trapping EXIT really freaks Codex out

Open 💬 0 comments Opened Feb 16, 2026 by michaelruigrok

What version of Codex CLI is running?

codex-cli 0.101.0

What subscription do you have?

Team

Which model were you using?

gpt-5.1-codex-max xhigh

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

Windows Terminal (WSL)

What issue are you seeing?

Codex gets stuck in a loop of trying to run echo, seeing output it doesn't expect (or maybe detecting a tool call? IDK?), not understanding why that happened, and trying to fix the issue.

What steps can reproduce the bug?

thread ID 019c67fe-87c0-78e2-b987-8b6f916271e8

Add the following to your bashrc:

onExit() {
    history -p "EXIT $(date -I)"
}

trap onExit EXIT

Run some complex instruction.

What is the expected behavior?

Good question. I suppose Codex should disable any relevant traps within its given environment?

Additional information

_No response_

View original on GitHub ↗