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(brain): the evidence gate speaks the turn's language

Haraldf92e3ed2f73d
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 52a1eb08c2..c9c6f4b83c 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -5018,6 +5018,16 @@ class BrainManager:
# earlier snapshot is the stale picture that made the gate
# refuse a domain it could actually serve.
live_tool_names=self._live_tool_names(),
+ # The gate used to pick its refusal language by sniffing the
+ # utterance, which ignored the user's pin and knew only two
+ # languages — a Spanish user was told in English that there is
+ # no calendar access (OF-15). Resolved here with the same
+ # arguments the honesty phrase later uses, so one turn cannot
+ # speak two languages.
+ language=resolve_output_language(
+ getattr(self, "_reply_language", ""), "unknown", user_text,
+ default=DEFAULT_LOCALE,
+ ),
)
except Exception: # noqa: BLE001
log.debug("evidence gate degraded to PASS", exc_info=True)
diff --git a/tests/unit/brain/test_evidence_gate_wiring.py b/tests/unit/brain/test_evidence_gate_wiring.py
index 14480b857b..9b372ed7b9 100644
--- a/tests/unit/brain/test_evidence_gate_wiring.py
+++ b/tests/unit/brain/test_evidence_gate_wiring.py
@@ -197,3 +197,44 @@ async def test_prefetch_activity_block_no_tool_or_executor():
m._tools = {"awareness-recall": object()}
m._tool_executor = None
assert await m._prefetch_activity_block("awareness-recall", "x") == ""
+
+
+ ("pin", "expected_fragment"),
+ [
+ pytest.param("es", "calendario", id="spanish-pin"),
+ pytest.param("de", "Kalenderzugriff", id="german-pin"), # i18n-allow
+ pytest.param("en", "calendar access", id="english-pin"),
+ ],
+)
+def test_run_evidence_gate_refusal_follows_the_reply_language_pin(
+ monkeypatch, pin: str, expected_fragment: str,
+):
+ """The refusal speaks the turn's language, not the utterance's.
+
+ The gate used to sniff the utterance for its own refusal language and knew
+ only German and English, so a Spanish user asking in English was told in
+ English that there is no calendar access — the pin was ignored and there
+ was no Spanish table to reach (OF-15). The utterance below is English on
+ purpose: only the pin can produce the Spanish and German answers.
+ """
+ import jarvis.clis.shared as shared
+ import jarvis.core.capabilities as cap_mod
+
+ m = _bare_manager()
+ m._reply_language = pin
+ m._config = SimpleNamespace(
+ brain=SimpleNamespace(
+ evidence_domains=SimpleNamespace(
+ enabled=True,
+ domains={"calendar": ["calendar", "meetings"]},
+ )
+ )
+ )
+ monkeypatch.setattr(shared, "get_active_registry", lambda: None)
+ monkeypatch.setattr(cap_mod, "get_registry", lambda: cap_mod.CapabilityRegistry())
+
+ verdict = m._run_evidence_gate("What meetings do I have today?")
+
+ assert verdict.kind == "honest_refusal"
+ assert expected_fragment in verdict.refusal_text