Allow daemon updates to restore pinned packages to latest stable (#45780)

## Why

`codex app-server daemon update` previously required a latest-channel installation, leaving pinned and local managed packages unable to return to production updates through that command.

## What changed

- Allow explicit updates to restore managed packages to the latest stable release while preserving the automatic-update preference. Extend legacy migration to local and pinned packages when the published installer and release support it.
- Bind restoration to the selected release with a single-use updater authorization and installer guards. Scheduled updates and ordinary updater socket requests continue to respect pins.
- Restart a running daemon when its selected package changes, even if the binary and version are identical; leave stopped daemons stopped.
- Reject incompatible production packages before selecting them, resolve Windows junction targets for ownership checks, and show the restoration command after installing a pinned CLI package.

## Testing

Extend daemon and installer tests to cover local-package migration, restoration with automatic updates enabled or disabled, same-binary package restarts, stopped-daemon preservation, selection races, incompatible releases, and socket requests that must not undo pins.

GitOrigin-RevId: d64520c1190b5c7bac084fb4a1b6b24998b08dfa
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-15 19:51:06 +00:00
1 parent c0316291ca
commit 321dcf5a6f
18 files changed
+514 -123

No files matched your search

+1 -2
View File
@@ -353,7 +353,6 @@ fn managed_start_keeps_updater_on_marker_mismatch_but_stops_it_for_pin() -> Resu
std::fs::write(&marker, "0.1.0-other-target")?;
assert_eq!(daemon.lifecycle("start")?["status"], "alreadyRunning");
assert_eq!(daemon.pid("app-server-updater.pid")?, updater_pid);
assert_eq!(daemon.lifecycle("update")?["status"], "unsupported");
std::thread::sleep(Duration::from_millis(250));
let updater_state = Command::new("/bin/ps")
.args(["-p", &updater_pid.to_string(), "-o", "stat="])
@@ -457,7 +456,7 @@ fn manual_update_rejects_an_unowned_installation() -> Result<()> {
daemon
.home
.path()
.join("packages/standalone/auto-update-version"),
.join("packages/standalone/current/bin/codex"),
)?;
assert_eq!(daemon.lifecycle("update")?["status"], "unsupported");