Remove return URL persistence from self-update flow

Replace sessionStorage-based return URL tracking with simple page reload after backend restart. Remove getSavedReturnUrl, saveReturnUrl helper methods and SELF_UPDATE_RETURN_URL_KEY constant. Update tests to verify removal of URL persistence code.

frdel committed Mar 26, 2026 at 09:35 UTC 68ad5aca4623657a16fc1c2c65ca2c0236d6dadb
2 files changed +5 -26
tests/test_self_update_tag_filter.py
+4
@@ -113,7 +113,11 @@ def test_self_update_frontend_uses_preloaded_select():
113 assert "this.selectedTagExistsOnBranch" in content
114 assert 'const response = await fetch("/api/health"' in content
115 assert "if (response.ok && observedBackendUnavailable)" in content
116 + assert "window.location.reload();" in content
117 assert "Waiting for Agent Zero to disconnect before reloading the page." in content
118 + assert "SELF_UPDATE_RETURN_URL_KEY" not in content
119 + assert "saveReturnUrl(" not in content
120 + assert "getSavedReturnUrl(" not in content
121 assert "/api/csrf_token" not in content
122 assert "tagSuggestions" not in content
123 assert "tagDropdownOpen" not in content
webui/components/settings/external/self-update-store.js
+1 -26
@@ -5,7 +5,6 @@ import { openModal, closeModal } from "/js/modals.js";
5
6 const HEALTH_POLL_INTERVAL_MS = 2000;
7 const HEALTH_WAIT_BUFFER_MS = 30000;
8 -const SELF_UPDATE_RETURN_URL_KEY = "a0:self-update:return-url";
8 const SELF_UPDATE_OVERLAY_ID = "self-update-progress-overlay";
9 const SELF_UPDATE_MODAL_PATH = "settings/external/self-update-modal.html";
10 const SELF_UPDATE_MANUAL_BACKUP_MODAL_PATH = "settings/backup/backup_restore.html";
@@ -129,26 +128,6 @@ const model = {
128 return `${branch || "main"} / ${tag || "None"}`;
129 },
130
132 - getSavedReturnUrl() {
133 - try {
134 - return sessionStorage.getItem(SELF_UPDATE_RETURN_URL_KEY) || "";
135 - } catch {
136 - return "";
137 - }
138 - },
139 -
140 - saveReturnUrl(url = "") {
141 - try {
142 - if (url) {
143 - sessionStorage.setItem(SELF_UPDATE_RETURN_URL_KEY, url);
144 - } else {
145 - sessionStorage.removeItem(SELF_UPDATE_RETURN_URL_KEY);
146 - }
147 - } catch {
148 - // ignore storage errors
149 - }
150 - },
151 -
131 getProgressOverlay() {
132 return document.getElementById(SELF_UPDATE_OVERLAY_ID);
133 },
@@ -446,7 +425,6 @@ const model = {
425 undefined,
426 true,
427 );
449 - this.saveReturnUrl(window.location.href);
428 await this.restartAndReload();
429 } catch (error) {
430 console.error("Failed to schedule self-update:", error);
@@ -506,9 +484,7 @@ const model = {
484 cache: "no-store",
485 });
486 if (response.ok && observedBackendUnavailable) {
509 - const returnUrl = this.getSavedReturnUrl() || window.location.href;
510 - this.saveReturnUrl("");
511 - window.location.replace(returnUrl);
487 + window.location.reload();
488 return;
489 }
490 if (response.ok) {
@@ -544,7 +520,6 @@ const model = {
520
521 this.restarting = false;
522 this.removeProgressOverlay();
547 - this.saveReturnUrl("");
523 this.error =
524 "Agent Zero did not come back within the expected window. It may still be rolling back. " +
525 (lastError ? `Last health check error: ${lastError}` : "");