Merge pull request #194 from naturallaw777/copilot/fix-update-system-ux-issue

Fix false "Update complete" + Reboot button when no updates are available
This commit is contained in:
Sovran_Systems
2026-04-11 23:30:26 -05:00
committed by GitHub
2 changed files with 15 additions and 0 deletions

View File

@@ -2371,12 +2371,26 @@ async def api_updates_run():
"""Kick off the detached update systemd unit.""" """Kick off the detached update systemd unit."""
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
# Recover any stale RUNNING state before checking, so a leftover status
# file from a previous (now-inactive) update unit doesn't cause a false
# already_running response that sends the frontend into a stale-log poll.
await loop.run_in_executor(
None, _recover_stale_status, UPDATE_STATUS, UPDATE_LOG, UPDATE_UNIT
)
status = await loop.run_in_executor(None, _read_update_status) status = await loop.run_in_executor(None, _read_update_status)
if status == "RUNNING": if status == "RUNNING":
return {"ok": True, "status": "already_running"} return {"ok": True, "status": "already_running"}
available = await loop.run_in_executor(None, check_for_updates) available = await loop.run_in_executor(None, check_for_updates)
if not available: if not available:
# Clear stale status/log so they don't contaminate future modal opens.
_write_update_status("IDLE")
try:
with open(UPDATE_LOG, "w") as f:
f.write("")
except OSError:
pass
return {"ok": True, "status": "no_updates"} return {"ok": True, "status": "no_updates"}
# Clear stale status and log BEFORE starting the unit # Clear stale status and log BEFORE starting the unit

View File

@@ -7,6 +7,7 @@ function openUpdateModal() {
apiFetch("/api/updates/check") apiFetch("/api/updates/check")
.then(function(data) { .then(function(data) {
if (!data.available) { if (!data.available) {
stopUpdatePoll();
_updateLog = ""; _updateLog = "";
_updateLogOffset = 0; _updateLogOffset = 0;
_updateFinished = true; _updateFinished = true;