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: settle the tests the local-main merge broke

rubenluetke10-beepdce5982a447e
diff --git a/.github/workflows/desktop-installers.yml b/.github/workflows/desktop-installers.yml
index 1c8a8e4844..b1ebe54174 100644
--- a/.github/workflows/desktop-installers.yml
+++ b/.github/workflows/desktop-installers.yml
@@ -251,33 +251,6 @@ jobs:
while IFS= read -r original; do keychains+=("$original"); done < "$RUNNER_TEMP/jarvis-original-keychains.txt"
security list-keychains -d user -s "${keychains[@]}"
- - name: Import the Developer ID certificate into a temporary keychain
- if: env.HAS_APPLE_SIGNING == 'true'
- shell: bash
- env:
- APPLE_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }}
- APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- run: |
- set -euo pipefail
- umask 077
- : "${APPLE_CERTIFICATE_P12_BASE64:?Signing requires the publisher certificate}"
- : "${APPLE_CERTIFICATE_PASSWORD:?Signing requires the certificate password}"
- keychain="$RUNNER_TEMP/jarvis-signing.keychain-db"
- certificate="$RUNNER_TEMP/jarvis-signing.p12"
- trap 'rm -f "$certificate"' EXIT
- security list-keychains -d user | sed -e 's/^ *"//' -e 's/" *$//' > "$RUNNER_TEMP/jarvis-original-keychains.txt"
- printf '%s' "$APPLE_CERTIFICATE_P12_BASE64" | /usr/bin/base64 -D > "$certificate"
- password="$(openssl rand -hex 32)"
- echo "::add-mask::$password"
- security create-keychain -p "$password" "$keychain"
- security set-keychain-settings -lut 21600 "$keychain"
- security unlock-keychain -p "$password" "$keychain"
- security import "$certificate" -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$keychain"
- security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$password" "$keychain"
- keychains=("$keychain")
- while IFS= read -r original; do keychains+=("$original"); done < "$RUNNER_TEMP/jarvis-original-keychains.txt"
- security list-keychains -d user -s "${keychains[@]}"
-
# The script decides what to do with these: with them it codesigns with
# the Developer ID identity and notarizes; without them it ad-hoc signs,
# skips notarization and prints a one-line notice.
diff --git a/jarvis/agentic_ide/orchestration.py b/jarvis/agentic_ide/orchestration.py
index aafd5d88a0..392203c30c 100644
--- a/jarvis/agentic_ide/orchestration.py
+++ b/jarvis/agentic_ide/orchestration.py
@@ -219,8 +219,9 @@ class WorkspaceOrchestrator:
"", "", "", {}, 0, deduplicate_unconfirmed=True,
)
self._ledger_compatible = callable(getattr(ledger, "operation", None))
- except (TypeError, ValueError):
- # Surface a restart requirement below instead of a partial dispatch.
+ except (AttributeError, TypeError, ValueError):
+ # No ledger (resolve-only use) or an old one: surface a restart
+ # requirement below instead of a partial dispatch.
self._ledger_compatible = False
# request_id -> (target IDs, issued at, prompt sent under it or "")
self._issued: dict[str, tuple[dict[str, str], float, str]] = {}
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 00af084e9e..edfde739df 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -9523,7 +9523,10 @@ class SpeechPipeline:
or self.is_speaker_muted
or getattr(self, "_muted", False)
or self._hangup_event.is_set()
- or self._external_hangup_pending.is_set()
+ # Read defensively: a pipeline assembled without __init__ (the realtime
+ # handshake test doubles) has no external-hangup flag yet.
+ or (pending := getattr(self, "_external_hangup_pending", None)) is not None
+ and pending.is_set()
):
return
self._listening_cue_task = asyncio.create_task(
diff --git a/tests/contract/test_agent_mcp_harmony.py b/tests/contract/test_agent_mcp_harmony.py
index 7ff9027a42..efc1f1cbbc 100644
--- a/tests/contract/test_agent_mcp_harmony.py
+++ b/tests/contract/test_agent_mcp_harmony.py
@@ -48,6 +48,14 @@ COVERED: Final[dict[str, str]] = {
#: REST route -> why an MCP client does not get it. Each line is a decision.
WITHHELD: Final[dict[str, str]] = {
+ "GET /api/society/provider-prefs": (
+ "which providers the agents may use is a settings page for the owner; "
+ "a remote client already sees the effective seat on each agent"
+ ),
+ "PUT /api/society/provider-prefs": (
+ "turning providers off for every agent is the owner's billing decision "
+ "and is never handed to a remote client"
+ ),
"POST /api/society/agents/{agent_id}/browser/restart": (
"native browser recovery is initiated by the owner in the browser panel; "
"remote clients must not interrupt the person's manual browser session"
diff --git a/tests/unit/appshot/test_appshot_readiness.py b/tests/unit/appshot/test_appshot_readiness.py
index e82fd2d407..eb6f44432a 100644
--- a/tests/unit/appshot/test_appshot_readiness.py
+++ b/tests/unit/appshot/test_appshot_readiness.py
@@ -21,17 +21,16 @@ def desktop(monkeypatch: pytest.MonkeyPatch):
return gate
-def test_a_mac_without_screen_recording_is_not_ready(desktop) -> None:
+def test_a_mac_without_screen_recording_is_still_ready(desktop) -> None:
+ """Readiness is backend support, never a permission preflight: macOS asks
+ for Screen Recording just in time, at the first capture."""
pytest.importorskip("mss")
desktop(CapturePermissionIssue(code="capture_permission", message="Grant it first."))
readiness = appshot_routes._capability() # noqa: SLF001
- assert readiness["capture"] is False
- assert readiness["capture_detail"] == "Grant it first."
- # The picker would freeze the screens for a capture that is refused.
- assert readiness["region"] is False
- assert readiness["region_detail"] == "Grant it first."
+ assert readiness["capture"] is True
+ assert readiness["capture_detail"] == ""
def test_a_granted_desktop_is_ready(desktop) -> None:
diff --git a/tests/unit/appshot/test_recording_permission.py b/tests/unit/appshot/test_recording_permission.py
index c8d0e9baa1..237a2ae677 100644
--- a/tests/unit/appshot/test_recording_permission.py
+++ b/tests/unit/appshot/test_recording_permission.py
@@ -3,88 +3,72 @@
from __future__ import annotations
import sys
-from types import SimpleNamespace
import pytest
-from jarvis.platform import permissions, screen_access
-from jarvis.platform.permissions import PermissionId, PermissionState
-
-
-class FakePort:
- def __init__(self, state: PermissionState, *, grant_on_request: bool = False) -> None:
- self._state = state
- self.grant_on_request = grant_on_request
- self.requested: list[PermissionId] = []
-
- def state(self, permission_id: PermissionId) -> PermissionState:
- assert permission_id is PermissionId.SCREEN_RECORDING
- return self._state
-
- def runtime_access_granted(self, _permission_id: PermissionId) -> bool:
- return self._state is PermissionState.GRANTED
-
- def request(self, permission_id: PermissionId) -> SimpleNamespace:
- self.requested.append(permission_id)
- if self.grant_on_request:
- self._state = PermissionState.GRANTED
- return SimpleNamespace(ok=True, message="asked")
+from jarvis.platform import permission_service, screen_access
+from jarvis.platform.permissions import PermissionId
+from tests.fakes.fake_permission_service import FakePermissionService
@pytest.fixture
-def port(monkeypatch: pytest.MonkeyPatch):
- def use(state: PermissionState, **kwargs) -> FakePort:
- fake = FakePort(state, **kwargs)
- monkeypatch.setattr(permissions, "get_system_permission_port", lambda: fake)
+def gate(monkeypatch: pytest.MonkeyPatch):
+ def use(*outcomes: str) -> FakePermissionService:
+ fake = FakePermissionService()
+ fake.script(PermissionId.SCREEN_RECORDING, *outcomes)
+ monkeypatch.setattr(screen_access, "permission_gate", lambda: fake)
+ monkeypatch.setattr(permission_service, "get_permission_service", lambda: fake)
return fake
return use
@pytest.mark.parametrize(
- ("state", "allowed"),
+ ("outcome", "allowed"),
[
- (PermissionState.GRANTED, True),
- (PermissionState.NOT_REQUIRED, True),
- (PermissionState.DENIED, False),
- (PermissionState.NOT_DETERMINED, False),
- (PermissionState.UNAVAILABLE, False),
+ ("granted", True),
+ ("not_required", True),
+ ("denied", False),
+ ("pending", False),
+ ("unavailable", False),
],
)
-def test_only_a_live_grant_lets_a_capture_run(port, state: PermissionState, allowed: bool) -> None:
- port(state)
+def test_only_a_live_grant_lets_a_capture_run(gate, outcome: str, allowed: bool) -> None:
+ gate(outcome)
assert screen_access.state_allows_capture(screen_access.screen_recording_state()) is allowed
-async def test_a_granted_recording_starts_without_asking(port) -> None:
- fake = port(PermissionState.GRANTED)
+async def test_a_granted_recording_starts_without_asking(gate) -> None:
+ fake = gate("granted")
await screen_access.require_screen_recording_async("appshot")
- assert fake.requested == []
+ assert fake.ensure_calls(PermissionId.SCREEN_RECORDING) == []
-async def test_starting_a_recording_asks_macos_once(port) -> None:
- fake = port(PermissionState.NOT_DETERMINED, grant_on_request=True)
- await screen_access.require_screen_recording_async("appshot")
- assert fake.requested == [PermissionId.SCREEN_RECORDING]
+async def test_starting_a_recording_asks_macos_once(gate) -> None:
+ fake = gate("pending")
+ with pytest.raises(screen_access.ScreenCaptureRefused):
+ await screen_access.require_screen_recording_async("appshot")
+ asks = fake.ensure_calls(PermissionId.SCREEN_RECORDING)
+ assert len(asks) == 1
+ assert asks[0].interactive is True
-async def test_a_refused_grant_names_the_permission(port) -> None:
- port(PermissionState.DENIED)
+async def test_a_refused_grant_names_the_permission(gate) -> None:
+ gate("denied")
with pytest.raises(screen_access.ScreenCaptureRefused) as refused:
await screen_access.require_screen_recording_async("appshot")
assert "Screen Recording" in refused.value.user_detail
- assert str(refused.value).startswith("[permission_needed:screen_recording]")
def test_the_recording_status_on_a_mac_without_the_grant(
- monkeypatch: pytest.MonkeyPatch, port
+ monkeypatch: pytest.MonkeyPatch, gate
) -> None:
"""The status route on macOS: an honest refusal, never an import error."""
pytest.importorskip("PySide6.QtMultimedia")
pytest.importorskip("av")
from jarvis.appshot import recording
- port(PermissionState.DENIED)
+ gate("denied")
monkeypatch.setattr(sys, "platform", "darwin")
monkeypatch.setattr("jarvis.platform.probes.display_present", lambda: True)
diff --git a/tests/unit/screen_context/test_ports_pending_confirmation.py b/tests/unit/screen_context/test_ports_pending_confirmation.py
index 7f36be9b2d..6e83d56fb5 100644
--- a/tests/unit/screen_context/test_ports_pending_confirmation.py
+++ b/tests/unit/screen_context/test_ports_pending_confirmation.py
@@ -7,8 +7,9 @@ real ScreenCaptureKit path does. Nothing here ran on a real Mac.
* With a request still open (macOS may be showing its dialog) the capture is refused
with the "may be showing a dialog" text, takes NO rect grab of the wallpaper and
asks for nothing new.
-* With a live grant the rect grab is the safe fallback and carries on.
-* A plain timeout that the state does not explain refuses with the state's text.
+* With a live grant the capture is still refused: a window handle means "this
+ window alone", so a desktop-rectangle grab is never the fallback on any OS.
+* A failure that is not a timeout never looks at the permission.
"""
from __future__ import annotations
@@ -16,7 +17,6 @@ from __future__ import annotations
import sys
import types
from contextlib import nullcontext
-from types import SimpleNamespace
import pytest
@@ -63,9 +63,6 @@ def _native_fails_with(monkeypatch: pytest.MonkeyPatch, reason: str) -> None:
return None
monkeypatch.setattr(window_capture, "grab_window", native)
- # The rect fallback is refused on Windows by design (ports.py branches on os.name):
- # these tests model a Mac, so they must not depend on the host OS.
- monkeypatch.setattr(ports, "os", SimpleNamespace(name="posix"))
monkeypatch.setattr(ports, "_is_wayland", lambda: False)
monkeypatch.setattr(ports, "_input_space", nullcontext)
monkeypatch.setattr("jarvis.cu.indicator.capture_guard.indicator_suppressed", nullcontext)
@@ -94,16 +91,17 @@ def test_a_timeout_while_a_request_is_open_is_pending_not_denied(monkeypatch):
assert len(tcc.requests()) == 1 # nothing new was asked
-def test_a_timeout_with_a_live_grant_falls_through_to_the_rect_grab(monkeypatch):
+def test_a_timeout_with_a_live_grant_never_falls_back_to_a_rect_grab(monkeypatch):
tcc = _darwin(monkeypatch, granted=[TccService.SCREEN_RECORDING])
grabs: list[dict[str, int]] = []
_install_mss(monkeypatch, grabs)
_native_fails_with(monkeypatch, "pending_confirmation")
- (width, height), rgb = ports.NativeSurfaceCapturer().grab(_BBOX, window_handle=9)
+ with pytest.raises(ports.CaptureUnavailable) as refused:
+ ports.NativeSurfaceCapturer().grab(_BBOX, window_handle=9)
- assert (width, height) == (80, 60) and rgb
- assert grabs == [{"left": 0, "top": 0, "width": 80, "height": 60}]
+ assert "fallback was refused" in str(refused.value)
+ assert grabs == [] # the overlapping window is never photographed
tcc.assert_no_prompts()
@@ -113,7 +111,8 @@ def test_a_failure_that_is_not_a_timeout_never_looks_at_the_permission(monkeypat
_install_mss(monkeypatch, grabs)
_native_fails_with(monkeypatch, "")
- ports.NativeSurfaceCapturer().grab(_BBOX, window_handle=9)
+ with pytest.raises(ports.CaptureUnavailable):
+ ports.NativeSurfaceCapturer().grab(_BBOX, window_handle=9)
- assert len(grabs) == 1
+ assert grabs == []
tcc.assert_no_prompts()
diff --git a/tests/unit/society/test_chat_binding.py b/tests/unit/society/test_chat_binding.py
index 65afe536f3..92320cde3d 100644
--- a/tests/unit/society/test_chat_binding.py
+++ b/tests/unit/society/test_chat_binding.py
@@ -1096,7 +1096,9 @@ def test_unfiltered_session_list_hides_society_sessions(tmp_path: Path):
)
app = FastAPI()
app.include_router(router)
- app.state.agent_chat = SimpleNamespace(store=store, is_running=lambda sid: False)
+ app.state.agent_chat = SimpleNamespace(
+ store=store, is_running=lambda sid: False, pending_approvals=lambda sid: []
+ )
with TestClient(app) as c:
everything = c.get("/api/agent-chat/sessions").json()["sessions"]
assert [s["surface"] for s in everything] == ["agent"]
diff --git a/tests/unit/ui/web/test_outputs_routes.py b/tests/unit/ui/web/test_outputs_routes.py
index c3dd5050fe..323e931380 100644
--- a/tests/unit/ui/web/test_outputs_routes.py
+++ b/tests/unit/ui/web/test_outputs_routes.py
@@ -54,6 +54,15 @@ def _reset_openers_cache_between_tests():
outputs_routes._reset_openers_cache()
[email protected](autouse=True)
+def _no_real_editor_installs(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Editor detection probes standard install paths first; keep the test
+ machine's own VS Code or Cursor out so only the stubbed resolver decides."""
+ from jarvis.ui.web import outputs_routes
+
+ monkeypatch.setattr(outputs_routes, "_editor_install_candidates", lambda app_id: [])
+
+
# --- Stubs -------------------------------------------------------------------