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(ci): wait for browser navigation before stream checks

rubenluetke10-beep36839c40ca1b
diff --git a/.github/workflows/installer-smoke.yml b/.github/workflows/installer-smoke.yml
index 6a8119fd6e..1ddc530c65 100644
--- a/.github/workflows/installer-smoke.yml
+++ b/.github/workflows/installer-smoke.yml
@@ -357,6 +357,8 @@ jobs:
- name: Resolve target tag
id: tag
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
INPUT_TAG="${{ inputs.tag }}"
@@ -369,6 +371,7 @@ jobs:
# returns 404 if there are no releases yet — we treat that
# as a "skip" condition, not a failure.
HTTP=$(curl -s -o /tmp/resp.json -w "%{http_code}" \
+ -H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest")
diff --git a/jarvis/society/browser/manual_chrome.py b/jarvis/society/browser/manual_chrome.py
index 66494cb3ad..91f6037815 100644
--- a/jarvis/society/browser/manual_chrome.py
+++ b/jarvis/society/browser/manual_chrome.py
@@ -335,7 +335,8 @@ class PlainChrome:
# Keep spawn and ownership assignment atomic against cancellation.
self.process = subprocess.Popen( # noqa: ASYNC220
[self.executable, f"--user-data-dir={self.profile.resolve()}", "--new-window",
- "--no-first-run", "--disable-background-mode", "chrome://newtab/"],
+ "--no-first-run", "--disable-background-mode",
+ "--disable-backgrounding-occluded-windows", "chrome://newtab/"],
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
creationflags=self.creationflags,
)
diff --git a/tests/contract/test_browser_live.py b/tests/contract/test_browser_live.py
index 3605a8a511..b347250fdb 100644
--- a/tests/contract/test_browser_live.py
+++ b/tests/contract/test_browser_live.py
@@ -68,9 +68,22 @@ def test_actual_browser_click_emits_pointer_telemetry(tmp_path):
class PageHandler(BaseHTTPRequestHandler):
profile_requests = []
page_requests = []
+ requests_ready = threading.Condition()
def do_GET(self):
- self.page_requests.append(self.path)
+ try:
+ self._respond()
+ finally:
+ with self.requests_ready:
+ self.page_requests.append(self.path)
+ self.requests_ready.notify_all()
+
+ @classmethod
+ def wait_for_path(cls, path):
+ with cls.requests_ready:
+ return cls.requests_ready.wait_for(lambda: path in cls.page_requests, timeout=15)
+
+ def _respond(self):
if self.path.startswith(("/login", "/account")):
signed_in = "fixture_session=verified" in self.headers.get("Cookie", "")
self.profile_requests.append((self.path, signed_in))
@@ -177,15 +190,28 @@ async def _control(live, session, owner, op, args):
) from exc
+async def _open_animation_and_hand_back(live, session, queue, site):
+ await _control(live, session, "viewer", "takeover", {"enabled": True})
+ await _control(live, session, "viewer", "navigate", {"url": site})
+ # Native navigation acknowledges input, not page load. Handing back at
+ # that point can close Chrome before it has navigated away from New Tab.
+ assert await asyncio.to_thread(PageHandler.wait_for_path, "/"), "Fixture page did not load"
+ await _control(live, session, "viewer", "takeover", {"enabled": False})
+ async with asyncio.timeout(15):
+ while True:
+ event = await queue.get()
+ if (event["kind"] == "state" and not event["manual"]
+ and event["url"].rstrip("/") == site):
+ return
+
+
async def test_live_pixels_change_between_tasks_and_sessions_stay_open(live, site):
agent = SimpleNamespace(
agent_id="scout", model="", browser_allowed_domains=["http*://127.0.0.1"]
)
try:
session, queue = await live.subscribe(agent)
- await _control(live, session, "viewer", "takeover", {"enabled": True})
- await _control(live, session, "viewer", "navigate", {"url": site})
- await _control(live, session, "viewer", "takeover", {"enabled": False})
+ await _open_animation_and_hand_back(live, session, queue, site)
frames = []
deadline = asyncio.get_running_loop().time() + 10
while len(frames) < 20 and asyncio.get_running_loop().time() < deadline:
@@ -262,8 +288,7 @@ async def test_native_chrome_toolbar_keyboard_and_agent_handoff(live, site):
async with asyncio.timeout(15):
# A plain Chrome sign-in deliberately exposes no DOM or URL.
# HTTP arrival proves native toolbar input reached the fixture.
- while "/" not in PageHandler.page_requests:
- await asyncio.sleep(0.05)
+ assert await asyncio.to_thread(PageHandler.wait_for_path, "/")
except TimeoutError:
pytest.fail(f"Native browser did not select the navigated tab: {session.state}")
await _control(live, session, "viewer", "takeover", {"enabled": False})
@@ -575,9 +600,7 @@ async def test_idle_animation_stream_soak(live, site, record_property):
)
try:
session, queue = await live.subscribe(agent)
- await _control(live, session, "viewer", "takeover", {"enabled": True})
- await _control(live, session, "viewer", "navigate", {"url": site})
- await _control(live, session, "viewer", "takeover", {"enabled": False})
+ await _open_animation_and_hand_back(live, session, queue, site)
duration = float(os.environ.get("JARVIS_BROWSER_SOAK_SECONDS", "5"))
# Measure steady rendering separately from the first target attachment.
first_frame_started = time.monotonic()
@@ -692,8 +715,7 @@ async def test_login_profile_survives_restart_and_stays_with_its_agent(live, sit
await _control(live, session, "viewer", "takeover", {"enabled": True})
await _control(live, session, "viewer", "navigate", {"url": site + path})
async with asyncio.timeout(15):
- while not any(request_path == path for request_path, _ in PageHandler.profile_requests):
- await asyncio.sleep(0.05)
+ assert await asyncio.to_thread(PageHandler.wait_for_path, path)
await _control(live, session, "viewer", "takeover", {"enabled": False})
return session
diff --git a/tests/unit/society/test_manual_chrome.py b/tests/unit/society/test_manual_chrome.py
index 9de29036f8..10c5c76975 100644
--- a/tests/unit/society/test_manual_chrome.py
+++ b/tests/unit/society/test_manual_chrome.py
@@ -158,7 +158,8 @@ async def test_plain_login_uses_owned_profile_and_no_automation_transport(login)
args, options = launches[0]
assert args == [
instance.executable, f"--user-data-dir={instance.profile.resolve()}", "--new-window",
- "--no-first-run", "--disable-background-mode", "chrome://newtab/",
+ "--no-first-run", "--disable-background-mode",
+ "--disable-backgrounding-occluded-windows", "chrome://newtab/",
]
assert options["creationflags"] == 0x08000000
assert options["stdin"] == options["stdout"] == options["stderr"] == subprocess.DEVNULL
diff --git a/tests/unit/speech/test_dictation_stale_hangup.py b/tests/unit/speech/test_dictation_stale_hangup.py
index 05463e2962..36d5e2991b 100644
--- a/tests/unit/speech/test_dictation_stale_hangup.py
+++ b/tests/unit/speech/test_dictation_stale_hangup.py
@@ -60,7 +60,7 @@ async def test_start_dictation_clears_stale_hangup() -> None:
task.cancel()
try:
await task
- except (asyncio.CancelledError, Exception): # noqa: BLE001
+ except asyncio.CancelledError: # noqa: S110 - this fixture just cancelled the task
pass
assert started is True