Repository navigation
npm update leaves app-server on old version, but daemon update/restart refuse recovery #46468
Description
npm update leaves app-server on old version, but daemon update/restart refuse recovery
What version of Codex CLI is running?
codex-cli 0.155.0
The still-running background app-server reported 0.154.0.
Component
Codex CLI / app-server daemon / npm updater
Platform
- WSL2:
Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 - Ubuntu 26.04 LTS
- Node.js
v22.23.1 - npm
10.9.8 - npm package:
@openai/codex@0.155.0
What issue are you seeing?
This is the second time an npm update has left the running app-server on the previous Codex version with no supported recovery path.
The CLI, npm package, and native binary on disk were already 0.155.0, but the app-server process had started immediately before the npm update and remained 0.154.0:
{
"status": "running",
"managedCodexPath": "/home/sbw/.codex/packages/standalone/current/codex",
"managedCodexVersion": null,
"socketPath": "/home/sbw/.codex/app-server-control/app-server-control.sock",
"cliVersion": "0.155.0",
"appServerVersion": "0.154.0"
}At that time there was no standalone installation at the reported managedCodexPath. The visible ~/.local/bin/codex was a wrapper that loaded NVM and executed the npm-installed CLI:
~/.nvm/versions/node/v22.23.1/bin/codex
-> ../lib/node_modules/@openai/codex/bin/codex.js
The running daemon was from that npm installation:
node ~/.nvm/versions/node/v22.23.1/bin/codex \
-c features.code_mode_host=true app-server --listen unix://
The process began at 04:05:49, while the npm codex symlink was updated at 04:06. This is consistent with npm replacing the on-disk package while leaving the already-running 0.154.0 daemon alive.
The warning suggested running:
codex app-server daemon updatebut that command refused:
{
"status": "unsupported",
"managedCodexPath": "/home/sbw/.codex/packages/standalone/current/codex",
"installedVersion": null,
"runningVersion": "0.154.0",
"message": "This command requires a CLI-managed daemon and a stable latest-channel standalone install; update this installation with its owning installer."
}The obvious fallback also refused:
$ codex app-server daemon restart
Error: app server is running but is not managed by codex app-server daemon
So the CLI detects the mismatch and recommends a command that cannot work for the npm installation, while the restart command also refuses to recover it.
Steps to reproduce
- Install Codex globally through npm and start the shared app-server daemon from that installation.
- Keep a client connected to the daemon.
- Upgrade
@openai/codexglobally from 0.154.0 to 0.155.0 without first stopping the daemon. - Run
codex app-server daemon versionand observe CLI 0.155.0 with app-server 0.154.0. - Run
codex app-server daemon updateandcodex app-server daemon restart. - Observe that
updatereportsunsupportedandrestartreports that the running server is not managed.
Expected behavior
At least one supported recovery path should work:
- npm updates should stop/restart a daemon launched from the package being replaced; or
- the newer CLI should be able to restart a reachable older daemon from the same npm installation; or
- the warning should provide an npm-specific command that actually reconciles the running daemon; or
doctor/daemon versionshould explain that the process predates the package update and offer a safe takeover flow.
It is also misleading for an npm-managed invocation to report a nonexistent standalone path as managedCodexPath.
Actual recovery required
Normal TERM did not make the old daemon exit within 10 seconds while clients were connected. Recovery required:
- Install the official standalone 0.155.0 distribution.
- Replace the visible CLI path with the standalone symlink.
- Force-kill the old npm daemon process group.
- Remove the unowned control socket.
- Start a new managed standalone daemon.
After that, the daemon reported:
{
"status": "running",
"managedCodexVersion": "0.155.0",
"cliVersion": "0.155.0",
"appServerVersion": "0.155.0"
}Related issue
Possibly related to #44037 because both end in a reachable but “unmanaged” daemon. However, #44037 attributes lost management to WSL2 clock changes and PID start-time validation. This case was tied to an npm package update leaving the old process alive, with no standalone installation or management metadata present.
Activity
sun-binwen commentedon Sep 18, 2026
CLI
/feedbackwas also submitted for this report (without session logs).Feedback thread ID:
01a0b5ca-57e3-7fa2-8df5-af3f08be203484dnnvbdvp-debug commentedon Sep 18, 2026
Exact
rust-v0.155.0source makes this look like a real lifecycle gap rather than an updater race that merely needs a longer wait.Two independent guards leave the reported npm-owned daemon with no supported transition:
app-server-daemon/src/manual_update.rsreturnsUnsupportedunless the selected binary is a stable managed standalone release, and it also rejects a reachable socket whenrunning_backend_instance(...)cannot prove daemon ownership.app-server-daemon/src/lib.rs::restart()separately rejects the same state when the socket probe succeeds butrunning_backend(...)isNone, with the exactapp server is running but is not managed...error.There is also a diagnostic artifact in 0.155.0:
managed_install::managed_codex_bin()synthesizes$CODEX_HOME/packages/standalone/current/codexon Unix as its fallback even when no managed install exists.LifecycleOutputthen exposes that asmanagedCodexPath, so that field is not evidence that the running process came from—or can be recovered through—that path. That matches the report's nonexistent path.Current
mainhas moved toward a dedicated daemon-owned package and explicit legacy migration, but the new migration still deliberately returnsunsupportedwhen the control socket is reachable and the process is not recognized as a managed backend. So as far as public source shows, the npm-started/unowned case still needs an explicit ownership-aware recovery contract; simply wideningrestartto kill any reachable process would weaken an important safety boundary.I would pin the repair with an installer-ownership regression rather than only a version-mismatch regression:
daemon versionto distinguish running daemon provenance/ownership from the prospective managed destination (do not report a nonexistent managed path as if it owned the process).That keeps the existing fail-closed ownership rule while fixing the dead end: mismatch detection, remediation advice, and the command that performs remediation need to agree on who owns the running process.
leynos commentedon Sep 20, 2026
I'm experiencing the same problem. Is there a work-around?
Nurshot commentedon Sep 20, 2026
same problem
baskan commentedon Sep 21, 2026
any workarounds?
arsharaf commentedon Sep 21, 2026
same issue
ysys143 commentedon Sep 30, 2026
Additional reproduction on macOS: stale app-server hides newly available models
I reproduced the same CLI/app-server version-skew and recovery failure on macOS, with a visible model-catalog impact.
Environment
0.159.20.153.4Observed behavior
Before recovery, the local app-server model catalog did not include
gpt-6.1-sol,gpt-6-sol, andgpt-6-luna, although a fresh catalog request for client version0.159.2included them.daemon bootstrapalso reported that the existing app-server was not daemon-managed. Manual termination of the stale processes was required. Afterward, the daemon recreated the app-server correctly at0.159.2, and the current models became available.Expected behavior
After a CLI update, the daemon should replace or adopt an incompatible app-server. The model catalog should reflect the current CLI/server version. If automatic recovery is impossible, a supported command should identify the owner and recover the state.
Actual behavior
An older app-server remained active and served a stale model catalog. The CLI detected the mismatch, but
daemon restartanddaemon startcould not repair it.Impact
The model picker made newly available models appear unavailable, while the daemon reported that an app-server was already running. Manual process inspection and termination were required.
shakystar commentedon Oct 9, 2026
Additional observation on native Windows using the npm-installed CLI: the version mismatch recurs after following the official update prompt in the interactive Codex CLI. The user-facing update flow updates the npm package, but leaves the managed background server on an older version.
Verified on October 9, 2026:
npm.cmd list -g @openai/codex --depth=0:@openai/codex@0.162.0codex.cmd --version:codex-cli 0.162.0codex.cmd app-server daemon versionreturned the following fields (local paths omitted):{ "status": "running", "backend": "pid", "managedCodexVersion": "0.160.0", "cliVersion": "0.162.0", "appServerVersion": "0.160.0" }Process inspection also confirmed that the running managed app-server executable comes from the separate
.codex/packages/app-server-daemon/releases/package, while the CLI comes from the global npm installation.The important UX detail is that this follows the update action offered by Codex itself, rather than a separately chosen manual upgrade procedure. This mismatch has occurred repeatedly across updates on this machine.
Scope of this confirmation: it confirms the update/version-skew part of this issue. I have not attempted daemon update/restart for this latest occurrence, so I am not claiming to reproduce the original report's
unsupportedor unmanaged-daemon recovery failures, or that the version difference alone proves the cause of every CLI symptom.Expected behavior: the official update flow should account for the managed server as well as the npm CLI, safely coordinate any necessary server update/restart, and verify the effective running version. If it cannot do that during active work, it should clearly report that the server still needs updating and provide the supported next step.
Related: #37536 describes an older app-server continuing to serve a newly updated CLI and retaining old behavior.