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(vertex): Vertex as a subagent, and the keyless project reads as configured

Harald8e2c4d10a2c6
diff --git a/jarvis/brain/app_control.py b/jarvis/brain/app_control.py
index cb897d33c9..c7f4d575c8 100644
--- a/jarvis/brain/app_control.py
+++ b/jarvis/brain/app_control.py
@@ -102,8 +102,48 @@ AUTH_PROVIDER_ALIASES: dict[str, str] = {
# (config.PROVIDER_SECRET_CANDIDATES["codex"]); without this entry the
# presence check saw only the dedicated slot.
"codex": "codex",
+ # The Vertex family shares ONE credential across brain, STT, TTS and
+ # realtime, exactly as the Gemini rows above share theirs. ``vertex-live``
+ # keeps its own dedicated-slot-first family (a realtime-scoped key wins on
+ # its own surface).
+ "vertex": "vertex",
+ "vertex-stt": "vertex",
+ "vertex-tts": "vertex",
+ "vertex-live": "vertex-live",
}
+#: API-key providers that can ALSO authenticate with no key stored at all, and
+#: the ``jarvis.core.config`` probe that answers for them.
+#:
+#: Vertex AI is the case: its Google Cloud project path signs requests with
+#: Application Default Credentials — a service account, a ``gcloud`` login,
+#: workload identity — so nothing lands in the keyring. Without this the setup
+#: Google documents for production reads as "open" on all four cards and every
+#: switch to it is refused for a missing key. Same shape as the ``codex`` and
+#: ``antigravity`` branches below, which fall back to a login probe for exactly
+#: the same reason; this table just makes it declarative instead of a fourth
+#: hand-written branch.
+KEYLESS_CREDENTIAL_PROBES: dict[str, str] = {
+ "vertex": "vertex_credential_configured",
+ "vertex-stt": "vertex_credential_configured",
+ "vertex-tts": "vertex_credential_configured",
+ "vertex-live": "vertex_credential_configured",
+}
+
+
+def _keyless_credential_present(provider_id: str) -> bool:
+ """Whether *provider_id* authenticates without a stored key. Never raises."""
+ probe_name = KEYLESS_CREDENTIAL_PROBES.get(provider_id)
+ if not probe_name:
+ return False
+ try:
+ return bool(getattr(cfg_mod, probe_name)())
+ except Exception as exc: # noqa: BLE001 — a probe must never break a card
+ log.debug(
+ "Keyless credential probe %s for %s failed: %s", probe_name, provider_id, exc
+ )
+ return False
+
# Local providers that need no credential at all — the same spec-derived set
# as LOCAL_PROVIDERS (auth_mode "none" IS the definition of "no credential").
# is_credential_present() independently reports auth_mode=="none" providers as
@@ -224,8 +264,13 @@ def is_credential_present(spec: ProviderSpec, binary_path: str | None = None) ->
if spec.auth_mode == "api_key":
secret_provider = AUTH_PROVIDER_ALIASES.get(spec.id)
if secret_provider is not None:
- return bool(cfg_mod.get_provider_secret(secret_provider))
- return all(bool(cfg_mod.get_secret(k)) for k in spec.secret_keys)
+ if cfg_mod.get_provider_secret(secret_provider):
+ return True
+ elif all(bool(cfg_mod.get_secret(k)) for k in spec.secret_keys):
+ return True
+ # A key is the usual answer but not the only one — see
+ # KEYLESS_CREDENTIAL_PROBES (Vertex's Cloud project path).
+ return _keyless_credential_present(spec.id)
if spec.auth_mode == "codex":
if any(bool(cfg_mod.get_secret(k)) for k in spec.secret_keys):
return True
@@ -765,6 +810,17 @@ async def _switch_subagent(
has_credential = native_status is not None
except Exception: # noqa: BLE001 — optional native CLI auth path
has_credential = False
+ if not has_credential and canon == "vertex":
+ # Vertex AI's Google Cloud project path signs with Application Default
+ # Credentials and stores NO key, so the key probe above reports the
+ # setup Google documents for production as unconfigured. Sibling of the
+ # claude-api OAuth rescue directly above: an on-disk login is a
+ # credential (AP-22). Asked through the shared credential state so this
+ # gate and the Vertex card can never disagree.
+ try:
+ has_credential = bool(cfg_mod.vertex_credential_configured())
+ except Exception as exc: # noqa: BLE001 — a probe must not block the switch
+ log.debug("Vertex credential probe failed during switch: %s", exc)
if not has_credential:
return {
"ok": False,
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 056bbfafab..6012fac3c8 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -394,6 +394,23 @@ TIER_DEFAULTS_BY_PROVIDER: dict[str, dict[str, str]] = {
},
}
+def _mirror_tier_defaults(source: str, target: str) -> None:
+ """Give ``target`` the same per-tier default models as ``source``.
+
+ For provider families that are the same catalogue on a different endpoint.
+ Re-typing the ids instead would create a second literal list that drifts on
+ the next model rotation — the BUG-008 shape — and it would drift on exactly
+ the tier a production project cares about most.
+ """
+ for tier in TIER_DEFAULTS_BY_PROVIDER.values():
+ if source in tier:
+ tier[target] = tier[source]
+
+
+# Vertex AI serves the SAME Gemini model ids as AI Studio; the endpoint and the
+# billing account differ, the catalogue does not.
+_mirror_tier_defaults("gemini", "vertex")
+
# Hard loop bounds for DELEGATED realtime voice turns (prefer_tool_model).
# A voice turn must stay conversational: 6 rounds cover plan → 2-3 tools →
diff --git a/jarvis/brain/model_catalog.py b/jarvis/brain/model_catalog.py
index 5a7f47c07c..4c00712282 100644
--- a/jarvis/brain/model_catalog.py
+++ b/jarvis/brain/model_catalog.py
@@ -641,6 +641,30 @@ STT_CATALOG: dict[str, list[ModelInfo]] = {
}
+def _gemini_audio_models(default_first: str) -> list[ModelInfo]:
+ """The Gemini brain catalogue, reordered so ``default_first`` leads.
+
+ Gemini transcription is not a separate speech model: it is an ordinary
+ ``generateContent`` call with an audio part, so ANY multimodal Gemini id can
+ do it — which is why the recognizer's own module refuses to pin one (AP-21).
+ Reusing the brain list is therefore both correct and the only way to avoid a
+ second literal that drifts on the next model rotation. Putting the
+ recognizer's actual default at the top keeps the picker from opening on a
+ model the provider would not have used.
+ """
+ models = list(CURATED_MODELS.get("gemini", ()))
+ leader = [m for m in models if m.id == default_first]
+ return leader + [m for m in models if m.id != default_first]
+
+
+# Both Google recognizers share one derived list — same models, two accounts.
+# The default id mirrors ``jarvis.plugins.stt.gemini_api.DEFAULT_MODEL``; it is
+# spelled here rather than imported so the catalog module keeps importing on a
+# host without google-genai.
+STT_CATALOG["gemini-api"] = _gemini_audio_models("gemini-3-flash-preview")
+STT_CATALOG["vertex-stt"] = STT_CATALOG["gemini-api"]
+
+
@dataclass(frozen=True, slots=True)
class CatalogSpec:
"""Per-provider picker spec: which tier, what it selects, the curated list,
@@ -706,6 +730,18 @@ def _build_provider_catalog() -> dict[str, CatalogSpec]:
# model as Anthropic rotates it, which is exactly right for a subscription
# path where the account's plan decides what is reachable anyway. Leaving the
# model unset is also valid and means "whatever this plan defaults to".
+ # Vertex AI — the SAME Gemini catalogue on Google's enterprise endpoint, so
+ # the curated list is REUSED rather than re-typed (a second literal would
+ # drift on the next model rotation). Curated-only, `live=False`: express
+ # mode documents exactly three methods — generateContent,
+ # streamGenerateContent, countTokens — and no model-list endpoint, and the
+ # project path's list call needs an OAuth token rather than the key the
+ # catalog fetcher attaches. Promising a live fetch we cannot make would show
+ # the user an empty picker on a working account; the curated list is the
+ # honest one, and a newer model can still be typed into the model field.
+ cat["vertex"] = CatalogSpec(
+ "brain", "model", tuple(CURATED_MODELS.get("gemini", ())), live=False
+ )
cat["claude-cli"] = CatalogSpec(
"brain",
"model",
@@ -724,6 +760,13 @@ def _build_provider_catalog() -> dict[str, CatalogSpec]:
cat[p] = CatalogSpec("tts", selects, tuple(opts), live=False)
for p, opts in STT_CATALOG.items():
cat[p] = CatalogSpec("stt", "model", tuple(opts), live=False)
+ # The Vertex TTS card offers the identical 30-voice Gemini roster on a
+ # different account, so it mirrors its sibling's picker rather than repeating
+ # it — a voice added to the curated catalogue reaches both in one edit. (The
+ # two STT cards share their list inside ``STT_CATALOG`` itself, above.)
+ mirrored_tts = cat.get("gemini-flash-tts")
+ if mirrored_tts is not None:
+ cat["vertex-tts"] = mirrored_tts
return cat
diff --git a/jarvis/brain/provider_test.py b/jarvis/brain/provider_test.py
index 97516ecc7f..4b055a1cc5 100644
--- a/jarvis/brain/provider_test.py
+++ b/jarvis/brain/provider_test.py
@@ -355,7 +355,22 @@ async def _default_realtime_probe(spec: Any, cfg: Any, *, timeout_s: float) -> f
credentials = tuple(getattr(provider_cls, "credential_candidates", ()) or ())
api_key = get_secret_any(credentials) if credentials else None
if credentials and not api_key:
- raise RuntimeError("No API key configured for the realtime provider")
+ # Declaring key slots does not mean a key is the ONLY way in. A provider
+ # that also authenticates through a login outside this app exposes the
+ # same ``external_login_ready`` capability the session factory reads —
+ # Vertex AI's Google Cloud project path is the case, where Application
+ # Default Credentials sign the request and no key is stored anywhere.
+ # Refusing on the empty slot alone reported that working setup as
+ # unconfigured, which is the "I added it and nothing happened" failure.
+ external_login_ready = getattr(provider_cls, "external_login_ready", None)
+ ready = False
+ if callable(external_login_ready):
+ try:
+ ready = bool(external_login_ready(cfg))
+ except TypeError:
+ ready = bool(external_login_ready())
+ if not ready:
+ raise RuntimeError("No API key configured for the realtime provider")
if api_key:
provider = provider_cls(api_key=api_key)
else:
diff --git a/jarvis/missions/init.py b/jarvis/missions/init.py
index 35a82deb20..18fe9e2c80 100644
--- a/jarvis/missions/init.py
+++ b/jarvis/missions/init.py
@@ -85,8 +85,11 @@ def _spawn_boot_cleanup(coro: Any, *, name: str) -> asyncio.Task[Any]:
# decision so the UI "runs on Claude" badge can never drift from reality.
# ollama/local-openai (2026-07-25): keyless local servers, same in-process
# tool-loop path — a mission can run fully on the user's own hardware.
+# vertex: Google Cloud Vertex AI runs the SAME in-process tool loop as the
+# other API providers, on the VertexBrain — so picking it as the subagent
+# actually runs the mission on Vertex instead of silently falling back to Claude.
_API_AGENT_SLUGS: frozenset[str] = frozenset(
- {"openai", "openrouter", "grok", "nvidia", "ollama", "local-openai"}
+ {"openai", "openrouter", "grok", "nvidia", "ollama", "local-openai", "vertex"}
)
diff --git a/jarvis/missions/worker_runtime/provider_map.py b/jarvis/missions/worker_runtime/provider_map.py
index fa71d47dcf..eb58514f36 100644
--- a/jarvis/missions/worker_runtime/provider_map.py
+++ b/jarvis/missions/worker_runtime/provider_map.py
@@ -119,6 +119,14 @@ MAPPINGS: Final[tuple[ProviderMapping, ...]] = (
# selectable subagent in the API-Keys "Subagents" tab and env/slug lookups
# stay consistent.
ProviderMapping("nvidia", "nvidia", "NVIDIA_API_KEY"),
+ # Google Cloud Vertex AI: runs through the in-process ApiAgentWorker on the
+ # VertexBrain, like nvidia — there is no worker-harness slug for it, so
+ # ``worker_slug`` is a stable identity for display and reverse lookup only.
+ # The row is what makes Vertex selectable in the API-Keys "Subagents" tab.
+ # ENV names mirror the Vertex key slots; on the Google Cloud project path
+ # there is no key to hand over and the worker authenticates via Application
+ # Default Credentials inherited from the parent process env.
+ ProviderMapping("vertex", "vertex", "VERTEX_API_KEY", "GOOGLE_VERTEX_API_KEY"),
# Keyless local providers (2026-07-25, local-first mandate): both run
# through the in-process ApiAgentWorker like nvidia — the row exists so
# they are selectable in the Agents tab. The env vars are credential-shaped
diff --git a/jarvis/missions/workers/api_agent_worker.py b/jarvis/missions/workers/api_agent_worker.py
index a2fcde8fc7..37f6866ce7 100644
--- a/jarvis/missions/workers/api_agent_worker.py
+++ b/jarvis/missions/workers/api_agent_worker.py
@@ -103,6 +103,11 @@ _BRAIN_BY_PROVIDER: dict[str, tuple[str, str]] = {
# (subscription-first) when its binary is present; this is the API fallback.
"claude-api": ("jarvis.plugins.brain.claude_api", "ClaudeAPIBrain"),
"gemini": ("jarvis.plugins.brain.gemini", "GeminiBrain"),
+ # Google Cloud Vertex AI — the same Gemini tool loop on the enterprise
+ # endpoint. Keyless is legitimate here (unlike for the cloud API families
+ # above): the Cloud project path signs with Application Default
+ # Credentials, so VertexBrain builds fine with no key in any slot.
+ "vertex": ("jarvis.plugins.brain.vertex", "VertexBrain"),
# Keyless local providers (2026-07-25): same in-process tool loop against
# the user's own server — heavy missions with zero cloud keys. Keyless is
# tolerated by design: get_jarvis_agent_secret returns None and the
@@ -129,6 +134,9 @@ _DEFAULT_MODEL: dict[str, str] = {
# NVIDIA's own reasoning flagship for heavy subagent work.
"nvidia": "nvidia/llama-3.1-nemotron-ultra-253b-v1",
}
+# Vertex serves the same Gemini catalogue on Google Cloud, so its worker default
+# is the Gemini one rather than a second literal that would drift from it.
+_DEFAULT_MODEL["vertex"] = _DEFAULT_MODEL["gemini"]
def _resolve_worker_model(provider: str, explicit: str) -> str:
diff --git a/tests/unit/brain/test_vertex_family_parity.py b/tests/unit/brain/test_vertex_family_parity.py
new file mode 100644
index 0000000000..93e25971d9
--- /dev/null
+++ b/tests/unit/brain/test_vertex_family_parity.py
@@ -0,0 +1,343 @@
+"""Drift guard: Vertex AI is wired into EVERY tier, not just the brain.
+
+The point of the Vertex family is that one Google Cloud setup serves the whole
+stack — the thinking model, the tool model, voice input, voice output, the
+realtime socket, and the subagents. Each of those is a separate registration in
+a separate table, and a family that reaches only some of them is the failure
+mode that reads as "I added my key and it did nothing": the card appears, the
+key saves, and the tier the user actually wanted silently keeps running on
+another account.
+
+Same single-source-of-truth shape as the other BUG-008 enum-drift guards
+(``docs/anti-drift-three-layer.md``): the tests below assert the registrations
+exist and agree with each other, so removing one half of a pair fails here
+rather than in a user's voice session.
+
+Deliberately free of network, SDK and credentials — every assertion is about
+registration tables and class attributes.
+"""
+
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.brain.manager import TIER_DEFAULTS_BY_PROVIDER
+from jarvis.brain.model_catalog import catalog_spec
+from jarvis.brain.provider_registry import BrainProviderRegistry
+from jarvis.core.config import (
+ JARVIS_AGENT_SECRET_CANDIDATES,
+ PROVIDER_SECRET_CANDIDATES,
+)
+from jarvis.core.registry import list_plugins
+from jarvis.ui.web.provider_spec import PROVIDERS
+
+#: One provider id per tier. The whole promise of the family in one table.
+VERTEX_IDS_BY_TIER = {
+ "brain": "vertex",
+ "stt": "vertex-stt",
+ "tts": "vertex-tts",
+ "realtime": "vertex-live",
+}
+
+#: Entry-point group each tier's plugin is discovered through.
+_GROUP_BY_TIER = {
+ "brain": "jarvis.brain",
+ "stt": "jarvis.stt",
+ "tts": "jarvis.tts",
+ "realtime": "jarvis.realtime",
+}
+
+
+# ── every tier has a registered plugin AND a card ────────────────────────────
+
+
[email protected](("tier", "provider_id"), sorted(VERTEX_IDS_BY_TIER.items()))
+def test_every_tier_registers_a_vertex_plugin(tier: str, provider_id: str) -> None:
+ installed = list_plugins(_GROUP_BY_TIER[tier])
+ assert provider_id in installed, (
+ f"{provider_id!r} is not registered in {_GROUP_BY_TIER[tier]!r}. Without "
+ f"the entry point the {tier} tier cannot resolve Vertex at all, however "
+ f"complete the rest of the wiring looks."
+ )
+
+
[email protected](("tier", "provider_id"), sorted(VERTEX_IDS_BY_TIER.items()))
+def test_every_tier_has_a_selectable_card(tier: str, provider_id: str) -> None:
+ """A plugin with no card is a feature the app has but does not offer."""
+ spec = next((s for s in PROVIDERS if s.id == provider_id), None)
+ assert spec is not None, f"no ProviderSpec for {provider_id!r}"
+ assert spec.tier == tier
+ assert spec.hidden is False
+ assert spec.auth_mode == "api_key"
+ # The Cloud-project path must be documented ON the card: it is the setup
+ # that stores no key, so a user reading only the key field would conclude
+ # Vertex needs one.
+ assert spec.alt_credential is not None
+ assert "vertex_project" in (spec.alt_credential.credential_help or "")
+
+
[email protected](("tier", "provider_id"), sorted(VERTEX_IDS_BY_TIER.items()))
+def test_every_card_has_a_picker_catalog(tier: str, provider_id: str) -> None:
+ """Realtime has no picker; the other three would 400 without a catalog."""
+ if tier == "realtime":
+ pytest.skip("the realtime tier has no model/voice picker")
+ spec = catalog_spec(provider_id)
+ assert spec is not None and spec.tier == tier
+ assert spec.curated, f"{provider_id!r} would open an empty picker"
+
+
+# ── the credential is ONE credential, shared across the tiers ────────────────
+
+
+def test_the_vertex_key_slot_is_shared_by_every_tier() -> None:
+ """Set Vertex up once. A second slot per tier would be a second setup."""
+ shared = "vertex_api_key"
+ brain_slots = {slot for slot, _env in PROVIDER_SECRET_CANDIDATES["vertex"]}
+ realtime_slots = {slot for slot, _env in PROVIDER_SECRET_CANDIDATES["vertex-live"]}
+ agent_slots = {slot for slot, _env in JARVIS_AGENT_SECRET_CANDIDATES["vertex"]}
+ assert shared in brain_slots
+ assert shared in realtime_slots
+ assert shared in agent_slots
+
+
+def test_realtime_and_agent_tiers_keep_their_own_dedicated_slot_first() -> None:
+ """A scoped key must win on its own surface, exactly like its siblings."""
+ assert PROVIDER_SECRET_CANDIDATES["vertex-live"][0][0] == "realtime_vertex_api_key"
+ assert JARVIS_AGENT_SECRET_CANDIDATES["vertex"][0][0] == "jarvis_agent_vertex_api_key"
+
+
+def test_vertex_never_reads_a_gemini_slot_and_gemini_never_reads_a_vertex_one() -> None:
+ """The two accounts are separate, and a cross-read would be a silent failure.
+
+ Feeding an AI Studio key to the Vertex endpoint does not degrade — it 401s
+ every single call, while the UI shows a configured provider. An honest "no
+ credential" is strictly better, so the families stay disjoint in BOTH
+ directions.
+ """
+ vertex_families = ("vertex", "vertex-live")
+ gemini_families = ("gemini", "gemini-live")
+ vertex_slots = {
+ slot for family in vertex_families for slot, _env in PROVIDER_SECRET_CANDIDATES[family]
+ }
+ gemini_slots = {
+ slot for family in gemini_families for slot, _env in PROVIDER_SECRET_CANDIDATES[family]
+ }
+ assert not (vertex_slots & gemini_slots), (
+ "a slot is shared between the Vertex and Gemini families — one of them "
+ f"will be handed a key its endpoint rejects: {sorted(vertex_slots & gemini_slots)}"
+ )
+
+
+# ── brain: pinned route, and the same models as its sibling ──────────────────
+
+
+def test_the_brain_plugin_pins_the_vertex_route() -> None:
+ """Unpinned, an ``AIza`` Cloud key would be probed onto AI Studio and fail."""
+ from jarvis.plugins.brain.vertex import VertexBrain
+
+ assert VertexBrain.pinned_route == "vertex"
+ assert VertexBrain.provider_id == "vertex"
+ assert VertexBrain.name == "vertex"
+ # Inherited, not reimplemented: the whole point of the subclass.
+ from jarvis.plugins.brain.gemini import GeminiBrain
+
+ assert issubclass(VertexBrain, GeminiBrain)
+ assert VertexBrain.supports_tools is True
+ assert VertexBrain.supports_vision is True
+
+
+def test_the_gemini_brain_is_left_on_the_inferring_route() -> None:
+ """The existing behaviour for a key in a Gemini slot must not change."""
+ from jarvis.plugins.brain.gemini import GeminiBrain
+
+ assert GeminiBrain.pinned_route is None
+ assert GeminiBrain.provider_id == "gemini"
+
+
[email protected]("tier", ["router", "deep"])
+def test_tier_defaults_match_gemini_exactly(tier: str) -> None:
+ """Vertex serves the same catalogue; a second literal list would drift."""
+ defaults = TIER_DEFAULTS_BY_PROVIDER[tier]
+ assert defaults["vertex"] == defaults["gemini"]
+ assert defaults["vertex"], "an empty default would fall back to the plugin anchor"
+
+
+def test_the_brain_is_registered_and_loadable() -> None:
+ registry = BrainProviderRegistry()
+ assert "vertex" in registry.available(), registry.failed()
+ assert registry.get_class("vertex").name == "vertex"
+
+
+def test_the_tool_model_tier_can_select_vertex() -> None:
+ """The tool model is its own selection, and must reach Vertex like any other."""
+ from jarvis.brain import resolver
+
+ resolver._reset_for_tests()
+ config = SimpleNamespace(
+ brain=SimpleNamespace(
+ tool_model=SimpleNamespace(provider="vertex"),
+ providers={"vertex": SimpleNamespace(model="gemini-3.5-flash")},
+ )
+ )
+ brain = resolver.resolve_tool_model_brain(config)
+ resolver._reset_for_tests()
+ assert brain is not None, "the tool-model tier could not instantiate Vertex"
+ assert brain.name == "vertex"
+
+
+# ── speech tiers: own credential family, and in the cross-family order ───────
+
+
+def test_stt_knows_the_vertex_family_and_will_cross_to_it() -> None:
+ from jarvis.plugins.stt import (
+ _STT_CROSS_FAMILY_ORDER,
+ _STT_SECRET_CANDIDATES,
+ stt_family_id,
+ )
+
+ assert "vertex-stt" in _STT_SECRET_CANDIDATES
+ assert "vertex-stt" in _STT_CROSS_FAMILY_ORDER
+ # A distinct family: a depleted AI Studio key must be able to cross HERE.
+ assert stt_family_id("vertex-stt") != stt_family_id("gemini-api")
+
+
+def test_tts_knows_the_vertex_family_and_will_cross_to_it() -> None:
+ from jarvis.plugins.tts import (
+ _TTS_CROSS_FAMILY_ORDER,
+ _TTS_SECRET_CANDIDATES,
+ _canonical_tts_name,
+ )
+
+ assert "vertex-tts" in _TTS_SECRET_CANDIDATES
+ assert "vertex-tts" in _TTS_CROSS_FAMILY_ORDER
+ # Spelling tolerance, like every other TTS family (BUG-008 class).
+ for spelling in ("vertex", "vertex-tts", "Vertex-AI"):
+ assert _canonical_tts_name(spelling) == "vertex-tts"
+ # The bare "gemini" spelling must still mean the AI Studio card.
+ assert _canonical_tts_name("gemini") == "gemini-flash-tts"
+
+
+def test_realtime_declares_a_distinct_credential_family() -> None:
+ """Equal families would turn a real cross-account fallback into a doomed retry."""
+ from jarvis.plugins.realtime.gemini_live import (
+ GeminiLiveProvider,
+ VertexLiveProvider,
+ )
+
+ assert VertexLiveProvider.credential_family == "vertex"
+ assert VertexLiveProvider.credential_family != GeminiLiveProvider.credential_family
+ assert VertexLiveProvider.supports_realtime is True
+ assert issubclass(VertexLiveProvider, GeminiLiveProvider)
+
+
+def test_realtime_is_eligible_on_a_keyless_cloud_project(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """The factory skips keyless API providers unless they declare another login.
+
+ Without that declaration the documented production setup — a Cloud project,
+ no key anywhere — would never even become a realtime candidate.
+ """
+ from jarvis.core import config as cfg
+ from jarvis.plugins.realtime.gemini_live import VertexLiveProvider
+
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda *_a, **_k: True)
+ assert VertexLiveProvider.external_login_ready(None) is True
+
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda *_a, **_k: False)
+ assert VertexLiveProvider.external_login_ready(None) is False
+
+
+# ── subagents ────────────────────────────────────────────────────────────────
+
+
+def test_a_vertex_subagent_runs_on_vertex_rather_than_falling_back_to_claude() -> None:
+ """Picking a provider must RUN that provider — the standing mandate here."""
+ from jarvis.missions.init import (
+ _API_AGENT_SLUGS,
+ _select_subagent_worker_kind,
+ subagent_runs_on_claude_fallback,
+ )
+
+ assert "vertex" in _API_AGENT_SLUGS
+ assert _select_subagent_worker_kind("vertex", "") == "api_agent"
+ # A per-step model must not divert it either (the hard-lock property).
+ assert _select_subagent_worker_kind("vertex", "gemini-3.5-flash") == "api_agent"
+ assert subagent_runs_on_claude_fallback("vertex") is False
+
+
+def test_the_subagent_worker_can_build_a_vertex_brain() -> None:
+ from jarvis.missions.workers.api_agent_worker import (
+ _BRAIN_BY_PROVIDER,
+ _DEFAULT_MODEL,
+ _build_brain,
+ )
+
+ assert "vertex" in _BRAIN_BY_PROVIDER
+ assert _DEFAULT_MODEL["vertex"] == _DEFAULT_MODEL["gemini"]
+ brain = _build_brain("vertex", _DEFAULT_MODEL["vertex"])
+ assert brain.name == "vertex"
+
+
+# ── the keyless Cloud project counts as configured, everywhere it is asked ───
+
+
[email protected]("provider_id", sorted(VERTEX_IDS_BY_TIER.values()))
+def test_a_keyless_cloud_project_reads_as_configured_on_every_card(
+ provider_id: str, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Otherwise Google's documented production setup shows as "open".
+
+ Every card's state, every switch gate and the Test button all flow through
+ ``is_credential_present``. With a key probe alone, an install whose Vertex
+ access is a service account would be told to add a key it does not need —
+ the "I set it up and nothing happened" failure.
+ """
+ from jarvis.brain import app_control
+ from jarvis.core import config as cfg
+
+ spec = next(s for s in PROVIDERS if s.id == provider_id)
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda *_a, **_k: True)
+ with cfg.override_provider_secrets({"vertex": None, "vertex-live": None}):
+ assert app_control.is_credential_present(spec) is True
+
+
[email protected]("provider_id", sorted(VERTEX_IDS_BY_TIER.values()))
+def test_no_key_and_no_project_still_reads_as_unconfigured(
+ provider_id: str, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """The rescue must not turn every Vertex card permanently green."""
+ from jarvis.brain import app_control
+ from jarvis.core import config as cfg
+
+ spec = next(s for s in PROVIDERS if s.id == provider_id)
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda *_a, **_k: False)
+ with cfg.override_provider_secrets({"vertex": None, "vertex-live": None}):
+ assert app_control.is_credential_present(spec) is False
+
+
+def test_the_keyless_rescue_is_scoped_to_vertex(monkeypatch: pytest.MonkeyPatch) -> None:
+ """A missing Gemini key must still read as missing, probe or no probe."""
+ from jarvis.brain import app_control
+ from jarvis.core import config as cfg
+
+ spec = next(s for s in PROVIDERS if s.id == "gemini")
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda *_a, **_k: True)
+ with cfg.override_provider_secrets({"gemini": None}):
+ assert app_control.is_credential_present(spec) is False
+
+
+def test_the_subagent_tab_can_map_the_vertex_slug() -> None:
+ from jarvis.missions.worker_runtime.provider_map import (
+ env_vars_for,
+ to_jarvis_from_worker_slug,
+ to_worker_slug,
+ validate_configured_providers,
+ )
+
+ assert to_worker_slug("vertex") == "vertex"
+ assert to_jarvis_from_worker_slug("vertex") == "vertex"
+ assert env_vars_for("vertex")[0] == "VERTEX_API_KEY"
+ assert validate_configured_providers(["vertex"]) == []