fix: tri-state check_for_updates() to prevent blocking updates on inconclusive checks

Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/6bdd26ad-7b2f-455c-8b34-6be3de48bd9a

Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-12 12:58:42 +00:00
committed by GitHub
parent 57de0d31a7
commit 536b3bfa78

View File

@@ -515,12 +515,12 @@ def _get_remote_rev(branch=None):
return None
def check_for_updates() -> bool:
def check_for_updates() -> bool | None:
locked_rev, branch = _get_locked_info()
remote_rev = _get_remote_rev(branch)
if locked_rev and remote_rev:
return locked_rev != remote_rev
return False
return None # inconclusive — couldn't read lock or reach remote
# ── IP helpers ───────────────────────────────────────────────────
@@ -2360,7 +2360,8 @@ async def api_ports_health():
async def api_updates_check():
loop = asyncio.get_event_loop()
available = await loop.run_in_executor(None, check_for_updates)
return {"available": available}
# None means inconclusive (check failed) — report as available so the UI doesn't block
return {"available": available is not False}
@app.post("/api/reboot")
@@ -2396,7 +2397,7 @@ async def api_updates_run():
pass
available = await loop.run_in_executor(None, check_for_updates)
if not available:
if available is False: # only block when positively confirmed no updates
# Clear stale status/log so they don't contaminate future modal opens.
_write_update_status("IDLE")
try: