Possible workaround for `context_compaction / invalid_enum_value` errors on Codex Desktop for Remote SSH
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:
- 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.
- PATH mismatch
codex --versionin one shell may not be the samecodexbinary that Codex Desktop launches over SSH.type -a codex,command -v codex, and checking runningcodex app-serverprocesses can reveal stale system-wide installs.- Installing Codex user-locally under
$HOME/.local/binmay 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
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗