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.

feat(antigravity): subagent over the Google subscription (OAuth CLI)

Ruben Lütke2406b2cc7187
diff --git a/jarvis/missions/init.py b/jarvis/missions/init.py
index 288c7500c6..70ec9ac9a5 100644
--- a/jarvis/missions/init.py
+++ b/jarvis/missions/init.py
@@ -44,7 +44,10 @@ from .manager import MissionManager
from .voice.announcer import MissionAnnouncer
from .voice.listener import MissionVoiceListener
from .voice.readback import MissionReadback
-from .worker_runtime.provider_map import CODEX_SUBAGENT_SLUGS
+from .worker_runtime.provider_map import (
+ ANTIGRAVITY_SUBAGENT_SLUGS,
+ CODEX_SUBAGENT_SLUGS,
+)
from .workers.claude_direct_worker import ClaudeDirectWorker
from .workers.codex_direct_worker import CodexDirectWorker
from .workers.gemini_worker import GeminiWorker
@@ -145,8 +148,8 @@ def _select_subagent_worker_kind(
) -> str:
"""Pure routing decision for the Heavy-Task subagent worker.
- Returns one of ``"claude_direct"`` | ``"codex_direct"`` | ``"subjarvis"``
- | ``"gemini"``.
+ Returns one of ``"claude_direct"`` | ``"codex_direct"`` | ``"antigravity"``
+ | ``"subjarvis"`` | ``"gemini"``.
Defense-in-depth (2026-05-29, user mandate: heavy tasks run on the
configured provider — claude-api -> Claude Max OAuth — and Gemini must
@@ -166,6 +169,12 @@ def _select_subagent_worker_kind(
return "subjarvis"
if sub_jarvis_provider in CODEX_SUBAGENT_SLUGS:
return "codex_direct"
+ # "antigravity" (Google subscription via the official agy/gemini CLI over the
+ # OAuth login) is a HARD LOCK like claude-api: no per-step model can divert it
+ # to the API-key Gemini path. It reuses GeminiWorker but with the API key
+ # stripped from the worker env (the OAuth login then bills the subscription).
+ if sub_jarvis_provider in ANTIGRAVITY_SUBAGENT_SLUGS:
+ return "antigravity"
# Explicitly selecting "gemini" routes to the direct GeminiWorker so the
# sub-agent actually runs on Gemini (the user's "selected provider must run"
# mandate). This is NOT the anti-silent-Gemini case (2026-05-29) — that
@@ -385,11 +394,18 @@ async def bootstrap_missions(
openai_key = get_secret(
"openai_api_key", env_fallback="OPENAI_API_KEY"
)
- gemini_key = get_secret(
- "gemini_api_key", env_fallback="GEMINI_API_KEY"
- ) or get_secret(
- "google_api_key", env_fallback="GOOGLE_API_KEY"
- )
+ # Antigravity (Google subscription) deliberately runs OAuth-only: a
+ # configured Gemini API key must NOT be injected, or the CLI would
+ # bill the key instead of the subscription login. Other subagents
+ # keep the API-key path unchanged.
+ if sub_jarvis_provider in ANTIGRAVITY_SUBAGENT_SLUGS:
+ gemini_key = None
+ else:
+ gemini_key = get_secret(
+ "gemini_api_key", env_fallback="GEMINI_API_KEY"
+ ) or get_secret(
+ "google_api_key", env_fallback="GOOGLE_API_KEY"
+ )
# Grok / xAI: Jarvis stores under ``grok_api_key`` in the
# credential manager (ENV fallback ``GROK_API_KEY``); we set
# both XAI_API_KEY + GROK_API_KEY on the worker side so
@@ -523,6 +539,16 @@ async def bootstrap_missions(
)
return ClaudeDirectWorker(mcp_servers=_assemble_worker_mcp_servers())
return CodexDirectWorker()
+ if kind == "antigravity":
+ # "antigravity" (Google subscription): reuse GeminiWorker — it already
+ # drives `gemini -p ... --yolo` in the worktree — but the worker env has
+ # the Gemini API key stripped (see the env builder below), so the CLI
+ # falls back to the ~/.gemini OAuth login and bills the subscription.
+ logger.info(
+ "Mission worker -> GeminiWorker over the Google subscription "
+ "(OAuth login, no API key) — billed against Antigravity/Gemini."
+ )
+ return GeminiWorker()
if kind == "gemini":
# Reached when [brain.sub_jarvis].provider == "gemini" was selected
# (the user's "selected provider must run" mandate) OR, legacy, when
diff --git a/jarvis/missions/worker_runtime/provider_map.py b/jarvis/missions/worker_runtime/provider_map.py
index 2c47a76968..9faa08257d 100644
--- a/jarvis/missions/worker_runtime/provider_map.py
+++ b/jarvis/missions/worker_runtime/provider_map.py
@@ -39,6 +39,8 @@ __all__ = [
"canonical_subagent_provider",
"CODEX_SUBAGENT_SLUGS",
"CODEX_SUBAGENT_CANONICAL",
+ "ANTIGRAVITY_SUBAGENT_SLUGS",
+ "ANTIGRAVITY_SUBAGENT_CANONICAL",
]
@@ -53,6 +55,16 @@ CODEX_SUBAGENT_SLUGS: Final[frozenset[str]] = frozenset({"openai-codex", "chatgp
CODEX_SUBAGENT_CANONICAL: Final[str] = "openai-codex"
+# Subagent slugs that route to the OAuth Google-CLI worker (the GeminiWorker
+# driven over the "Sign in with Google" login, billed against the Google
+# subscription — no API key), NOT through MAPPINGS (no OpenClaw provider slug).
+# Mirror of CODEX_SUBAGENT_SLUGS so the acceptance set is a SINGLE SOURCE OF
+# TRUTH shared by /api/subagent/switch, the brain-tool path, and the worker
+# selector (init._select_subagent_worker_kind), and can never drift (BUG-008).
+ANTIGRAVITY_SUBAGENT_SLUGS: Final[frozenset[str]] = frozenset({"antigravity"})
+ANTIGRAVITY_SUBAGENT_CANONICAL: Final[str] = "antigravity"
+
+
@dataclass(frozen=True, slots=True)
class ProviderMapping:
"""One row of the AD-6 mapping table.
diff --git a/jarvis/missions/workers/gemini_worker.py b/jarvis/missions/workers/gemini_worker.py
index 12c9f7fd90..3ba2123822 100644
--- a/jarvis/missions/workers/gemini_worker.py
+++ b/jarvis/missions/workers/gemini_worker.py
@@ -75,7 +75,7 @@ def _stderr_signals_quota_block(stderr_bytes: bytes) -> bool:
return any(marker in text for marker in _QUOTA_BLOCKED_MARKERS)
-def _resolve_gemini_argv_prefix() -> list[str]:
+def _resolve_gemini_argv_prefix(*, bundle_finder: Any = None) -> list[str]:
"""Returns the argv prefix for invoking the Gemini CLI.
On Windows, the npm-installed CLI ships as `gemini.cmd` — a batch
@@ -111,6 +111,18 @@ def _resolve_gemini_argv_prefix() -> list[str]:
if candidate.is_file():
return [node, str(candidate)]
+ # Robust fallback: probe the npm-global node_modules DIRECTLY (handles this
+ # machine's broken-shim case, where shutil.which misses the stale gemini.cmd
+ # temp files, so the loop above finds nothing). Drives `node <bundle>`, which
+ # also avoids the .cmd metachar re-parse. Shared with the brain resolver.
+ from jarvis.google_cli.resolver import _default_npm_bundle
+
+ finder = bundle_finder or _default_npm_bundle
+ bundle = finder()
+ if bundle:
+ node = shutil.which("node") or shutil.which("node.exe") or "node"
+ return [node, str(bundle)]
+
# Fallback: bare CLI (still works for prompts with no metachars).
for name in _GEMINI_BINARIES:
cli = shutil.which(name)
diff --git a/tests/missions/test_gemini_worker_resolver.py b/tests/missions/test_gemini_worker_resolver.py
new file mode 100644
index 0000000000..62f6915fe2
--- /dev/null
+++ b/tests/missions/test_gemini_worker_resolver.py
@@ -0,0 +1,28 @@
+"""GeminiWorker binary resolution survives broken npm PATH shims.
+
+On this machine the npm-installed gemini.cmd/gemini shims are stale temp files,
+so shutil.which misses them. The worker must still find the bundle via the
+robust npm-global probe (jarvis.google_cli.resolver._default_npm_bundle) and
+drive `node <bundle>` instead of failing on a bare `gemini`.
+"""
+from __future__ import annotations
+
+import shutil
+
+from jarvis.missions.workers.gemini_worker import _resolve_gemini_argv_prefix
+
+
+def test_uses_npm_bundle_when_shims_broken(monkeypatch):
+ # Broken shims: which() finds node but neither gemini.cmd nor gemini.
+ monkeypatch.setattr(
+ shutil, "which",
+ lambda n: "/usr/bin/node" if n in ("node", "node.exe") else None,
+ )
+ argv = _resolve_gemini_argv_prefix(bundle_finder=lambda: "/x/bundle/gemini.js")
+ assert argv == ["/usr/bin/node", "/x/bundle/gemini.js"]
+
+
+def test_falls_back_to_bare_cli_when_no_bundle(monkeypatch):
+ monkeypatch.setattr(shutil, "which", lambda n: None)
+ argv = _resolve_gemini_argv_prefix(bundle_finder=lambda: None)
+ assert argv == ["gemini"]
diff --git a/tests/missions/test_subagent_worker_routing.py b/tests/missions/test_subagent_worker_routing.py
index 2b4758d293..5de42f0d26 100644
--- a/tests/missions/test_subagent_worker_routing.py
+++ b/tests/missions/test_subagent_worker_routing.py
@@ -44,6 +44,14 @@ def test_other_providers_route_subjarvis(provider: str) -> None:
assert _select_subagent_worker_kind(provider, "gemini-3.1-pro") == "subjarvis"
[email protected]("step_model", ["", "claude-opus-4-8", "gemini-3.1-pro"])
+def test_antigravity_routes_to_oauth_cli_worker(step_model: str) -> None:
+ """Choosing 'antigravity' (Google subscription) routes to the dedicated
+ OAuth-CLI worker kind — never the API-key Gemini path. Like claude-api, it
+ is a hard lock that no step model can divert."""
+ assert _select_subagent_worker_kind("antigravity", step_model) == "antigravity"
+
+
def test_gemini_as_subagent_provider_uses_direct_gemini_worker() -> None:
"""Post-Welle-4: explicitly choosing 'gemini' routes to the direct
GeminiWorker so the sub-agent actually RUNS on Gemini. The OpenClaw path it
diff --git a/tests/missions/worker_runtime/test_provider_map.py b/tests/missions/worker_runtime/test_provider_map.py
index f7881e8781..0fdb443725 100644
--- a/tests/missions/worker_runtime/test_provider_map.py
+++ b/tests/missions/worker_runtime/test_provider_map.py
@@ -189,3 +189,21 @@ def test_ad6_table_is_complete() -> None:
"AD-6 Amendment-Tabelle weicht ab — bitte docs/openclaw-bridge.md "
"und MAPPINGS synchron halten."
)
+
+
+# --- Antigravity (Google subscription via OAuth CLI) subagent slug ---
+
+
+def test_antigravity_subagent_slugs_ssot() -> None:
+ """The Antigravity subagent slug set is the SSoT mirror of CODEX_SUBAGENT_SLUGS:
+ it routes to the dedicated OAuth-CLI worker, NOT through MAPPINGS (no OpenClaw
+ provider slug)."""
+ from jarvis.missions.worker_runtime.provider_map import (
+ ANTIGRAVITY_SUBAGENT_CANONICAL,
+ ANTIGRAVITY_SUBAGENT_SLUGS,
+ )
+
+ assert "antigravity" in ANTIGRAVITY_SUBAGENT_SLUGS
+ assert ANTIGRAVITY_SUBAGENT_CANONICAL == "antigravity"
+ # Not a MAPPINGS provider (OAuth CLI has no OpenClaw slug, like codex).
+ assert "antigravity" not in JARVIS_TO_OPENCLAW