Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix: require human UI action for desktop restart

rubenluetke10-beep164c2897b798
diff --git a/AGENTS.md b/AGENTS.md
index 19c8149611..46d1e0c8bf 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -65,8 +65,10 @@ on unpinned libs; signing private keys ONLY in GH Actions secrets; no silent
## 9. Operational reality & git
Working tree is SHARED: stage only YOUR files (`git add -p`/pathspec, never
`git add -A`/`.`); auto-commit each logical step (Conventional Commits); never
-push automatically; never commit secrets. App restart =
-`POST /api/settings/restart-app`, for PYTHON-side changes only; desktop WebView
+push automatically; never commit secrets. **Coding agents NEVER restart, quit,
+kill, or relaunch the desktop app** (no restart API/CLI, `Stop-Process`, or
+equivalent). If Python changes need a restart, explain why and let the maintainer
+click Restart in the desktop UI. The desktop WebView
has no F5/console — frontend fix = `npm run build` in
`jarvis/ui/web/frontend/`, nothing else: open windows reload themselves
(`src/lib/bundleWatch.ts`). Never end a frontend change by asking for a restart.
diff --git a/CLAUDE.md b/CLAUDE.md
index 19c8149611..46d1e0c8bf 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -65,8 +65,10 @@ on unpinned libs; signing private keys ONLY in GH Actions secrets; no silent
## 9. Operational reality & git
Working tree is SHARED: stage only YOUR files (`git add -p`/pathspec, never
`git add -A`/`.`); auto-commit each logical step (Conventional Commits); never
-push automatically; never commit secrets. App restart =
-`POST /api/settings/restart-app`, for PYTHON-side changes only; desktop WebView
+push automatically; never commit secrets. **Coding agents NEVER restart, quit,
+kill, or relaunch the desktop app** (no restart API/CLI, `Stop-Process`, or
+equivalent). If Python changes need a restart, explain why and let the maintainer
+click Restart in the desktop UI. The desktop WebView
has no F5/console — frontend fix = `npm run build` in
`jarvis/ui/web/frontend/`, nothing else: open windows reload themselves
(`src/lib/bundleWatch.ts`). Never end a frontend change by asking for a restart.
diff --git a/docs/agent-contract.md b/docs/agent-contract.md
index f15c611b78..a5ee8ae23a 100644
--- a/docs/agent-contract.md
+++ b/docs/agent-contract.md
@@ -468,9 +468,14 @@ Detail in [`docs/BUGS.md`](BUGS.md):
(`git add -p` / pathspec-scoped). A large uncommitted diff is normal. On a
corrupted-looking index/HEAD, recover via temp-index commit + `update-ref`
CAS + safety branch (`git-rescue` on repo-wide disorder).
-- **App restart is `POST /api/settings/restart-app`**, not `Stop-Process`
- (Access Denied under the tray `pythonw.exe`). Editable-install fixes need
- this restart to take effect.
+- **Coding agents NEVER restart, quit, kill, or relaunch the desktop app.** Do
+ not call `POST /api/settings/restart-app`, `jarvis system restart`,
+ `Stop-Process`, or an equivalent process-control path. A task such as
+ "finish", "verify", or "fix it" is not restart approval, and `--yes` is not
+ human presence. When a Python-side change genuinely needs a fresh process,
+ state the reason and let the maintainer click Restart in the desktop UI. The
+ server rejects Control-API/Bearer restart requests so this contract remains
+ fail-closed when a prompt is missed.
- **Jarvis is used as a DESKTOP APP, not a browser tab.** The window is an
embedded WebView (`jarvis/ui/desktop_app.py`) with no address bar, no
reload button and no dev tools, so "press Ctrl+R / F5", "hard-refresh",
@@ -483,10 +488,8 @@ Detail in [`docs/BUGS.md`](BUGS.md):
fresh window against the ones this one is running, and reloads once the
change has settled and the user has stopped typing. **Do not end a frontend
change by asking for a restart**: restarting stops the voice stack and the
- live terminal panes to replace files the window fetches on its own. A
- restart is for Python-side changes (editable install, config, plugins), and
- only there. Running from a browser against `--dev` is a contributor path,
- not the maintainer's.
+ live terminal panes to replace files the window fetches on its own. Running
+ from a browser against `--dev` is a contributor path, not the maintainer's.
- **New worktree:** run `pwsh scripts/preflight.ps1` before writing code;
non-zero exit → fix first (BUG-006/014).
- **Memory:** check `MEMORY.md` (`~/.claude/projects/.../memory/`) before
diff --git a/docs/jarvis-cli-reference.md b/docs/jarvis-cli-reference.md
index 01e17eb250..1f26041682 100644
--- a/docs/jarvis-cli-reference.md
+++ b/docs/jarvis-cli-reference.md
@@ -183,7 +183,7 @@ _Generated from the curated command tree by `scripts/ci/gen_cli_reference.py`
## system
- `jarvis system audio-devices --output --input` — List audio devices, or pick where the voice plays / which mic listens.
-- `jarvis system restart --force --yes --dry-run` — Cleanly restart the desktop app (POST /api/settings/restart-app).
+- `jarvis system restart --force --yes --dry-run` — Refuse a CLI restart; use the desktop UI's explicit Restart action.
- `jarvis system status` — Report server reachability + version (GET /api/control/auth/probe).
## tasks
diff --git a/docs/jarvis-cli.md b/docs/jarvis-cli.md
index cc3d558548..da73ab0dee 100644
--- a/docs/jarvis-cli.md
+++ b/docs/jarvis-cli.md
@@ -94,8 +94,12 @@ the genuinely consequential:
- **Reads** (`GET`) and **reversible mutations** (switch provider, set language,
enable a skill) just run.
- **Destructive** actions — every `DELETE`, plus `config set`, `missions dispatch`,
- `telephony outbound`, `system restart` — refuse unless you pass `--yes` (or set
+ and `telephony outbound` — refuse unless you pass `--yes` (or set
`JARVIS_CLI_ASSUME_YES=1`). A prompt is not an accepted substitute.
+- **Desktop restart is UI-only.** Control/API clients, including
+ `jarvis system restart`, cannot restart the app even with `--yes --force`;
+ the maintainer must click Restart in the desktop UI. This preserves live
+ Agentic-IDE terminals and makes human presence explicit.
- `--dry-run` on any command prints the exact request (method, path, body, whether
auth is attached) and sends nothing — the safe way to inspect before acting.
- Secrets are never accepted as inline arguments; they are read from a hidden
diff --git a/jarvis/cli_ctl/commands/system.py b/jarvis/cli_ctl/commands/system.py
index 247dc94126..c98c87038e 100644
--- a/jarvis/cli_ctl/commands/system.py
+++ b/jarvis/cli_ctl/commands/system.py
@@ -15,55 +15,43 @@ def restart(
False,
"--force",
"-f",
- help="Restart even while missions are running (this kills them).",
+ help="Compatibility flag; CLI/API restart requests remain blocked.",
),
yes: bool = typer.Option(
- False, "--yes", "-y", help="Authorize the restart without a prompt."
+ False,
+ "--yes",
+ "-y",
+ help="Compatibility flag; it is not proof of a user's presence.",
),
dry_run: bool = typer.Option(
False, "--dry-run", help="Print the request and exit without restarting."
),
) -> None:
- """Cleanly restart the desktop app (POST /api/settings/restart-app).
-
- This is the deterministic restart path — use it instead of asking the
- voice/CU layer to 'restart yourself' (which mis-routes to the GUI loop).
-
- A restart kills every in-flight mission, so the server refuses (HTTP 409)
- while missions run and lists them; pass ``--force`` to restart anyway.
- """
+ """Refuse a CLI restart; use the desktop UI's explicit Restart action."""
from jarvis.cli_ctl import safety
- from jarvis.cli_ctl.__main__ import as_json, make_client
-
- if not safety.gate_request(
- "POST", "/api/settings/restart-app",
- assume_yes=yes, dry_run=dry_run, as_json=as_json(),
- ):
+ from jarvis.cli_ctl.__main__ import as_json
+
+ path = (
+ "/api/settings/restart-app?force=true"
+ if force
+ else "/api/settings/restart-app"
+ )
+ if dry_run:
+ safety.gate_request(
+ "POST",
+ path,
+ assume_yes=yes,
+ dry_run=True,
+ as_json=as_json(),
+ )
return # dry run: preview already printed, nothing sent
- try:
- with make_client() as client:
- out = client.request(
- "POST",
- "/api/settings/restart-app",
- params={"force": "true"} if force else None,
- )
- except ApiError as exc:
- if exc.status_code == 409 and isinstance(exc.payload, dict):
- missions = exc.payload.get("missions", []) or []
- lines = [
- f" - {m.get('id')} {(m.get('title') or '').strip() or '(no title)'}"
- for m in missions
- ]
- render.error(
- f"{len(missions)} mission(s) still running — restart refused.\n"
- + "\n".join(lines)
- + "\nRe-run with --force to restart anyway (this kills them)."
- )
- raise typer.Exit(code=1) from exc
- render.error(exc.message)
- raise typer.Exit(code=1) from exc
- render.emit(out or {"restarting": True}, as_json=as_json())
+ render.error(
+ "Desktop restarts require an explicit click in the desktop UI. "
+ "Control API and coding-agent clients are not allowed to restart the app; "
+ "--yes and --force do not override this boundary."
+ )
+ raise typer.Exit(code=1)
@app.command("audio-devices")
diff --git a/jarvis/ui/web/lifecycle_guard.py b/jarvis/ui/web/lifecycle_guard.py
new file mode 100644
index 0000000000..271c5d0eb8
--- /dev/null
+++ b/jarvis/ui/web/lifecycle_guard.py
@@ -0,0 +1,47 @@
+"""Human-presence boundary for desktop restart and quit actions."""
+
+from __future__ import annotations
+
+from typing import Literal
+
+from fastapi import HTTPException, Request
+
+LifecycleAction = Literal["restart", "quit"]
+
+
+def require_interactive_desktop_action(
+ request: Request,
+ *,
+ action: LifecycleAction,
+ require_origin: bool = False,
+) -> None:
+ """Reject lifecycle actions issued by Control-API or non-browser clients.
+
+ The desktop UI uses an HttpOnly session cookie (or trusted loopback browser
+ access) and never sends ``Authorization``. Coding agents and ``jarvis`` CLI
+ clients use the persistent Control-API Bearer, so a Bearer is authoritative
+ evidence that no desktop-UI click authorized this action.
+
+ ``require_origin`` closes the same gap on auth-exempt first-boot onboarding
+ routes: browsers attach Origin to unsafe same-origin requests, while a local
+ shell client does not. SurfaceSecurity validates the value itself before a
+ production request reaches this helper.
+ """
+ headers = getattr(request, "headers", None)
+ authorization = headers.get("authorization", "") if headers is not None else ""
+ origin = headers.get("origin", "") if headers is not None else ""
+ if authorization.strip() or (require_origin and not origin.strip()):
+ raise HTTPException(
+ status_code=403,
+ detail={
+ "error": f"interactive_{action}_required",
+ "message": (
+ f"Desktop {action} actions require an explicit click in the "
+ "desktop UI; Control API and coding-agent clients cannot "
+ f"{action} the app."
+ ),
+ },
+ )
+
+
+__all__ = ["require_interactive_desktop_action"]
diff --git a/jarvis/ui/web/onboarding_routes.py b/jarvis/ui/web/onboarding_routes.py
index 59bf50b336..0819afd69f 100644
--- a/jarvis/ui/web/onboarding_routes.py
+++ b/jarvis/ui/web/onboarding_routes.py
@@ -20,6 +20,8 @@ from jarvis.setup import state as st
from jarvis.setup.onboarding_fastpath import state_payload as _shared_state_payload
from jarvis.setup.onboarding_meta import CURRENT_TERMS_VERSION, read_terms_text
+from .lifecycle_guard import require_interactive_desktop_action
+
log = logging.getLogger(__name__)
router = APIRouter(prefix="/api/onboarding", tags=["onboarding"])
@@ -100,6 +102,9 @@ async def post_decline_terms(request: Request) -> dict:
start shows the gate again. 409 once the Terms are accepted — the gate no
longer exists then, and this endpoint must not double as a kill switch.
"""
+ require_interactive_desktop_action(
+ request, action="quit", require_origin=True
+ )
if _safe_state_payload()["terms"]["accepted"]:
raise HTTPException(status_code=409, detail="terms already accepted")
_schedule_app_shutdown(request)
@@ -140,6 +145,9 @@ def _schedule_fresh_restart(request: Request) -> bool:
@router.post("/complete")
async def post_complete(request: Request) -> dict:
+ require_interactive_desktop_action(
+ request, action="restart", require_origin=True
+ )
st.mark_onboarding_complete(_path())
restarting = _schedule_fresh_restart(request)
return {"ok": True, "restarting": restarting}
diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.py
index 16015f3118..83a6f96f2c 100644
--- a/jarvis/ui/web/settings_routes.py
+++ b/jarvis/ui/web/settings_routes.py
@@ -40,6 +40,8 @@ from jarvis.memory.wiki.integration import get_running_curator
from jarvis.speech.local_models import FASTER_WHISPER_PACKAGE
from jarvis.ui.overlay_styles import OVERLAY_STYLES, normalize_overlay_style
+from .lifecycle_guard import require_interactive_desktop_action
+
if TYPE_CHECKING:
from jarvis.core.config import WikiCuratorConfig
@@ -2181,6 +2183,11 @@ async def restart_app(request: Request, force: bool = False) -> dict[str, object
DesktopApp spawns a detached relauncher and quits ~0.8 s later, so this
request returns 200 first. Returns 503 on a headless host (no window).
+ Control/API callers are rejected even with ``force=true``: a coding agent
+ cannot prove human presence, and restarting destroys every Agentic-IDE
+ terminal in the process. Only an explicit desktop-UI click may enter the
+ restart path.
+
Mission guard: an app restart kills every in-flight mission (the process and
its worker Job-Objects die). That is the dominant cause of "aborted" missions
— a healthy-but-quiet worker looks like a hang, the app gets restarted, and
@@ -2188,9 +2195,10 @@ async def restart_app(request: Request, force: bool = False) -> dict[str, object
during active use, none correlated with system Standby). So unless the caller
passes ``force=true``, a restart while missions run is refused with HTTP 409
and the live mission list, letting the UI/CLI confirm before the kill. This
- protects every restart source at once: TopBar, taskbar settings, the
- ``jarvis-ctl restart`` CLI, and any parallel dev session hitting the endpoint.
+ protects every interactive restart source at once: TopBar and taskbar
+ settings. Control clients are refused before this guard.
"""
+ require_interactive_desktop_action(request, action="restart")
if not force:
kontrollierer = getattr(request.app.state, "kontrollierer", None)
list_running = getattr(kontrollierer, "running_mission_ids", None)
@@ -2267,6 +2275,8 @@ async def restart_unelevated(request: Request, force: bool = False) -> dict[str,
UP: a restart that never returns is worse than the problem being fixed.
Honours the same running-mission guard as ``/restart-app``.
"""
+ require_interactive_desktop_action(request, action="restart")
+
from jarvis.platform.input_isolation import describe_input_isolation
report = describe_input_isolation()
diff --git a/tests/unit/cli_ctl/test_commands_system.py b/tests/unit/cli_ctl/test_commands_system.py
index fb5ad3efd0..7832a1b110 100644
--- a/tests/unit/cli_ctl/test_commands_system.py
+++ b/tests/unit/cli_ctl/test_commands_system.py
@@ -6,12 +6,17 @@ from jarvis.cli_ctl.__main__ import app
runner = CliRunner()
-def test_restart_posts_and_reports(mock_api, monkeypatch):
+def test_restart_is_ui_only_even_with_yes_and_force(mock_api, monkeypatch):
monkeypatch.setenv("JARVISCTL_CONTROL_KEY", "jctl_x")
- mock_api[("POST", "/api/settings/restart-app")] = (200, {"ok": True, "restarting": True})
- res = runner.invoke(app, ["system", "restart", "--yes"])
- assert res.exit_code == 0
- assert "restart" in res.stdout.lower()
+ mock_api[("POST", "/api/settings/restart-app")] = (
+ 200,
+ {"ok": True, "restarting": True},
+ )
+ res = runner.invoke(app, ["system", "restart", "--yes", "--force"])
+ assert res.exit_code == 1
+ output = (res.stdout + res.stderr).lower()
+ assert "desktop ui" in output
+ assert "not allowed" in output
def test_restart_fails_closed_without_yes(mock_api, monkeypatch):
@@ -22,36 +27,13 @@ def test_restart_fails_closed_without_yes(mock_api, monkeypatch):
assert res.exit_code == 1
-def test_restart_on_headless_reports_clean_message(mock_api, monkeypatch):
+def test_restart_dry_run_still_previews_without_sending(mock_api, monkeypatch):
monkeypatch.setenv("JARVISCTL_CONTROL_KEY", "jctl_x")
- mock_api[("POST", "/api/settings/restart-app")] = (
- 503, {"detail": "self-restart unavailable on this host"}
- )
- res = runner.invoke(app, ["system", "restart", "--yes"])
- assert res.exit_code == 1
- assert "unavailable" in (res.stdout + res.stderr).lower()
-
-
-def test_restart_refused_when_missions_running_hints_force(mock_api, monkeypatch):
- """A 409 from the mission guard prints the live missions + the --force hint."""
- monkeypatch.setenv("JARVISCTL_CONTROL_KEY", "jctl_x")
- mock_api[("POST", "/api/settings/restart-app")] = (
- 409,
- {
- "detail": {
- "error": "missions_running",
- "missions": [
- {"id": "019e-aaa", "title": "research US visa rules"},
- {"id": "019e-bbb", "title": "build the dashboard"},
- ],
- }
- },
- )
- res = runner.invoke(app, ["system", "restart", "--yes"])
- assert res.exit_code == 1
+ res = runner.invoke(app, ["system", "restart", "--force", "--dry-run"])
+ assert res.exit_code == 0
out = (res.stdout + res.stderr).lower()
- assert "--force" in out
- assert "research us visa rules" in out # the running mission is named
+ assert "dry_run" in out
+ assert "force=true" in out
def test_audio_devices_lists_without_options(mock_api, monkeypatch):
@@ -110,26 +92,3 @@ def test_audio_devices_puts_picked_devices(monkeypatch):
assert seen["path"] == "/api/settings/audio-devices"
assert "PRO X Gaming Headset" in str(seen["body"])
assert "input_device" not in str(seen["body"])
-
-
-def test_restart_force_flag_sends_force_param(monkeypatch):
- """``--force`` propagates ``force=true`` so the guard lets the restart through."""
- monkeypatch.setenv("JARVISCTL_CONTROL_KEY", "jctl_x")
- seen: dict[str, str] = {}
-
- def handler(request: httpx.Request) -> httpx.Response:
- seen["query"] = request.url.query.decode()
- return httpx.Response(200, json={"ok": True, "restarting": True})
-
- import jarvis.cli_ctl.client as client_mod
-
- real_init = client_mod.JarvisClient.__init__
-
- def patched_init(self, base_url, control_key, **kw):
- kw["transport"] = httpx.MockTransport(handler)
- real_init(self, base_url, control_key, **kw)
-
- monkeypatch.setattr(client_mod.JarvisClient, "__init__", patched_init)
- res = runner.invoke(app, ["system", "restart", "--force", "--yes"])
- assert res.exit_code == 0
- assert "force=true" in seen["query"].lower()
diff --git a/tests/unit/ui/test_input_isolation_route.py b/tests/unit/ui/test_input_isolation_route.py
index d52a207bb6..19351f1156 100644
--- a/tests/unit/ui/test_input_isolation_route.py
+++ b/tests/unit/ui/test_input_isolation_route.py
@@ -113,6 +113,28 @@ class TestRepairRoute:
assert r.json()["unelevated"] is True
assert calls["n"] == 1
+ def test_rejects_control_bearer_before_privilege_or_restart_work(self, pin_report):
+ """The alternate restart path has the same human-presence boundary."""
+ pin_report(
+ _report(blocked=True, reason=InputIsolationReason.ELEVATED, repairable=True)
+ )
+ calls = {"n": 0}
+ desktop = SimpleNamespace(
+ request_unelevated_restart=lambda: (
+ calls.__setitem__("n", calls["n"] + 1) or True,
+ "scheduled",
+ )
+ )
+
+ r = _client(desktop).post(
+ "/api/settings/restart-unelevated?force=true",
+ headers={"Authorization": "Bearer control-client"},
+ )
+
+ assert r.status_code == 403
+ assert r.json()["detail"]["error"] == "interactive_restart_required"
+ assert calls["n"] == 0
+
def test_refuses_when_there_is_nothing_to_repair(self, pin_report):
"""Never restart a healthy app: the button must be inert, not eager."""
pin_report(
diff --git a/tests/unit/ui/test_onboarding_routes.py b/tests/unit/ui/test_onboarding_routes.py
index de720d4f82..99bcd370f7 100644
--- a/tests/unit/ui/test_onboarding_routes.py
+++ b/tests/unit/ui/test_onboarding_routes.py
@@ -19,7 +19,7 @@ def state_dir(tmp_path, monkeypatch):
def client(state_dir):
app = FastAPI()
app.include_router(onboarding_routes.router)
- return TestClient(app)
+ return TestClient(app, headers={"Origin": "http://testserver"})
def test_state_starts_incomplete(client):
@@ -105,6 +105,22 @@ def test_decline_terms_quits_before_acceptance(client, monkeypatch):
assert client.get("/api/onboarding/state").json()["terms"]["accepted"] is False
+def test_decline_terms_rejects_a_non_browser_control_client(client, monkeypatch):
+ calls: list[int] = []
+ monkeypatch.setattr(
+ onboarding_routes, "_schedule_app_shutdown", lambda req: calls.append(1)
+ )
+
+ r = client.post(
+ "/api/onboarding/decline-terms",
+ headers={"Authorization": "Bearer control-client", "Origin": ""},
+ )
+
+ assert r.status_code == 403
+ assert r.json()["detail"]["error"] == "interactive_quit_required"
+ assert calls == []
+
+
def test_decline_terms_409_after_acceptance(client, monkeypatch):
calls: list[int] = []
monkeypatch.setattr(
@@ -167,7 +183,7 @@ def _client_with_desktop(desktop):
app = FastAPI()
app.include_router(onboarding_routes.router)
app.state.desktop_app = desktop
- return TestClient(app)
+ return TestClient(app, headers={"Origin": "http://testserver"})
def test_complete_restarts_fresh_on_desktop(state_dir):
@@ -190,6 +206,41 @@ def test_complete_restarts_fresh_on_desktop(state_dir):
assert completed_when_restart_fired == [True]
+def test_complete_rejects_control_client_without_marking_complete(state_dir):
+ from types import SimpleNamespace
+
+ calls: list[int] = []
+ c = _client_with_desktop(
+ SimpleNamespace(request_restart=lambda: calls.append(1) or True)
+ )
+
+ r = c.post(
+ "/api/onboarding/complete",
+ headers={"Authorization": "Bearer control-client", "Origin": ""},
+ )
+
+ assert r.status_code == 403
+ assert r.json()["detail"]["error"] == "interactive_restart_required"
+ assert calls == []
+ assert c.get("/api/onboarding/state").json()["completed"] is False
+
+
+def test_complete_rejects_originless_shell_client(state_dir):
+ from types import SimpleNamespace
+
+ calls: list[int] = []
+ c = _client_with_desktop(
+ SimpleNamespace(request_restart=lambda: calls.append(1) or True)
+ )
+
+ r = c.post("/api/onboarding/complete", headers={"Origin": ""})
+
+ assert r.status_code == 403
+ assert r.json()["detail"]["error"] == "interactive_restart_required"
+ assert calls == []
+ assert c.get("/api/onboarding/state").json()["completed"] is False
+
+
def test_complete_without_desktop_completes_in_place(client):
r = client.post("/api/onboarding/complete")
assert r.status_code == 200
diff --git a/tests/unit/ui/test_restart_route.py b/tests/unit/ui/test_restart_route.py
index 00230bf625..4c3aeeb66c 100644
--- a/tests/unit/ui/test_restart_route.py
+++ b/tests/unit/ui/test_restart_route.py
@@ -51,6 +51,23 @@ def test_restart_schedules_when_window_present():
assert calls["n"] == 1
+def test_restart_rejects_control_bearer_even_when_forced():
+ """A coding/API client cannot turn ``force`` into fake human presence."""
+ calls = {"n": 0}
+ desktop = SimpleNamespace(
+ request_restart=lambda: calls.__setitem__("n", calls["n"] + 1) or True
+ )
+
+ r = _client(desktop).post(
+ "/api/settings/restart-app?force=true",
+ headers={"Authorization": "Bearer control-client"},
+ )
+
+ assert r.status_code == 403
+ assert r.json()["detail"]["error"] == "interactive_restart_required"
+ assert calls["n"] == 0
+
+
def test_restart_503_without_desktop_app():
r = _client().post("/api/settings/restart-app") # headless: no desktop_app
assert r.status_code == 503