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(open_app): also maximize an already-running window brought to the front

Ruben Lütke3811c192a126
diff --git a/jarvis/plugins/tool/open_app.py b/jarvis/plugins/tool/open_app.py
index 2e987fcea4..2a26465242 100644
--- a/jarvis/plugins/tool/open_app.py
+++ b/jarvis/plugins/tool/open_app.py
@@ -335,6 +335,22 @@ class OpenAppTool:
focused, _msg = await asyncio.to_thread(
window_state.raise_window, running,
)
+ if focused:
+ # ALSO maximize the already-open window (user
+ # request 2026-07-23: an app Jarvis brings up must
+ # fill the screen, not stay tiny — the live case was
+ # a small Chrome that was already running, so the
+ # fresh-launch maximize never applied). Same-monitor
+ # only; a fixed dialog / Wayland / headless is left
+ # as-is. Best-effort — never fails the focus. This is
+ # narrower than the CU-wide normalize_window the
+ # maintainer disabled 2026-07-02 (which zoomed EVERY
+ # foreground window mid-mission): here it is scoped to
+ # the ONE app open_app was explicitly asked to bring
+ # up.
+ await asyncio.to_thread(
+ window_state.maximize_window, running,
+ )
except TimeoutError:
focused = False
logger.warning(
diff --git a/tests/unit/plugins/tool/test_open_app_reuse.py b/tests/unit/plugins/tool/test_open_app_reuse.py
index bbf0c105e2..a4e2e41e7e 100644
--- a/tests/unit/plugins/tool/test_open_app_reuse.py
+++ b/tests/unit/plugins/tool/test_open_app_reuse.py
@@ -40,6 +40,9 @@ def _stub_launch(monkeypatch) -> list:
)
monkeypatch.setattr(oa.subprocess, "Popen", lambda *a, **k: calls.append((a, k)))
monkeypatch.setattr(oa.window_state, "raise_after_launch", lambda n, **k: (False, ""))
+ # Stub maximize to a fast no-op so the reuse-path tests stay deterministic
+ # and host-independent; tests that assert on it re-stub it.
+ monkeypatch.setattr(oa.window_state, "maximize_window", lambda w: (True, "maximized"))
return calls
@@ -57,6 +60,38 @@ async def test_focuses_when_already_running(monkeypatch):
assert raised # hardened raise was attempted on the existing window
+async def test_already_running_window_is_also_maximized(monkeypatch):
+ # The live case: Chrome is already open but small. Bringing it to the front
+ # must ALSO maximize it so it fills the screen (user request 2026-07-23).
+ calls = _stub_launch(monkeypatch)
+ running = WindowInfo("New Tab - Google Chrome", handle=555)
+ monkeypatch.setattr(oa.window_state, "is_app_running", lambda n: running)
+ monkeypatch.setattr(oa.window_state, "raise_window", lambda w: (True, w.title))
+ maximized: list = []
+ monkeypatch.setattr(
+ oa.window_state, "maximize_window",
+ lambda w: (maximized.append(w), (True, "maximized"))[1],
+ )
+ res = await OpenAppTool().execute({"app_name": "chrome"}, _ctx())
+ assert res.success is True
+ assert calls == [] # never launched a second instance
+ assert maximized == [running], "the focused running window must be maximized"
+
+
+async def test_already_running_maximize_failure_keeps_success(monkeypatch):
+ # A maximize miss (fixed dialog / Wayland / no handle) must NOT flip the
+ # focus result — the app was still brought to the front.
+ _stub_launch(monkeypatch)
+ monkeypatch.setattr(
+ oa.window_state, "is_app_running", lambda n: WindowInfo("OBS 30", handle=1)
+ )
+ monkeypatch.setattr(oa.window_state, "raise_window", lambda w: (True, w.title))
+ monkeypatch.setattr(oa.window_state, "maximize_window", lambda w: (False, "no box"))
+ res = await OpenAppTool().execute({"app_name": "obs"}, _ctx())
+ assert res.success is True
+ assert "already running" in (res.output or "").lower()
+
+
async def test_launches_when_not_running(monkeypatch):
calls = _stub_launch(monkeypatch)
monkeypatch.setattr(oa.window_state, "is_app_running", lambda n: None)