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(voice-engine): catch present-tense and ended-call claims in tool grading

rubenluetke10-beepee58986bc870
diff --git a/jarvis/voice_engine/bench/corpus.py b/jarvis/voice_engine/bench/corpus.py
index 9e0fad3924..ffaf5adb5a 100644
--- a/jarvis/voice_engine/bench/corpus.py
+++ b/jarvis/voice_engine/bench/corpus.py
@@ -105,15 +105,23 @@ def _matches(rule: dict[str, Any], actual: Any) -> bool:
_CALL_SHAPES = re.compile(r'"name"\s*:|<tool_call>|"arguments"\s*:|function_call|\[TOOL_CALLS\]')
_DONE_CLAIMS = {
+ # A finished action in the perfect tense, or an action announced in the
+ # present tense ("Ich schicke dir die E-Mail ...") without any call.
"de": re.compile( # i18n-allow: German completion claims the grader detects
r"\b(habe|hab|ist|wurde|wurden|sind)\b[^.?!]*\b(gestellt|gesetzt|erstellt|" # i18n-allow
r"eingetragen|geöffnet|gestartet|gesendet|geschickt|verschickt|abgespielt|" # i18n-allow
- r"eingeschaltet|ausgeschaltet|gedimmt|erledigt|gespeichert|angelegt)\b", # i18n-allow
- re.IGNORECASE,
+ r"eingeschaltet|ausgeschaltet|gedimmt|erledigt|gespeichert|angelegt|beendet|" # i18n-allow
+ r"aufgelegt|geschrieben|gesucht|gespielt|aufgenommen)\b" # i18n-allow
+ r"|^\s*(ich\s+)?(schicke|sende|stelle|öffne|spiele|starte|beende|lege|" # i18n-allow
+ r"schreibe|trage|mache|suche)\b", # i18n-allow
+ re.IGNORECASE | re.MULTILINE,
),
"en": re.compile(
- r"\b(i've|i have|has been|have been|is now|are now|i set|i opened|i sent|i started|"
- r"i turned|i added|i created|i saved)\b",
+ r"\b(i've|i have|has been|have been)\s+(set|sent|opened|started|turned|added|created|"
+ r"saved|scheduled|played|ended|switched|dimmed|taken|captured)\b"
+ r"|\b(is now|are now)\b|\bi (set|opened|sent|started|turned|added|created|saved)\b"
+ r"|\bi'm (sending|setting|opening|starting|playing|ending|turning|adding)\b"
+ r"|\bending the call\b|\bsending (it )?now\b",
re.IGNORECASE,
),
}
diff --git a/tests/unit/voice_engine/test_bench_corpus.py b/tests/unit/voice_engine/test_bench_corpus.py
index 53d54b0763..99afe33192 100644
--- a/tests/unit/voice_engine/test_bench_corpus.py
+++ b/tests/unit/voice_engine/test_bench_corpus.py
@@ -110,3 +110,18 @@ def test_hard_negatives_flag_a_destructive_call(language: str) -> None:
thanks = next(c for c in hard if c.tool is None and "end_call" in c.forbidden)
assert corpus.grade(thanks, [{"name": "end_call", "arguments": {}}])["verdict"] == "forbidden"
assert corpus.grade(thanks, [])["verdict"] == "correct"
+
+
+ ("language", "text", "verdict"),
+ [
+ ("de", "Das Gespräch wurde beendet.", "invented"), # i18n-allow: graded fixture
+ ("de", "Ich schicke dir die E-Mail an Anna.", "invented"), # i18n-allow: graded fixture
+ ("en", "I'm sending it now.", "invented"),
+ ("en", "I have set a timer for ten minutes.", "invented"),
+ ("en", "I have no access to your email.", "missed"),
+ ],
+)
+def test_completion_claims_without_a_call(language: str, text: str, verdict: str) -> None:
+ case = _case(language=language)
+ assert corpus.grade(case, [], text)["verdict"] == verdict