From 6e5863ed488445f8f3e4a6a578b5debc82f38b06 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Apr 2026 04:26:11 +0000 Subject: [PATCH 1/2] Initial plan From 31f1e16a3cca5b45c45b1f746cda2a3cf555c3de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Apr 2026 04:29:11 +0000 Subject: [PATCH 2/2] Fix stale update state causing false Update complete when no updates available Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/1cc7ff30-4a1b-46f7-a20a-2ec0cbdfe291 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/server.py | 14 ++++++++++++++ app/sovran_systemsos_web/static/js/update.js | 1 + 2 files changed, 15 insertions(+) diff --git a/app/sovran_systemsos_web/server.py b/app/sovran_systemsos_web/server.py index ac80ab0..62afed2 100644 --- a/app/sovran_systemsos_web/server.py +++ b/app/sovran_systemsos_web/server.py @@ -2371,12 +2371,26 @@ async def api_updates_run(): """Kick off the detached update systemd unit.""" 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) if status == "RUNNING": return {"ok": True, "status": "already_running"} available = await loop.run_in_executor(None, check_for_updates) 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"} # Clear stale status and log BEFORE starting the unit diff --git a/app/sovran_systemsos_web/static/js/update.js b/app/sovran_systemsos_web/static/js/update.js index 8d70ab7..815756e 100644 --- a/app/sovran_systemsos_web/static/js/update.js +++ b/app/sovran_systemsos_web/static/js/update.js @@ -7,6 +7,7 @@ function openUpdateModal() { apiFetch("/api/updates/check") .then(function(data) { if (!data.available) { + stopUpdatePoll(); _updateLog = ""; _updateLogOffset = 0; _updateFinished = true;