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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(credentials): collapse macOS Keychain secrets into one vault item
Ruben Lütke71ee96a99c95
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 4ad1c37999..bed16a9908 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -7108,3 +7108,25 @@ turn's record.**Guards.** `tests/unit/realtime/test_session.py::test_user_speech_during_silent_external_update_reclaims_the_turn` and`::test_hijacked_external_update_turn_completes_on_the_user_track`.++---++## BUG-103: one macOS Keychain permission dialog PER stored secret — boot triggers a 5-10 dialog storm (HIGH, FIXED 2026-07-20)++**Symptom.** Every boot on the Mac popped a stack of Keychain dialogs+("python3.12 wants to use your confidential information ... cannot verify+authenticity"), one per stored provider key — the pre-boot key check reads+~10 slots, and the unsigned venv python keeps "Always allow" from sticking+durably across binary updates.++**Fix (`jarvis/core/keychain_bundle.py`).** On macOS the platform keyring+backend is wrapped in `DarwinBundleKeyringBackend`: ALL Jarvis secrets live+in ONE Keychain item (`__jarvis_vault__`, JSON map) with a process-local+cache. One item → one dialog → one "Always allow", ever. Legacy per-key+items migrate into the vault on first read and are deleted so they stop+prompting. Malformed vault JSON self-disables the wrapper (delegates to the+inner backend, never destroys data); migration errors fail open. Windows+and Linux paths are untouched (`sys.platform == "darwin"` gates every+wrap); the existing write/read/delete backend probe runs THROUGH the+wrapper, proving the vault lifecycle. Guards:+`tests/unit/core/test_keychain_bundle.py`.diff --git a/jarvis/core/config.py b/jarvis/core/config.pyindex 33a5ede129..2df39a13db 100644--- a/jarvis/core/config.py+++ b/jarvis/core/config.py@@ -2682,6 +2682,12 @@ def _is_platform_keyring_backend(backend: Any) -> bool:"""Return whether *backend* is a real platform credential-store candidate."""if backend is None or getattr(backend, "_jarvis_file_backend", False):return False+ if getattr(backend, "_jarvis_platform_wrapper", False):+ # DarwinBundleKeyringBackend (macOS Keychain item-count collapse,+ # BUG-103) wraps the real platform backend rather than subclassing+ # it. Delegate the check to the wrapped instance instead of+ # inspecting class/module names against an unpinned library (AP-28).+ return _is_platform_keyring_backend(getattr(backend, "_inner", None))try:# ``fail.Keyring`` advertises zero priority. Use that capability rather# than an isinstance check against unpinned third-party internals.@@ -2755,6 +2761,13 @@ def _ensure_keyring_backend() -> None:read/write is handled at runtime by ``get_secret``/``set_secret``/``delete_secret`` via ``_install_file_cred_backend``. Any error is swallowed —a missing keyring must never break boot.++ On macOS, a viable platform backend is additionally wrapped in+ ``DarwinBundleKeyringBackend`` (BUG-103) so every Jarvis secret collapses+ into ONE Keychain item instead of one item per credential slot — an+ unsigned interpreter otherwise re-prompts "Always Allow" separately for+ each of the ~10 provider slots the pre-boot key check reads. Windows and+ Linux never wrap, so their behavior is unchanged."""global _KEYRING_BACKEND_READYif _KEYRING_BACKEND_READY:@@ -2763,12 +2776,19 @@ def _ensure_keyring_backend() -> None:try:import keyring- if not _is_platform_keyring_backend(keyring.get_keyring()):+ current_backend = keyring.get_keyring()+ if not _is_platform_keyring_backend(current_backend):_install_file_cred_backend("no OS credential store available (headless host)",retain_platform_backend=False,)- except Exception: # noqa: BLE001+ elif sys.platform == "darwin" and not getattr(+ current_backend, "_jarvis_platform_wrapper", False+ ):+ from .keychain_bundle import DarwinBundleKeyringBackend++ keyring.set_keyring(DarwinBundleKeyringBackend(current_backend))+ except Exception: # noqa: BLE001, S110 -- a missing keyring must never break bootpass@@ -2804,6 +2824,19 @@ def _try_restore_platform_keyring_backend() -> bool:if not _is_platform_keyring_backend(candidate):raise RuntimeError("platform backend discovery found no usable backend")+ # ``init_backend()`` just installed the RAW auto-detected backend+ # (unwrapped — it replaces whatever the process-global keyring+ # pointed at). Re-wrap it on macOS before the probe below runs, so+ # the probe proves the bundle lifecycle rather than the raw+ # per-item backend (BUG-103).+ if sys.platform == "darwin" and not getattr(+ candidate, "_jarvis_platform_wrapper", False+ ):+ from .keychain_bundle import DarwinBundleKeyringBackend++ candidate = DarwinBundleKeyringBackend(candidate)+ keyring_mod.set_keyring(candidate)+# A read-only probe was insufficient on Windows: WinVault could read an# old value while every write failed with error 1312. Use a unique,# disposable entry and prove the full write/read/delete lifecycle.diff --git a/jarvis/core/keychain_bundle.py b/jarvis/core/keychain_bundle.pynew file mode 100644index 0000000000..1897e44fdd--- /dev/null+++ b/jarvis/core/keychain_bundle.py@@ -0,0 +1,220 @@+"""macOS Keychain item-count collapse for Jarvis secrets (BUG-103).++On macOS every distinct ``keyring.set_password``/``get_password`` call+becomes its own Keychain item under the same service. An unsigned+interpreter (the dev venv ``python``) is not code-signed, so the OS+re-prompts "Allow / Always Allow / Deny" separately for EACH item — the+pre-boot key check alone touches roughly ten provider slots, producing a+storm of 5-10+ dialogs on every single boot.++``DarwinBundleKeyringBackend`` wraps the platform-detected keyring backend+(composition, not a registered ``keyring`` plugin) and collapses every+secret into ONE Keychain item — account name ``__jarvis_vault__`` — holding+a JSON object that maps key -> value. The user clicks "Always Allow" exactly+once for that single item; every later get/set/delete is served from an+in-process cache with no further per-item OS prompt.++Windows and Linux never construct this class: ``jarvis/core/config.py`` only+wraps the platform backend when ``sys.platform == "darwin"``, so their+per-item keyring behavior is byte-identical to before this module existed.+"""++from __future__ import annotations++import json+import logging+import threading+from typing import Any++logger = logging.getLogger(__name__)++# Account name for the single bundled Keychain item. Chosen to be extremely+# unlikely to collide with any real credential slot name (those are plain+# identifiers like "anthropic_api_key"); the double-underscore/dunder-ish+# shape also makes it obviously internal in the macOS Keychain Access UI.+VAULT_ACCOUNT = "__jarvis_vault__"+++class DarwinBundleKeyringBackend:+ """Wrap an inner keyring backend, collapsing all secrets into one item.++ Only implements the three methods ``jarvis/core/config.py`` calls through+ the process-global ``keyring`` module —+ ``get_password(service, key)``, ``set_password(service, key, value)``,+ ``delete_password(service, key)`` — so any object exposing that trio (a+ real platform backend, or a fake in tests) can be wrapped.+ """++ # Lets ``config._is_platform_keyring_backend`` recognize this wrapper as+ # a platform backend by delegating the check to the wrapped instance,+ # instead of inspecting class/module names against an unpinned library+ # (AP-28).+ _jarvis_platform_wrapper = True++ def __init__(self, inner: Any) -> None:+ self._inner = inner+ self._lock = threading.Lock()+ # Per-service cache of the parsed vault dict. Keyed by ``service``+ # because a single wrapper instance could in principle see more than+ # one service string, and each gets its own single vault item on the+ # inner backend. In practice jarvis/core/config.py always passes the+ # same ``KEYRING_SERVICE`` constant, so this holds exactly one entry.+ self._cache: dict[str, dict[str, str]] = {}+ # Set once an existing vault item fails to parse as a JSON object.+ # From then on every call for the rest of the process delegates+ # straight to the inner backend so the malformed item is read+ # (logged once), never silently overwritten or destroyed.+ self._bundle_unusable = False++ # -- internal helpers ---------------------------------------------------++ def _load_locked(self, service: str) -> dict[str, str]:+ """Return the parsed vault dict for *service*, loading it once.++ Caller must hold ``self._lock``. On a JSON-decode error, sets+ ``self._bundle_unusable`` and returns an empty dict without touching+ the stored item.+ """+ cached = self._cache.get(service)+ if cached is not None:+ return cached+ raw = self._inner.get_password(service, VAULT_ACCOUNT)+ if raw is None:+ bundle: dict[str, str] = {}+ self._cache[service] = bundle+ return bundle+ try:+ parsed = json.loads(raw)+ if not isinstance(parsed, dict):+ raise ValueError("Jarvis Keychain vault item is not a JSON object")+ except Exception: # noqa: BLE001 -- any parse failure disables the bundle+ logger.warning(+ "macOS Keychain vault item %r is malformed; falling back to "+ "per-item Keychain storage for the rest of this process. The "+ "malformed item is left untouched.",+ VAULT_ACCOUNT,+ )+ self._bundle_unusable = True+ return {}+ bundle = {str(k): str(v) for k, v in parsed.items()}+ self._cache[service] = bundle+ return bundle++ def _save_locked(self, service: str, bundle: dict[str, str]) -> None:+ """Persist *bundle* as the single vault item. Caller holds the lock."""+ self._inner.set_password(service, VAULT_ACCOUNT, json.dumps(bundle))++ @staticmethod+ def _raise_missing_password_error(service: str, key: str) -> None:+ """Raise the keyring-standard "no such password" error.++ Matches the contract callers in ``jarvis/core/config.py`` already+ handle (``keyring.errors.PasswordDeleteError``). Falls back to+ ``KeyError`` if the ``keyring`` package is unavailable, so this+ module never hard-depends on it at import time.+ """+ message = f"No such password for service {service!r} and key {key!r}"+ try:+ from keyring.errors import PasswordDeleteError+ except ImportError:+ raise KeyError(message) from None+ raise PasswordDeleteError(message)++ # -- public keyring-backend surface -------------------------------------++ def get_password(self, service: str, key: str) -> str | None:+ if key == VAULT_ACCOUNT:+ # The vault item itself is never bundled into itself.+ return self._inner.get_password(service, key)+ if self._bundle_unusable:+ return self._inner.get_password(service, key)++ with self._lock:+ bundle = self._load_locked(service)+ if self._bundle_unusable:+ # Discovered just now while loading; do not treat this read+ # as a bundle miss, delegate straight through instead.+ return self._inner.get_password(service, key)+ if key in bundle:+ return bundle[key]++ # Bundle miss: a legacy per-key item written before this wrapper+ # existed (or before this key was ever saved) may still be present.+ # Read it through the inner backend and, if found, migrate it into+ # the bundle so it never re-prompts again.+ legacy_val = self._inner.get_password(service, key)+ if legacy_val is None:+ return None+ try:+ self._migrate_legacy(service, key, legacy_val)+ except Exception: # noqa: BLE001 -- migration is best-effort+ logger.warning(+ "Failed to migrate legacy Keychain item %r into the Jarvis "+ "vault; returning the value anyway and leaving the legacy "+ "item in place.",+ key,+ )+ return legacy_val++ def _migrate_legacy(self, service: str, key: str, value: str) -> None:+ with self._lock:+ bundle = self._load_locked(service)+ if self._bundle_unusable:+ # Nothing to migrate into; leave the legacy item alone.+ return+ bundle[key] = value+ self._save_locked(service, bundle)+ # Best-effort: the legacy item stops prompting forever once removed,+ # but a failure here must not undo the successful bundle write above+ # or lose the value we already returned to the caller.+ try:+ self._inner.delete_password(service, key)+ except Exception: # noqa: BLE001, S110 -- legacy item may already be gone+ pass++ def set_password(self, service: str, key: str, value: str) -> None:+ if key == VAULT_ACCOUNT:+ self._inner.set_password(service, key, value)+ return+ if self._bundle_unusable:+ self._inner.set_password(service, key, value)+ return+ with self._lock:+ bundle = self._load_locked(service)+ if self._bundle_unusable:+ self._inner.set_password(service, key, value)+ return+ bundle[key] = value+ self._save_locked(service, bundle)++ def delete_password(self, service: str, key: str) -> None:+ if key == VAULT_ACCOUNT:+ self._inner.delete_password(service, key)+ return+ if self._bundle_unusable:+ self._inner.delete_password(service, key)+ return++ removed_from_bundle = False+ with self._lock:+ bundle = self._load_locked(service)+ if self._bundle_unusable:+ self._inner.delete_password(service, key)+ return+ if key in bundle:+ del bundle[key]+ self._save_locked(service, bundle)+ removed_from_bundle = True++ # Best-effort: also remove any legacy per-key item so it stops+ # prompting forever, but a missing legacy item (the common case) must+ # not turn a real bundle delete into a false "nothing to delete".+ removed_legacy = False+ try:+ self._inner.delete_password(service, key)+ removed_legacy = True+ except Exception: # noqa: BLE001 -- absent legacy item is expected+ removed_legacy = False++ if not removed_from_bundle and not removed_legacy:+ self._raise_missing_password_error(service, key)diff --git a/tests/unit/core/test_headless_keyring_fallback.py b/tests/unit/core/test_headless_keyring_fallback.pyindex e1ea375aeb..43c676d10e 100644--- a/tests/unit/core/test_headless_keyring_fallback.py+++ b/tests/unit/core/test_headless_keyring_fallback.py@@ -135,7 +135,16 @@ def test_ensure_keyring_backend_leaves_working_os_keyring_untouched(monkeypatch)cfg._ensure_keyring_backend()- assert "kr" not in called, "a working OS keyring must NOT be replaced by the file fallback"+ if sys.platform == "darwin":+ # BUG-103: on macOS a working OS keyring is wrapped in the+ # single-Keychain-item bundle backend (never replaced by the file+ # fallback), so the process-global keyring IS re-set here.+ kr = called.get("kr")+ assert kr is not None, "a viable macOS keyring must be wrapped in the bundle backend"+ assert not getattr(kr, "_jarvis_file_backend", False)+ assert getattr(kr, "_jarvis_platform_wrapper", False)+ else:+ assert "kr" not in called, "a working OS keyring must NOT be replaced by the file fallback"def test_delete_secret_succeeds_on_file_backend_only_host(monkeypatch, tmp_path):diff --git a/tests/unit/core/test_keychain_bundle.py b/tests/unit/core/test_keychain_bundle.pynew file mode 100644index 0000000000..d323775f3b--- /dev/null+++ b/tests/unit/core/test_keychain_bundle.py@@ -0,0 +1,243 @@+"""BUG-103: collapse every macOS Keychain item into ONE, so an unsigned venv+python triggers exactly one "Always Allow" prompt per boot instead of one per+credential slot.++These tests use a fake inner backend (dict-based, records every call) and+never touch a real keyring/Keychain, so they run identically on every host+OS -- the wrapper class itself has no platform gate; that gate lives only in+``jarvis/core/config.py``, which wraps the platform backend on darwin only.+"""++from __future__ import annotations++import pytest+from keyring.errors import PasswordDeleteError++from jarvis.core.keychain_bundle import VAULT_ACCOUNT, DarwinBundleKeyringBackend++SERVICE = "personal-jarvis"+++class FakeInnerBackend:+ """Minimal per-item keyring backend, matching real backend semantics:+ ``get_password`` returns ``None`` for a missing item, ``delete_password``+ RAISES ``keyring.errors.PasswordDeleteError`` when the item is already+ absent (as every real backend Jarvis relies on does -- see the+ ``PasswordDeleteError`` handling in ``config.delete_secret``)."""++ def __init__(self) -> None:+ self.values: dict[tuple[str, str], str] = {}+ self.calls: list[tuple[str, ...]] = []++ def get_password(self, service: str, key: str) -> str | None:+ self.calls.append(("get", service, key))+ return self.values.get((service, key))++ def set_password(self, service: str, key: str, value: str) -> None:+ self.calls.append(("set", service, key))+ self.values[(service, key)] = value++ def delete_password(self, service: str, key: str) -> None:+ self.calls.append(("delete", service, key))+ if (service, key) not in self.values:+ raise PasswordDeleteError(f"no such credential for {service}:{key}")+ del self.values[(service, key)]+++def inner() -> FakeInnerBackend:+ return FakeInnerBackend()+++def bundle(inner: FakeInnerBackend) -> DarwinBundleKeyringBackend:+ return DarwinBundleKeyringBackend(inner)+++# ---------------------------------------------------------------------------+# One vault item total; bundle-served reads never touch inner per-key.+# ---------------------------------------------------------------------------+++def test_multiple_sets_produce_exactly_one_inner_item(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ bundle.set_password(SERVICE, "anthropic_api_key", "sk-ant-1")+ bundle.set_password(SERVICE, "groq_api_key", "gsk-2")+ bundle.set_password(SERVICE, "openrouter_api_key", "or-3")++ stored_items = {k for k in inner.values if k[0] == SERVICE}+ assert stored_items == {(SERVICE, VAULT_ACCOUNT)}, (+ "every secret must collapse into the single vault item, never a "+ "per-key inner item"+ )+++def test_get_is_served_from_bundle_without_per_key_inner_reads(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ bundle.set_password(SERVICE, "anthropic_api_key", "sk-ant-1")+ inner.calls.clear()++ assert bundle.get_password(SERVICE, "anthropic_api_key") == "sk-ant-1"++ # Only the vault item may be read; no per-key inner get.+ assert all(call[2] == VAULT_ACCOUNT for call in inner.calls if call[0] == "get")+++def test_bundle_survives_across_wrapper_instances_via_inner_store(+ inner: FakeInnerBackend,+) -> None:+ first = DarwinBundleKeyringBackend(inner)+ first.set_password(SERVICE, "groq_api_key", "gsk-secret")++ second = DarwinBundleKeyringBackend(inner)+ assert second.get_password(SERVICE, "groq_api_key") == "gsk-secret"+++# ---------------------------------------------------------------------------+# Legacy per-key migration.+# ---------------------------------------------------------------------------+++def test_legacy_item_migrates_into_bundle_and_is_deleted(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ # Pre-seed a legacy per-key item, as if written before this wrapper existed.+ inner.values[(SERVICE, "telegram_bot_token")] = "123:legacy"++ first_read = bundle.get_password(SERVICE, "telegram_bot_token")+ assert first_read == "123:legacy"++ # The legacy item must be gone and the value now lives in the vault item.+ assert (SERVICE, "telegram_bot_token") not in inner.values+ assert (SERVICE, VAULT_ACCOUNT) in inner.values++ inner.calls.clear()+ second_read = bundle.get_password(SERVICE, "telegram_bot_token")+ assert second_read == "123:legacy"+ # Fully served from the cache/bundle -- no inner call of any kind.+ assert inner.calls == []+++def test_legacy_migration_failure_still_returns_the_read_value(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend, monkeypatch: pytest.MonkeyPatch+) -> None:+ inner.values[(SERVICE, "discord_bot_token")] = "legacy-token"++ def _boom(self, service: str, key: str, value: str) -> None:+ raise RuntimeError("simulated migration failure")++ monkeypatch.setattr(FakeInnerBackend, "set_password", _boom)++ # Migration fails (the inner set_password raises), but the read must+ # still succeed and return the legacy value -- fail open, never lose it.+ assert bundle.get_password(SERVICE, "discord_bot_token") == "legacy-token"+++def test_vault_account_itself_is_never_migrated_into_itself(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ inner.values[(SERVICE, VAULT_ACCOUNT)] = "not-json-but-irrelevant-here"++ # Reading the vault account name directly must go straight to inner,+ # never be treated as a regular bundled key.+ assert bundle.get_password(SERVICE, VAULT_ACCOUNT) == "not-json-but-irrelevant-here"+++# ---------------------------------------------------------------------------+# delete_password contract.+# ---------------------------------------------------------------------------+++def test_delete_removes_from_vault_and_raises_when_absent(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ bundle.set_password(SERVICE, "groq_api_key", "gsk-secret")++ bundle.delete_password(SERVICE, "groq_api_key")+ assert bundle.get_password(SERVICE, "groq_api_key") is None++ with pytest.raises(PasswordDeleteError):+ bundle.delete_password(SERVICE, "groq_api_key")+++def test_delete_also_best_effort_removes_a_legacy_item(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ # A key that exists both in the bundle AND (still) as a legacy per-item+ # entry (e.g. a previous migration attempt that failed to delete it).+ bundle.set_password(SERVICE, "groq_api_key", "gsk-secret")+ inner.values[(SERVICE, "groq_api_key")] = "legacy-leftover"++ bundle.delete_password(SERVICE, "groq_api_key")++ assert (SERVICE, "groq_api_key") not in inner.values+ with pytest.raises(PasswordDeleteError):+ bundle.delete_password(SERVICE, "groq_api_key")+++def test_delete_of_legacy_only_key_succeeds_without_bundle_entry(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ inner.values[(SERVICE, "legacy_only_key")] = "legacy-value"++ # Not migrated yet (never read), only present as a legacy item -- delete+ # must still succeed via the best-effort inner delete.+ bundle.delete_password(SERVICE, "legacy_only_key")++ assert (SERVICE, "legacy_only_key") not in inner.values+++# ---------------------------------------------------------------------------+# Malformed vault JSON.+# ---------------------------------------------------------------------------+++def test_malformed_vault_json_delegates_to_inner_and_is_never_overwritten(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ inner.values[(SERVICE, VAULT_ACCOUNT)] = "{not valid json"++ # A get for some unrelated key must delegate straight to inner instead of+ # crashing or silently returning None from a "loaded" empty bundle.+ assert bundle.get_password(SERVICE, "anthropic_api_key") is None+ assert inner.values[(SERVICE, VAULT_ACCOUNT)] == "{not valid json", (+ "the malformed vault item must never be destroyed/overwritten"+ )++ # A set for some other key must also go straight to the inner backend as+ # a per-item write (bundle disabled for the rest of the process), not+ # attempt to parse/rewrite the malformed vault item.+ bundle.set_password(SERVICE, "anthropic_api_key", "sk-ant-new")+ assert inner.values[(SERVICE, "anthropic_api_key")] == "sk-ant-new"+ assert inner.values[(SERVICE, VAULT_ACCOUNT)] == "{not valid json"+++def test_malformed_vault_json_non_object_also_disables_bundle(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ # Valid JSON, but not an object -- must be rejected exactly like invalid+ # JSON (a list has no key/value semantics to merge into).+ inner.values[(SERVICE, VAULT_ACCOUNT)] = "[1, 2, 3]"++ assert bundle.get_password(SERVICE, "anthropic_api_key") is None+ assert inner.values[(SERVICE, VAULT_ACCOUNT)] == "[1, 2, 3]"+++# ---------------------------------------------------------------------------+# Probe lifecycle (mirrors the set/get/delete probe in config.py's recovery path).+# ---------------------------------------------------------------------------+++def test_probe_lifecycle_passes_through_wrapper(+ bundle: DarwinBundleKeyringBackend, inner: FakeInnerBackend+) -> None:+ probe_key = "__jarvis_backend_probe__deadbeef"+ probe_value = "probe-value-123"++ bundle.set_password(SERVICE, probe_key, probe_value)+ assert bundle.get_password(SERVICE, probe_key) == probe_value++ bundle.delete_password(SERVICE, probe_key)+ assert bundle.get_password(SERVICE, probe_key) is Nonediff --git a/tests/unit/core/test_keyring_backend_recovery.py b/tests/unit/core/test_keyring_backend_recovery.pyindex fd7d7db312..dcdf99e9bd 100644--- a/tests/unit/core/test_keyring_backend_recovery.py+++ b/tests/unit/core/test_keyring_backend_recovery.py@@ -7,6 +7,8 @@ shadows the newly saved value on the next process start.from __future__ import annotations+import sys+import keyringimport keyring.backendimport pytest@@ -15,6 +17,18 @@ import jarvis.core.config as cfgfrom jarvis.marketplace.token_store import Tokens, TokenStore[email protected](autouse=True)+def _force_non_darwin_platform(monkeypatch: pytest.MonkeyPatch) -> None:+ """These tests exercise the platform-agnostic file/platform swap and+ recovery logic with fake in-memory backends; they assert on the RAW+ backend's stored keys directly, so they must behave identically no+ matter which host OS actually runs the suite. Force a non-darwin+ platform so BUG-103's macOS Keychain-bundle wrapping (a separate+ concern, covered by ``test_keychain_bundle.py`` and+ ``test_headless_keyring_fallback.py``) never engages here."""+ monkeypatch.setattr(sys, "platform", "linux")++class _MemoryBackend(keyring.backend.KeyringBackend):priority = 1.0