Skip to content

feat(upgrade): autonomous nightly auto-update + auto-restart - #6

Merged
nirhemo merged 1 commit into
mainfrom
feat/auto-update
Jul 8, 2026
Merged

feat(upgrade): autonomous nightly auto-update + auto-restart#6
nirhemo merged 1 commit into
mainfrom
feat/auto-update

Conversation

@nirhemo

@nirhemo nirhemo commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Makes ATLAS self-updating: the nightly upgrade_cycle job can now apply updates and restart itself, so new code lands with zero clicks.

Behavior

  • upgrade.auto_apply: true → the nightly job applies an available update via the existing safe path: backup → git reset --hard origin/main → health-check (pytest) → auto-rollback on failure. Per-user data is never touched.
  • upgrade.auto_restart: true + ATLAS_SUPERVISED (set by the LaunchAgent) → the job exits so launchd (KeepAlive) respawns ATLAS on the new code.
  • Both are off by default (opt-in). With auto_apply off, the job just records that an update is available for the Owner to apply from the HUD Upgrade pane (unchanged behavior).

Why gated + supervised

  • Auto-applying code is opt-in so a fresh public clone never pulls unexpectedly.
  • Auto-restart only fires under a supervisor (launchd) — otherwise the process would exit and stay down.
  • The updater's health-check + rollback is the safety net: a bad update reverts automatically.

Tests

45 passing offline (+3): up-to-date no-op, check-only when the switch is off, and applies-with-confirm when on (no real git/restart — updater + settings are monkeypatched).

🤖 Generated with Claude Code

The nightly upgrade_cycle job now, when enabled, applies updates and restarts:
- upgrade.auto_apply=true  -> apply the update (backup -> health-check ->
  auto-rollback on failure; user data never touched).
- upgrade.auto_restart=true + ATLAS_SUPERVISED (the LaunchAgent) -> exit so
  launchd (KeepAlive) respawns on the new code.
- Both are OFF by default (opt-in). When auto_apply is off the job only records
  that an update is available for the Owner to apply from the HUD Upgrade pane.

Tests: 45 passing offline (+3: up-to-date noop, check-only when off, apply when on).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nirhemo
nirhemo merged commit f98923f into main Jul 8, 2026
3 checks passed
@nirhemo
nirhemo deleted the feat/auto-update branch July 8, 2026 12:19
Sign up for free to 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