emrg: auto-upgrade refactor — agent-driven local equivalent install replaces installer download - #882
Conversation
…eplaces installer download (rant 2026-08-20T12:33:59)
…t daemon startup (test-stability fix for #882)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (20260820-143019)
Reviewed the full diff on head bc73e7f:
- emrg/server/upgrade.py — UpgradeManager logic matches the rant design: 5-min hard-coded tick, GitHub releases query, delay filter picks the newest eligible tag, in-flight re-entry guard, silent skips for disabled / local==target / network failure, prompt rendered from template.
- emrg/server/daemon.py — _update_check_loop fully replaced by _upgrade_tick_loop; first tick delayed one interval (no GitHub API at daemon startup); _run_upgrade_session reuses TaskRequest + session queueing; shutdown cleanup updated.
- emrg/config.py — UpdateConfig check/ttl_hours/auto_download removed → enabled/delay_minutes (host decision A: minutes granularity).
- emrg/server/prompts/upgrade_prompt.j2 — prepare clone → understand installer logic → equivalent install → backup/rollback → do-not-restart-daemon (consistent with the MANIFESTO server-integrity principle) → safety boundaries.
- GUI + TUI cleanup — updateCheck/updateCheckPrompted/updateInstall IPC, about-update UI, dialogs, i18n keys and smoke tests all removed consistently; TUI startup update_check prompt removed.
- tests — tests/test_upgrade.py 13 tests cover parse_version (incl. prerelease suffix), delay filter, local==target no-trigger, config-disabled, network-failure silence, in-flight guard, daemon session runner and residual-reference check; test_daemon.py updated (shutdown test now asserts upgrade-tick loop).
- Deleted emrg/update_check.py + tests/test_update_check.py — no residual references (guard test exempts emrg/skills/installer.py's unrelated run_update_check_once).
Net −825 lines. Local: test_upgrade.py + test_daemon.py 102 passed, tree clean. CI: run 32338995031 — test PASS (1m35s) + test-windows PASS (53s); mergeState CLEAN.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (20260820-143548) — fresh per-cycle re-review
Re-verified head bc73e7f (unchanged since LGTM #1): same 17-file diff (715+/1540−), core upgrade.py logic confirmed — releases list per_page=30 (delay filtering needs every published_at), parse_version terminates on first non-digit piece (prerelease never newer), 5-min hard-coded tick, in-flight re-entry guard, silent skips, template-driven agent session. CI run 32338995031: test PASS (1m35s) + test-windows PASS (53s); mergeState CLEAN. 2/3 LGTMs.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (20260820-150026) — fresh per-cycle re-review
Re-verified head bc73e7f (unchanged since LGTMs #1/#2): 17-file diff (715+/1540−), core upgrade.py confirmed — host-design boundaries verbatim (no installer download, agent-driven local equivalent install, program only triggers via releases API → delay-filter → version compare → template-driven agent session, in-flight re-entry guard only), parse_version terminates on prerelease suffix. CI run 32338995031: test PASS + test-windows PASS; mergeState CLEAN. 3/3 LGTMs.
Summary
Rant 2026-08-20T12:33:59 (host design finalized point-by-point): the automatic
upgrade mechanism is rebuilt — no installer download anymore. The program
only triggers; the agent performs a local equivalent install from the
evolution repo clone.
Changes
emrg/server/upgrade.py—UpgradeManager(all program-side logic):per_page=30), delay-filter (published_at ≤ now − delay_minutes), newest eligible tag wins~/.emrg/install/version.txt; triggers an agent session (emrg-upgrade) when a newer eligible tag existsparse_version/is_newermigrated from the deletedupdate_check.pyemrg/server/prompts/upgrade_prompt.j2— agent install instructions: clone/fetch → checkout tag → read source to understand the installer logic → equivalent install (source/lib/version.txt/bin/GUI as needed) → backup/rollback → do NOT restart the daemon (host restarts manually) → MANIFESTO red-line compliance (no stop/restart paths).emrg/config.py—UpdateConfigrewritten toenabled/delay_minutes(oldcheck/ttl_hours/auto_downloadremoved).emrg/server/daemon.py— old update-check loop / auto-download / wsupdate_check+update_check_promptedhandlers removed; registers the 5-minute upgrade tick; provides the public_run_upgrade_sessionrunner (reuses session queueing semantics, headless — no client connection needed).emrg/update_check.py+tests/test_update_check.py(whole old mechanism).emrg:updateCheck/updateInstall/updateCheckPrompted),update_downloadedbroadcast handling and i18n keys removed.tests/test_upgrade.py(13 tests): delay filter takes newest eligible tag, local==target no-trigger, enabled=false skip, network failure silent, in-flight guard, config defaults/loading, daemon session-runner integration, and a residual-reference scan (noupdate_check/ttl_hours/auto_downloadleft).Verification
emrg --help: OK