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(browser): keep restored tabs selected during handback

rubenluetke10-beepdddf7930f481
diff --git a/jarvis/society/browser/live_runner.py b/jarvis/society/browser/live_runner.py
index 6a3de1ecda..e18035d62d 100644
--- a/jarvis/society/browser/live_runner.py
+++ b/jarvis/society/browser/live_runner.py
@@ -172,6 +172,9 @@ class Worker:
viewport={"width": 1280, "height": 800},
accept_downloads=True,
service_workers="block",
+ # Playwright's extra blank startup tab would take focus from
+ # the session Chrome restores after explicit handback.
+ ignore_default_args=["about:blank"] if self.login_mode else None,
args=[
"--remote-debugging-port=0", "--remote-debugging-address=127.0.0.1",
# Explicit handback resumes the tabs the person just used.
diff --git a/tests/contract/test_browser_live.py b/tests/contract/test_browser_live.py
index a16a7ca9e8..3605a8a511 100644
--- a/tests/contract/test_browser_live.py
+++ b/tests/contract/test_browser_live.py
@@ -140,7 +140,12 @@ def live(tmp_path, monkeypatch):
def diagnostic_env(*args, **kwargs):
return {**worker_env(*args, **kwargs), "PYTHONFAULTHANDLER": "1"}
+ async def diagnostic_stderr(session):
+ while chunk := await session.proc.stderr.read(8192):
+ session.stderr_tail = (session.stderr_tail + chunk.decode("utf-8", "replace"))[-32768:]
+
monkeypatch.setattr(install, "worker_env", diagnostic_env)
+ monkeypatch.setattr("jarvis.society.browser.live.LiveSession.drain_stderr", diagnostic_stderr)
python = Path(os.environ["JARVIS_BROWSER_TEST_PYTHON"])
binary = Path(os.environ["JARVIS_BROWSER_TEST_EXECUTABLE"])
monkeypatch.setattr(install, "is_installed", lambda _: True)
@@ -167,7 +172,8 @@ async def _control(live, session, owner, op, args):
await asyncio.sleep(0.05) # Let the independent stderr reader drain its last chunk.
raise AssertionError(
f"{op}: {exc}; worker_exit={session.proc.returncode}; "
- f"worker_stderr={session.stderr_tail[-5000:]}"
+ f"worker_stderr_start={session.stderr_tail[:6000]}; "
+ f"worker_stderr_end={session.stderr_tail[-3000:]}"
) from exc
diff --git a/tests/unit/society/test_browser_login_worker.py b/tests/unit/society/test_browser_login_worker.py
index 239adf954a..38cb171a67 100644
--- a/tests/unit/society/test_browser_login_worker.py
+++ b/tests/unit/society/test_browser_login_worker.py
@@ -341,6 +341,7 @@ async def test_startup_reuses_durable_chrome_pin_and_never_falls_back_if_invalid
assert pw.launches[0][0] == str(profile)
assert pw.launches[0][1]["executable_path"] == (pinned or "testing-chrome.exe")
assert ("--restore-last-session" in pw.launches[0][1]["args"]) is handback
+ assert pw.launches[0][1]["ignore_default_args"] == (["about:blank"] if handback else None)
assert result["login_mode"] is handback and not result["login_available"]