Possible workaround for `context_compaction / invalid_enum_value` errors on Codex Desktop for Remote SSH

Resolved 💬 3 comments Opened Jun 9, 2026 by zzowenzz Closed Jun 19, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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

Version 26.608.12217

What subscription do you have?

Pro

What platform is your computer?

Mac: Darwin 24.6.0 arm64 arm

What issue are you seeing?

I ran into the following error when using Codex Desktop with a remote Linux server over SSH:

[ItemParam] [input[4]] [invalid_enum_value] Invalid value: 'context_compaction'.
Supported values are: 'additional_tools', 'apply_patch_call', ..., 'compaction',
'compaction_trigger', ..., 'message', 'reasoning', ...

In my case, this was not caused by the prompt or the project itself. It appeared to be caused by a version mismatch between the local Codex Desktop app and the Codex CLI / app-server that was actually being launched on the remote machine.

What steps can reproduce the bug?

What fixed it for me

The important part was to check which codex binary the remote SSH session was really using, and whether the remote app-server was still running from an older system-wide install.

Useful diagnostic commands:

ssh <remote> 'command -v codex; codex --version; type -a codex'

ssh <remote> 'ps -eo user,pid,cmd | grep -E "codex.*app-server|codex.*remote-control" | grep -v grep || true'

In my case, the remote machine had an older system-wide npm-managed Codex install under paths like:

/usr/bin/codex
/usr/lib/node_modules/@openai/codex/...

Updating the local Codex Desktop app alone was not enough, because the remote codex app-server was still being launched from the old remote installation.

A user-local install fixed the problem:

ssh <remote> '
set -eux

mkdir -p "$HOME/.local"

npm install -g --prefix "$HOME/.local" @openai/codex@latest --include=optional

"$HOME/.local/bin/codex" --version
PATH="$HOME/.local/bin:$PATH" command -v codex
PATH="$HOME/.local/bin:$PATH" codex --version
'

Then I restarted the stale remote Codex app-server processes:

ssh <remote> '
pkill -u "$USER" -f "codex.*app-server" || true
rm -f "$HOME/.codex/app-server-control/desktop-ssh-websocket-v0.sock" || true
'

What is the expected behavior?

After restarting/reconnecting Codex Desktop, the error disappeared.

General lesson

For people seeing this error, it may be worth checking two things:

  1. Version mismatch
  • Local Codex Desktop may be newer than the remote Codex CLI / app-server.
  • The error can appear when one side sends or replays an item type that the other side’s schema does not understand.
  1. PATH mismatch
  • codex --version in one shell may not be the same codex binary that Codex Desktop launches over SSH.
  • type -a codex, command -v codex, and checking running codex app-server processes can reveal stale system-wide installs.
  • Installing Codex user-locally under $HOME/.local/bin may be safer than relying on a system-wide npm install, especially on shared Linux servers where users do not have permission to update /usr/lib/node_modules.

This may not be the only cause of context_compaction / invalid_enum_value, but it is a useful thing to check before reinstalling everything or assuming the thread/project is corrupted.

Additional information

I hope this can help for #27005, #26573, #26493, and issue on the developer community like this one

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 2 months ago

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

  • #27005
  • #26573
  • #26493

Powered by Codex Action

iloveonsen · 2 months ago

This method worked for me.

I am using the Codex app on macOS with a remote Linux server over SSH. My local Codex app was up to date, but the Codex CLI on the remote server was still 0.130.0, and I was seeing the same context compression error.

After updating the remote Codex CLI to 0.139.0, the issue still persisted until I killed all running Codex processes on the remote server and reconnected from the local Codex app. After that, context compression worked without errors, even in the previously affected thread.

So it seems that updating the remote CLI is not enough if stale Codex app-server/proxy processes are still running.

zzowenzz · 2 months ago
This method worked for me. I am using the Codex app on macOS with a remote Linux server over SSH. My local Codex app was up to date, but the Codex CLI on the remote server was still 0.130.0, and I was seeing the same context compression error. After updating the remote Codex CLI to 0.139.0, the issue still persisted until I killed all running Codex processes on the remote server and reconnected from the local Codex app. After that, context compression worked without errors, even in the previously affected thread. So it seems that updating the remote CLI is not enough if stale Codex app-server/proxy processes are still running.

Yes, I forgot to say this: once updated, we need to kill all existing codex processes and reopen the codex app.