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(agents): honest CLI-provider status on fresh machines (Antigravity/Claude/Codex)

Ruben Lütke629eab383b61
diff --git a/jarvis/claude_auth.py b/jarvis/claude_auth.py
index cab3c19e41..8ed325c8a1 100644
--- a/jarvis/claude_auth.py
+++ b/jarvis/claude_auth.py
@@ -198,6 +198,16 @@ class ClaudeAuthService:
"""Full path to the ``claude`` binary, or ``None`` when absent."""
import shutil
+ # A CLI installed AFTER app start (or into a dir the GUI PATH never
+ # had, e.g. the native installer's ~/.local/bin) must still be found —
+ # idempotent stat probes, no subprocess.
+ try:
+ from jarvis.core.path_augment import ensure_cli_paths
+
+ ensure_cli_paths()
+ except Exception: # noqa: BLE001 — a probe helper must never break status
+ pass
+
candidates = (self._binary_path, *_BINARY_CANDIDATES)
for name in candidates:
if not name:
diff --git a/jarvis/codex_auth.py b/jarvis/codex_auth.py
index 7ddf03b8f2..c0fb43728a 100644
--- a/jarvis/codex_auth.py
+++ b/jarvis/codex_auth.py
@@ -175,6 +175,15 @@ class CodexAuthService:
"""Full path to the ``codex`` binary, or ``None`` when absent."""
import shutil
+ # A CLI installed AFTER app start (or into a dir the GUI PATH never
+ # had) must still be found — idempotent stat probes, no subprocess.
+ try:
+ from jarvis.core.path_augment import ensure_cli_paths
+
+ ensure_cli_paths()
+ except Exception: # noqa: BLE001 — a probe helper must never break status
+ pass
+
candidates = (self._binary_path, *_BINARY_CANDIDATES)
for name in candidates:
if not name:
diff --git a/jarvis/core/path_augment.py b/jarvis/core/path_augment.py
index 19544a038b..c93304f42e 100644
--- a/jarvis/core/path_augment.py
+++ b/jarvis/core/path_augment.py
@@ -66,6 +66,7 @@ def _posix_candidates() -> list[str]:
def _windows_candidates() -> list[str]:
+ home = Path.home()
dirs: list[str] = []
local = os.environ.get("LOCALAPPDATA")
if local:
@@ -75,6 +76,14 @@ def _windows_candidates() -> list[str]:
appdata = os.environ.get("APPDATA")
if appdata:
dirs.append(os.path.join(appdata, "npm"))
+ # Claude Code's NATIVE installer (install.ps1) drops the binary into
+ # %USERPROFILE%\.local\bin, and `claude install` migrates npm setups to
+ # %USERPROFILE%\.claude\local — neither is on a default Windows PATH, so
+ # the desktop app reported a working terminal `claude` as "not installed"
+ # (Windows test-machine report 2026-07-18; same class as the Mac case in
+ # the module docstring).
+ dirs.append(str(home / ".local" / "bin"))
+ dirs.append(str(home / ".claude" / "local"))
return dirs
diff --git a/jarvis/google_cli/auth_service.py b/jarvis/google_cli/auth_service.py
index d2e218cc49..224c092080 100644
--- a/jarvis/google_cli/auth_service.py
+++ b/jarvis/google_cli/auth_service.py
@@ -139,6 +139,14 @@ class GoogleCliAuthService:
"""
def _resolve(self) -> GoogleCli | None:
+ # A CLI installed AFTER app start (or into a dir the GUI PATH never
+ # had) must still be found — idempotent stat probes, no subprocess.
+ try:
+ from jarvis.core.path_augment import ensure_cli_paths
+
+ ensure_cli_paths()
+ except Exception: # noqa: BLE001 — a probe helper must never break status
+ pass
return resolve_google_cli()
def _read_json(self, name: str) -> dict[str, Any]:
diff --git a/jarvis/memory/wiki/provider_chain.py b/jarvis/memory/wiki/provider_chain.py
index 584d4174ea..204c3fa499 100644
--- a/jarvis/memory/wiki/provider_chain.py
+++ b/jarvis/memory/wiki/provider_chain.py
@@ -103,6 +103,31 @@ def _exception_summary(exc: Exception) -> str:
code = None
return f"{name} HTTP {code}" if code is not None else name
+def _cli_login_ready(provider: str) -> bool | None:
+ """Login-readiness of a subscription-CLI provider; ``None`` = not CLI-backed.
+
+ Codex and Antigravity are callable WITHOUT an API key — but only when
+ their official CLI is installed and logged in. Without this probe an
+ uninstalled/logged-out CLI provider entered every wiki chain and failed
+ on every single call (live 2026-07-18: antigravity produced chain errors
+ on machines that never installed it). A probe failure returns ``None``
+ (unknown) so an auth-service hiccup can never empty the chain.
+ """
+ try:
+ if provider == "codex":
+ from jarvis.codex_auth import CodexAuthService
+
+ return bool(CodexAuthService().status().connected)
+ if provider == "antigravity":
+ from jarvis.google_cli.auth_service import GoogleCliAuthService
+
+ status = GoogleCliAuthService().status()
+ return bool(status.installed and status.connected)
+ except Exception: # noqa: BLE001 — a probe failure must never empty the chain
+ return None
+ return None
+
+
def credential_ready_wiki_providers(
*,
available: set[str] | frozenset[str],
@@ -113,7 +138,10 @@ def credential_ready_wiki_providers(
API providers are checked through the core endpoint resolver, which already
implements team-proxy credentials plus keyring, environment, ``.env``, and
the headless local-file fallback. Providers without a core API-key mapping
- remain eligible because they may authenticate through OAuth or be local.
+ remain eligible when their subscription-CLI login probe does not say
+ otherwise (OAuth/local providers with no probe stay fail-open); a provider
+ WITH a key mapping is also admitted when its CLI login is connected, so a
+ keyless Codex-subscription user keeps the wiki working.
"""
from jarvis.core.config import (
PROVIDER_SECRET_CANDIDATES,
@@ -122,18 +150,22 @@ def credential_ready_wiki_providers(
ready: set[str] = set()
for provider in available:
+ cli_ready = _cli_login_ready(provider)
if provider not in PROVIDER_SECRET_CANDIDATES:
+ if cli_ready is False:
+ continue
ready.add(provider)
continue
try:
endpoint = resolve_provider_endpoint(provider, config=config)
+ has_key = bool(endpoint.credential)
except Exception: # noqa: BLE001 - one credential probe cannot hide others
log.debug(
"wiki provider credential probe failed for %s", provider,
exc_info=True,
)
- continue
- if endpoint.credential:
+ has_key = False
+ if has_key or cli_ready is True:
ready.add(provider)
return ready
diff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.py
index cfd50933c2..24b193d6c8 100644
--- a/jarvis/ui/web/server.py
+++ b/jarvis/ui/web/server.py
@@ -1098,11 +1098,13 @@ class WebServer:
from jarvis.google_cli.auth_service import GoogleCliAuthService
antigravity_status = GoogleCliAuthService().status()
+ antigravity_installed = antigravity_status.installed
antigravity_connected = (
antigravity_status.connected
and antigravity_status.mode == "oauth-personal"
)
except Exception: # noqa: BLE001
+ antigravity_installed = False
antigravity_connected = False
try:
antigravity_key = bool(get_jarvis_agent_secret("gemini"))
@@ -1114,7 +1116,14 @@ class WebServer:
"openclaw": "agy-cli (direct)",
"env_var": "Google-OAuth",
"env_fallback": "GEMINI_API_KEY",
- "key_set": antigravity_connected or antigravity_key,
+ # The worker DRIVES the agy/Gemini CLI — a Gemini API key
+ # alone, with no CLI on the machine, must never render the
+ # card "Ready" (Windows test-machine report 2026-07-18:
+ # Antigravity showed Ready although never installed, then
+ # every run died at spawn). Mirrors the Codex row's
+ # installed-gate below.
+ "key_set": antigravity_connected
+ or (antigravity_installed and antigravity_key),
"api_key_set": antigravity_key,
"dedicated_key_set": False,
"shared_key_set": False,
diff --git a/tests/unit/core/test_path_augment.py b/tests/unit/core/test_path_augment.py
index d0552da3d1..342f4ab794 100644
--- a/tests/unit/core/test_path_augment.py
+++ b/tests/unit/core/test_path_augment.py
@@ -65,6 +65,12 @@ def test_candidates_are_platform_appropriate():
if sys.platform == "win32":
assert any("WinGet" in d for d in dirs)
assert any(d.endswith("npm") for d in dirs)
+ # Claude Code's native installer (install.ps1 -> ~/.local/bin) and the
+ # `claude install` migration dir (~/.claude/local) — a working terminal
+ # `claude` was reported "not installed" without them (2026-07-18
+ # Windows test machine).
+ assert any(d.endswith(os.path.join(".local", "bin")) for d in dirs)
+ assert any(d.endswith(os.path.join(".claude", "local")) for d in dirs)
else:
assert "/usr/local/bin" in dirs
assert "/opt/homebrew/bin" in dirs # Apple-Silicon Homebrew
diff --git a/tests/unit/memory/wiki/test_provider_chain.py b/tests/unit/memory/wiki/test_provider_chain.py
index d68b0aacfe..fc3e6f53ed 100644
--- a/tests/unit/memory/wiki/test_provider_chain.py
+++ b/tests/unit/memory/wiki/test_provider_chain.py
@@ -75,6 +75,58 @@ def test_keyless_primary_is_skipped_for_the_users_available_key() -> None:
assert chain[0][1] # fallback receives its own cheap provider-family model
+def test_uninstalled_cli_provider_is_excluded_from_the_chain(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """Antigravity without its CLI installed must not enter the wiki chain —
+ it failed on every call on machines that never installed it (2026-07-18)."""
+ from types import SimpleNamespace as NS
+
+ from jarvis.core import config as config_module
+ from jarvis.google_cli import auth_service as google_auth
+
+ monkeypatch.setattr(
+ config_module,
+ "resolve_provider_endpoint",
+ lambda provider, config: NS(credential=None),
+ )
+ monkeypatch.setattr(
+ google_auth,
+ "GoogleCliAuthService",
+ lambda: NS(status=lambda: NS(installed=False, connected=False)),
+ )
+ ready = credential_ready_wiki_providers(
+ available={"antigravity", "future-oauth"},
+ config=object(),
+ )
+ assert ready == {"future-oauth"} # unknown OAuth providers stay fail-open
+
+
+def test_keyless_codex_subscription_keeps_the_wiki_working(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ from types import SimpleNamespace as NS
+
+ import jarvis.codex_auth as codex_auth
+ from jarvis.core import config as config_module
+
+ monkeypatch.setattr(
+ config_module,
+ "resolve_provider_endpoint",
+ lambda provider, config: NS(credential=None),
+ )
+ monkeypatch.setattr(
+ codex_auth,
+ "CodexAuthService",
+ lambda: NS(status=lambda: NS(installed=True, connected=True)),
+ )
+ ready = credential_ready_wiki_providers(
+ available={"codex"},
+ config=object(),
+ )
+ assert ready == {"codex"} # ChatGPT login counts, no API key needed
+
+
def test_credential_probe_uses_core_portable_storage_and_keeps_oauth(
monkeypatch: pytest.MonkeyPatch,
) -> None: