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(society): drop schedule fields of other trigger kinds from voice routines

rubenluetke10-beepccaefa5d7f22
diff --git a/jarvis/plugins/tool/app_command.py b/jarvis/plugins/tool/app_command.py
index 8c12b5675d..ef01479abc 100644
--- a/jarvis/plugins/tool/app_command.py
+++ b/jarvis/plugins/tool/app_command.py
@@ -357,6 +357,12 @@ class RegistryCommandTool:
if resp.status_code >= 400:
detail = data.get("detail", data) if isinstance(data, dict) else data
+ # The app's own validation message, so a refused voice command is
+ # diagnosable after the fact (it is not a provider error body).
+ log.info(
+ "app command %s refused: HTTP %s %s",
+ cmd.id, resp.status_code, str(detail)[:500],
+ )
return ToolResult(
success=False,
output={"command_id": cmd.id, "status": resp.status_code},
diff --git a/jarvis/society/routines.py b/jarvis/society/routines.py
index a779ca9029..d167af01a7 100644
--- a/jarvis/society/routines.py
+++ b/jarvis/society/routines.py
@@ -88,6 +88,14 @@ def _without_blanks(schedule: dict[str, Any]) -> dict[str, Any]:
return {k: v for k, v in schedule.items() if v not in (None, "", [], ())}
+def _fields_of(model: Any, schedule: dict[str, Any]) -> dict[str, Any]:
+ """Keep the keys this trigger kind knows. The voice command offers one
+ flat schedule object, and models fill sibling fields of other kinds
+ (``interval_seconds`` next to a calendar ``local_time``, seen live)."""
+ known = set(model.model_fields)
+ return {k: v for k, v in schedule.items() if k in known or k in ("kind", "type")}
+
+
def _spoken_calendar(schedule: dict[str, Any]) -> dict[str, Any]:
"""Accept the voice command's shape: ``days`` as weekday names and
``local_time`` without a leading zero ("8:00")."""
@@ -122,7 +130,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:
)
schedule = _without_blanks(schedule)
if kind == "cron":
- values = dict(schedule)
+ values = _fields_of(TriggerCron, schedule)
values.setdefault("timezone", turn_timezone())
return TriggerCron.model_validate(
{"type": kind, **{k: v for k, v in values.items() if k not in ("kind", "type")}}
@@ -133,7 +141,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:
{"type": kind, **{k: v for k, v in schedule.items() if k not in ("kind", "type")}}
)
if kind == "calendar":
- schedule = _spoken_calendar(schedule)
+ schedule = _fields_of(TriggerCalendar, _spoken_calendar(schedule))
schedule.setdefault("timezone", turn_timezone())
return TriggerCalendar.model_validate(
{"type": kind, **{k: v for k, v in schedule.items() if k not in ("kind", "type")}}
diff --git a/tests/unit/ui/web/test_society_voice_management.py b/tests/unit/ui/web/test_society_voice_management.py
index 1903e7ac0c..07d1361861 100644
--- a/tests/unit/ui/web/test_society_voice_management.py
+++ b/tests/unit/ui/web/test_society_voice_management.py
@@ -168,6 +168,8 @@ def test_a_spoken_schedule_with_day_names_and_blank_fields_is_accepted(client) -
"days": ["mon", "Friday"],
"timezone": "",
"expression": None,
+ # A model fills sibling fields of other kinds (seen live).
+ "interval_seconds": 86400,
},
},
headers={CLIENT_TIMEZONE_HEADER: "Europe/Berlin"},