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): show the sign-in Chrome whole and without outside extensions

rubenluetke10-beepee0345440129
diff --git a/jarvis/society/browser/live_runner.py b/jarvis/society/browser/live_runner.py
index e18035d62d..aed4aa1602 100644
--- a/jarvis/society/browser/live_runner.py
+++ b/jarvis/society/browser/live_runner.py
@@ -177,6 +177,8 @@ class Worker:
ignore_default_args=["about:blank"] if self.login_mode else None,
args=[
"--remote-debugging-port=0", "--remote-debugging-address=127.0.0.1",
+ # Stopping the worker ends Chrome without a clean exit.
+ "--hide-crash-restore-bubble",
# Explicit handback resumes the tabs the person just used.
*(["--restore-last-session"] if self.login_mode else []),
],
diff --git a/jarvis/society/browser/manual_chrome.py b/jarvis/society/browser/manual_chrome.py
index 91f6037815..75f022d65c 100644
--- a/jarvis/society/browser/manual_chrome.py
+++ b/jarvis/society/browser/manual_chrome.py
@@ -333,10 +333,16 @@ class PlainChrome:
raise RuntimeError("The login browser is already open; close it before reopening")
_validate_executable(self.profile, Path(self.executable))
# Keep spawn and ownership assignment atomic against cancellation.
+ # Chrome Sync installs the person's extensions into this profile;
+ # an AI browser extension would let outside tools drive the shared
+ # logged-in browser, so the sign-in window runs extension-free like
+ # the agent browser. The browser worker ends Chrome without a clean
+ # exit, which must not greet each sign-in with a restore prompt.
self.process = subprocess.Popen( # noqa: ASYNC220
[self.executable, f"--user-data-dir={self.profile.resolve()}", "--new-window",
"--no-first-run", "--disable-background-mode",
- "--disable-backgrounding-occluded-windows", "chrome://newtab/"],
+ "--disable-backgrounding-occluded-windows", "--disable-extensions",
+ "--hide-crash-restore-bubble", "chrome://newtab/"],
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
creationflags=self.creationflags,
)
diff --git a/jarvis/society/browser/native_window.py b/jarvis/society/browser/native_window.py
index a0bd50fc22..5db2d09765 100644
--- a/jarvis/society/browser/native_window.py
+++ b/jarvis/society/browser/native_window.py
@@ -905,7 +905,7 @@ class NativeWindow:
self._check_owner()
# Moving far offscreen breaks Chrome's monitor-clamped profile and
# login bubbles. HWND_BOTTOM does not activate or move the browser.
- flags, x, y = 0x213, 0, 0
+ flags = 0x213
c = self.ctypes
class MonitorInfo(c.Structure):
@@ -922,9 +922,21 @@ class NativeWindow:
raise RuntimeError("Chrome monitor geometry is unavailable")
left, top, right, bottom = self._bounds(self.hwnd)
work = info.rcWork
- if right <= work.left or left >= work.right or bottom <= work.top or top >= work.bottom:
- # Older versions persisted the -16000 parking position in the
- # Chrome profile. Recover that position without activating it.
- x, y, flags = work.left, work.top, flags & ~0x2
- if not u.SetWindowPos(self.hwnd, 1, x, y, 0, 0, flags):
+ work_width, work_height = work.right - work.left, work.bottom - work.top
+ width, height = right - left, bottom - top
+ # Chrome restores its saved placement. Older parking positions and
+ # crashed sessions leave thin strips or windows partly offscreen:
+ # the preview then shows a sliver and menus clamp away from it.
+ if width < min(work_width, 1024) or height < min(work_height, 720):
+ width = min(work_width, max(width, round(work_width * 0.75)))
+ height = min(work_height, max(height, round(work_height * 0.75)))
+ flags &= ~0x1
+ width, height = min(width, work_width), min(height, work_height)
+ x = max(work.left, min(left, work.right - width))
+ y = max(work.top, min(top, work.bottom - height))
+ if (x, y) != (left, top):
+ flags &= ~0x2
+ if (width, height) != (right - left, bottom - top):
+ flags &= ~0x1
+ if not u.SetWindowPos(self.hwnd, 1, x, y, width, height, flags):
raise RuntimeError("The Chrome window could not be placed in the background")
diff --git a/tests/unit/society/test_manual_chrome.py b/tests/unit/society/test_manual_chrome.py
index 10c5c76975..052d6eec38 100644
--- a/tests/unit/society/test_manual_chrome.py
+++ b/tests/unit/society/test_manual_chrome.py
@@ -159,7 +159,8 @@ async def test_plain_login_uses_owned_profile_and_no_automation_transport(login)
assert args == [
instance.executable, f"--user-data-dir={instance.profile.resolve()}", "--new-window",
"--no-first-run", "--disable-background-mode",
- "--disable-backgrounding-occluded-windows", "chrome://newtab/",
+ "--disable-backgrounding-occluded-windows", "--disable-extensions",
+ "--hide-crash-restore-bubble", "chrome://newtab/",
]
assert options["creationflags"] == 0x08000000
assert options["stdin"] == options["stdout"] == options["stderr"] == subprocess.DEVNULL
diff --git a/tests/unit/society/test_native_browser_window.py b/tests/unit/society/test_native_browser_window.py
index a1efb6b30c..07ad1823a2 100644
--- a/tests/unit/society/test_native_browser_window.py
+++ b/tests/unit/society/test_native_browser_window.py
@@ -293,6 +293,7 @@ def test_frame_resizing_scales_popup_hit_coordinates(scene):
def test_parking_preserves_monitor_geometry_and_does_not_activate(scene):
window, desktop, _codec = scene
+ desktop.windows[1]["rect"] = (100, 50, 1400, 900)
window.park()
args = desktop.positions[-1]
assert args[:2] == (1, 1) # Owned Chrome, HWND_BOTTOM.
@@ -304,9 +305,28 @@ def test_old_offscreen_parking_position_is_recovered_without_activation(scene):
desktop.windows[1]["rect"] = (-16000, -16000, -15900, -15920)
window.park()
args = desktop.positions[-1]
- assert args[2:4] == (0, 0)
- assert args[-1] & 0x2 == 0 # Move back onto its nearest monitor.
- assert args[-1] & 0x11 == 0x11 # Preserve size and foreground focus.
+ assert args[2:6] == (0, 0, 1440, 810) # Back on the monitor at a usable size.
+ assert args[-1] & 0x3 == 0
+ assert args[-1] & 0x10 == 0x10 # Preserve foreground focus.
+
+
+def test_thin_partly_offscreen_window_is_restored_fully_onto_the_monitor(scene):
+ window, desktop, _codec = scene
+ # A crashed session restored Chrome as a 300 px strip hanging off the left edge.
+ desktop.windows[1]["rect"] = (-1872, 700, 45, 1000)
+ window.park()
+ x, y, width, height, flags = desktop.positions[-1][2:]
+ assert (x, y) == (0, 270) and (width, height) == (1917, 810)
+ assert flags & 0x3 == 0 and flags & 0x10 == 0x10
+
+
+def test_large_window_partly_offscreen_moves_without_resizing(scene):
+ window, desktop, _codec = scene
+ desktop.windows[1]["rect"] = (-200, 100, 1400, 1000)
+ window.park()
+ x, y, width, height, flags = desktop.positions[-1][2:]
+ assert (x, y, width, height) == (0, 100, 1600, 900)
+ assert flags & 0x2 == 0 and flags & 0x1 == 0x1
def test_event_hooks_and_com_thread_are_released_once(scene, monkeypatch):