Skip to content

[Bug]: mise upgrades can strand systemd on removed versioned OpenCodex paths #2898

Description

@mushikingh

Client or integration

Codex CLI

Area

Service lifecycle

Summary

The Linux systemd user unit generated by ocx service install embeds the absolute, versioned OpenCodex CLI and bundled Bun paths. When OpenCodex is installed through mise, mise upgrade opencodex installs the next release under a different version directory without running OpenCodex's own update workflow, so the installed unit remains tied to the previous version.

Once mise removes the previous install or the service is restarted after pruning, systemd has no executable at the baked path and the background proxy cannot start. ocx service repair fixes the unit, but it has to be run manually after every external package-manager upgrade.

I currently need this mise configuration as a local workaround:

opencodex = { version = "latest", postinstall = 'if test -f "$HOME/.config/systemd/user/opencodex-proxy.service"; then "$MISE_TOOL_INSTALL_PATH/node_modules/.bin/ocx" service repair; fi' }

The guard makes a first installation without a service a no-op and forces an existing service to be re-baked after mise changes the install path.

Expected: an installed OpenCodex service remains startable across supported external package-manager upgrades, or OpenCodex provides a package-manager-independent launcher/service path that does not require a per-manager postinstall repair hook.

Actual: the service definition is coupled to one mise version directory and becomes stale when that directory is replaced or pruned.

Reproduction

  1. Install OpenCodex through mise:

    mise use -g opencodex@latest
  2. Install the Linux user service:

    ocx service install
  3. Inspect the generated unit:

    systemctl --user cat opencodex-proxy.service | grep -E '^(ExecStart|Environment="OCX_BUN_RUNTIME_PATH)='

    Both the bundled Bun runtime and CLI entry point are under a version-specific path such as:

    /home/<user>/.local/share/mise/installs/opencodex/2.35.0/...
    
  4. Upgrade to the next OpenCodex release through mise:

    mise upgrade opencodex
  5. Confirm the unit still names the previous version directory. After that old install is removed or pruned, restart the user service or reboot:

    systemctl --user restart opencodex-proxy.service
    ocx status
  6. Repairing manually re-bakes the unit and restores service health:

    ocx service repair
    ocx status

This is distinct from #2411 and #2412. Their released fixes improve routing visibility and correctly reject a version-manager-owned Codex shim, but they do not make the OpenCodex systemd service survive an external OpenCodex package upgrade.

Version

2.35.0

Operating system

Ubuntu 24.04.4 LTS on WSL2, kernel 6.18.33.2-microsoft-standard-WSL2

Provider and model

Not provider- or model-specific.

Logs or error output

$ systemctl --user show opencodex-proxy.service -p ActiveState -p UnitFileState
ActiveState=active
UnitFileState=enabled

$ systemctl --user cat opencodex-proxy.service
# ExecStart and OCX_BUN_RUNTIME_PATH both contain:
/home/<user>/.local/share/mise/installs/opencodex/2.35.0/...

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserviceService lifecycle (WinSW/launchd/scheduler)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions