Skip to content

feat(updater): add version revert with config restore - #175

Merged
matej21 merged 2 commits into
mainfrom
agent/version-revert
Aug 10, 2026
Merged

feat(updater): add version revert with config restore#175
matej21 merged 2 commits into
mainfrom
agent/version-revert

Conversation

@matej21

Copy link
Copy Markdown
Member

Summary

  • add a version history and revert confirmation flow to the updater settings UI
  • add okena update status, list, and revert CLI commands with dry-run, JSON, restart, and config opt-out support
  • restore exact-version config checkpoints through a deferred daemon handoff
  • keep a safety copy of the current config and reject changed snapshot metadata
  • expose local-only daemon endpoints for release history and reverts
  • reject Homebrew-managed installs, draft releases, and prereleases

Why

The updater could only move installations forward. A broken release required manual binary replacement and left config compatibility to the user. This adds a controlled downgrade path and restores the config captured before the original upgrade by default.

User impact

Users can select an older stable release in Settings or through the CLI. The confirmation shows the checkpoint date. They can keep the current config with an explicit compatibility warning. Restarting the daemon still ends active terminal sessions.

Validation

  • cargo test -p okena-core profiles --lib (25 passed)
  • cargo test -p okena-ext-updater --no-default-features (5 passed)
  • cargo test -p okena-cli parser --lib (3 passed)
  • restart handoff unit test (1 passed)
  • cargo check --workspace
  • cargo check -p okena-ext-updater
  • cargo clippy -p okena-core -p okena-ext-updater -p okena-remote-server -p okena-cli --all-features --no-deps -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

A live end-to-end revert was not run because it would replace the active binaries and profile config and terminate active terminal sessions.

matej21and others added 2 commits August 10, 2026 16:20
Review follow-ups on the version revert flow.
- Keep the `.old` binary while a config restore is pending. Every daemon boot
ran `cleanup_old_binary()`, so any restart between install and handoff (idle
exit, reboot, `update revert` without `--restart`) deleted the only binary
that understands the handoff flags: the restore was skipped and every later
`/v1/restart` failed on the missing helper.
- Fall back to a plain restart when the helper is gone anyway, dropping the
pending request instead of wedging restarts permanently.
- Start the reverted daemon even when the restore fails. `?` in the handoff path
exited the process, and the bail paths left the pending file in place, so the
failure repeated on every restart and left no daemon running.
- Prune revert targets and pre-revert safety copies as separate buckets. Both
shared one MAX_SNAPSHOTS budget, so a few reverts evicted the version
snapshots those reverts need.
- Return 409 from `POST /v1/update/revert` when a manual operation is already
active. It answered 200 without starting anything, and the caller waited for a
transition that never came.
- Warn in the status bar that the restart also restarts the daemon and ends
terminal sessions, matching the settings pane.
- Bound the CLI wait at 15 minutes and bail after 15s of an unreachable daemon.
- Restore the "release exists but has no asset" warning lost in the refactor.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i6mMQSwQtJ75RGLBC2z4T
@matej21
matej21 marked this pull request as ready for review August 10, 2026 15:54
@matej21
matej21 merged commit 9f3fa07 into mainAug 10, 2026
8 checks passed
@matej21
matej21 deleted the agent/version-revert branch August 10, 2026 16:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@matej21