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): fit every named tool into a small model's budget, and watch the one busy agent (#695)

Ruben Lütkef93b2074610c
diff --git a/jarvis/agentic_ide/orchestration.py b/jarvis/agentic_ide/orchestration.py
index 09f4073ded..835bdb4f4c 100644
--- a/jarvis/agentic_ide/orchestration.py
+++ b/jarvis/agentic_ide/orchestration.py
@@ -442,7 +442,8 @@ class WorkspaceOrchestrator:
from . import followthrough
- picked = await self._pane(args)
+ named = any(str(args.get(key) or "").strip() for key in ("terminal_id", "agent"))
+ picked = await self._pane(args) if named else self._the_one_busy_pane()
if isinstance(picked, dict):
return picked
_owner, term, target = picked
@@ -846,6 +847,39 @@ class WorkspaceOrchestrator:
logger.warning("Workspace change was not announced to the UI: {}", exc)
+ def _the_one_busy_pane(self) -> tuple[Any, Any, dict[str, str]] | dict:
+ """The agent "the coding agent" means when no name is given: the one in a turn.
+
+ With several agents working the request stays ambiguous and their
+ call-signs are offered; with none there is nothing to wait for.
+ """
+ busy = [
+ (session, term)
+ for session in self.registry.sessions
+ for term in session.terminals
+ if snapshot(term)["availability"] == "busy"
+ ]
+ if len(busy) != 1:
+ return {
+ "status": "needs_clarification",
+ "kind": "agent",
+ "reason": (
+ "Name the coding agent (its call-sign) or pass terminal_id."
+ if not busy
+ else "Several agents are working; name the one to watch."
+ ),
+ "working": [term.name for _session, term in busy],
+ }
+ from . import library
+
+ session, term = busy[0]
+ target = {
+ "project_id": session.project_id or library.project_id_for(session.folder),
+ "workspace_id": session.id,
+ "terminal_id": "pane:" + term.history_id,
+ }
+ return session, term, target
+
async def _pane(self, args: dict[str, Any]) -> tuple[Any, Any, dict[str, str]] | dict:
"""The one open pane a request names, by IDs from resolve or by call-sign."""
if str(args.get("terminal_id") or "").strip():
diff --git a/jarvis/live/coordination.py b/jarvis/live/coordination.py
index d3335a8bb9..0025eb953e 100644
--- a/jarvis/live/coordination.py
+++ b/jarvis/live/coordination.py
@@ -19,10 +19,13 @@ WORK_STATUS_RULE: Final[str] = (
"Say the takeaway in a sentence or two and name who "
"needs the user; never read out lists, diffs or code. When the user wants to "
"hear when an agent they started themselves is done, call workspace-orchestrate "
- "with action watch for it; a task you sent is reported back on its own. "
+ "with action watch for it right away, in this turn: the end is then reported to "
+ "you by itself, and you say it. A task you sent is reported back on its own. "
"A workspace's repository is workspace-git, with op state for its branch and "
"changed files: also its worktrees, a new worktree when the user asks for one, "
"putting one away or bringing it back, commit, push and pull request. "
+ "A mission that is still running takes the user's correction through "
+ "mission-amend, with its mission_id from task_status; it is never restarted for it. "
)
@@ -54,6 +57,7 @@ NAMED_TOOLS: Final[tuple[str, ...]] = (
"show_on_screen",
"navigate",
"ask_agent",
+ "mission-amend",
)
@@ -82,7 +86,8 @@ def conversation_rules(executor: str) -> str:
"preferences for the whole task: keep following them until the task ends or the "
"user changes them, also when a new result arrives. "
"Say the takeaway, the status or the next step. Never read out tables, lists, "
- "diffs, code or logs unless the user asks for exactly that. "
+ "diffs, code or logs unless the user asks for exactly that, and never say a tool "
+ "or function name aloud. "
"Running work can be corrected, redirected or stopped at any time: pass the "
f"user's change on to {executor} at once and never say it cannot be changed. "
f"Never tell the user something is impossible before {executor} has checked. "
diff --git a/jarvis/live/native.py b/jarvis/live/native.py
index 0dae7c182a..f86399e92a 100644
--- a/jarvis/live/native.py
+++ b/jarvis/live/native.py
@@ -59,6 +59,8 @@ _SESSION_TOOLS = frozenset({
# conversation rules call by name comes before them: a small model that does
# not see a named tool declares it missing instead of discovering it.
_DIRECT_TOOL_LIMIT = 12
+# How much of a named tool's description its short declaration keeps.
+_COMPACT_DESCRIPTION_CHARS = 240
_DIRECT_TOOL_PREFERENCE = (
*(name for name in NAMED_TOOLS if name not in _SESSION_TOOLS),
"find-app-action",
@@ -114,6 +116,10 @@ def _fit_declarations(
for declaration in catalog:
if len(direct) >= _DIRECT_TOOL_LIMIT:
break
+ if _declared_name(declaration) in NAMED_TOOLS:
+ # A tool the rules call by name is always declared, in short:
+ # workspace-orchestrate alone outgrew a small model's whole budget.
+ declaration = _compact(declaration)
size = len(json.dumps(declaration))
if used + size > budget_chars:
continue
@@ -122,6 +128,56 @@ def _fit_declarations(
return (*session, *direct)
+def _compact(declaration: dict) -> dict:
+ """The same tool in short: its first sentences, and its arguments without prose.
+
+ Names, types, enums and required fields stay, so a call built from it is
+ valid; discover_tools still returns the full schema.
+ """
+ text = str(declaration.get("description", ""))
+ short = text[:_COMPACT_DESCRIPTION_CHARS]
+ if len(text) > len(short):
+ cut = short.rfind(". ")
+ short = (short[: cut + 1] if cut > 0 else short) + " Full schema: discover_tools."
+ return {
+ **declaration,
+ "description": short,
+ "parameters": _without_prose(declaration.get("parameters", {})),
+ }
+
+
+# Annotations and value limits a short declaration leaves out. The full schema
+# still validates every call, and a refused call names the accepted arguments.
+_SCHEMA_PROSE = frozenset({
+ "description", "examples", "title", "$comment", "default",
+ "minimum", "maximum", "minLength", "maxLength", "minItems", "maxItems", "pattern",
+ "format",
+})
+
+
+def _without_prose(schema: Any) -> Any:
+ """A JSON schema with its prose and value limits removed, structure kept.
+
+ Only annotations go: a ``properties`` map keeps every argument, also one
+ that is itself called description or title.
+ """
+ if isinstance(schema, list):
+ return [_without_prose(item) for item in schema]
+ if not isinstance(schema, dict):
+ return schema
+ kept: dict = {}
+ for key, value in schema.items():
+ if key in _SCHEMA_PROSE:
+ continue
+ if key in ("properties", "patternProperties", "$defs", "definitions") and isinstance(
+ value, dict
+ ):
+ kept[key] = {name: _without_prose(sub) for name, sub in value.items()}
+ else:
+ kept[key] = _without_prose(value)
+ return kept
+
+
def _log_late_probe(task: asyncio.Future) -> None:
"""Retrieve a readiness probe that outlived its refusal, so nothing is lost."""
if task.cancelled():
diff --git a/jarvis/live/tools.py b/jarvis/live/tools.py
index 30aee3be49..57b7d9c90a 100644
--- a/jarvis/live/tools.py
+++ b/jarvis/live/tools.py
@@ -144,6 +144,33 @@ def _accepted_arguments(schema: Any) -> str:
return ("Accepted arguments: " + "; ".join(parts))[:600] + ". "
+def _numbers_from_text(args: dict, schema: Any) -> dict:
+ """Top-level number arguments a model wrote as text, as numbers.
+
+ ``"wait_seconds": "5"`` was refused twice in a row (live 2026-10-14). Only
+ a string that is exactly a number of the declared type is changed;
+ anything else is left for validation to refuse.
+ """
+ properties = schema.get("properties") if isinstance(schema, dict) else None
+ if not isinstance(properties, dict):
+ return args
+ fixed = dict(args)
+ for name, value in args.items():
+ spec = properties.get(name)
+ kind = spec.get("type") if isinstance(spec, dict) else None
+ if not isinstance(value, str) or kind not in ("integer", "number"):
+ continue
+ text = value.strip()
+ try:
+ number: int | float = int(text) if kind == "integer" else float(text)
+ except ValueError: # not a number: validation names the argument
+ continue
+ if kind == "number" and number != number: # NaN is no answer
+ continue
+ fixed[name] = number
+ return fixed
+
+
def _board_section(section: str, output: Any) -> Any:
"""One source's listing as the board shows it; None when it has another shape."""
if section == "coding_agents":
@@ -827,6 +854,7 @@ class LiveTools:
}
import jsonschema # type: ignore[import-untyped]
+ args = _numbers_from_text(args, descriptor.input_schema)
try:
jsonschema.validate(args, descriptor.input_schema)
except jsonschema.ValidationError as exc:
diff --git a/tests/contract/test_gpt_live.py b/tests/contract/test_gpt_live.py
index 84540d0bcb..b52142ddbd 100644
--- a/tests/contract/test_gpt_live.py
+++ b/tests/contract/test_gpt_live.py
@@ -391,6 +391,43 @@ async def test_catalog_tools_are_declared_under_readable_unique_names(ledger):
assert again == set(names)
+async def test_a_number_written_as_text_is_read_as_the_number(ledger):
+ # A small model sent "wait_seconds": "5" twice and was refused (live 2026-10-14).
+ seen: list[dict] = []
+
+ class Counting(Gateway):
+ def catalog(self):
+ schema = {
+ "type": "object",
+ "additionalProperties": False,
+ "properties": {
+ "wait_seconds": {"type": "integer"},
+ "ratio": {"type": "number"},
+ "label": {"type": "string"},
+ },
+ }
+ return (SupervisorToolDescriptor("ask_agent", "Asks", schema, "safe"),)
+
+ async def execute(self, name, args, request):
+ seen.append(dict(args))
+ return ToolResult(True, {"verified": True})
+
+ runtime = LiveTools(Counting(), ledger, "s", language="en", backend_model="")
+
+ calls = iter(range(100))
+
+ async def call(args: dict) -> dict:
+ request = {"name": "ask_agent", "arguments_json": json.dumps(args)}
+ return await runtime.execute(f"call-{next(calls)}", "call_tool", request, 0)
+
+ assert (await call({"wait_seconds": " 5 ", "ratio": "2.5", "label": "7"}))["success"]
+ assert seen[-1] == {"wait_seconds": 5, "ratio": 2.5, "label": "7"}
+ for wrong in ({"wait_seconds": "five"}, {"wait_seconds": "2.5"}, {"ratio": "nan"}):
+ refused = await call(wrong)
+ assert refused["executed"] is False and refused["retryable"] is True, wrong
+
+
def test_an_argument_hint_is_left_out_for_a_schema_without_properties():
from jarvis.live.tools import _accepted_arguments
diff --git a/tests/contract/test_workspace_orchestration.py b/tests/contract/test_workspace_orchestration.py
index f0b4dbf57c..7ebe718895 100644
--- a/tests/contract/test_workspace_orchestration.py
+++ b/tests/contract/test_workspace_orchestration.py
@@ -1071,6 +1071,36 @@ async def test_watch_refuses_honestly_when_there_is_nothing_to_report(rig, monke
assert nowhere["status"] == "unavailable" and term.delegation_result is None
+async def test_watch_without_a_name_follows_the_one_agent_at_work(rig, reportable):
+ # "Tell me when the coding agent is done" with one agent working was asked
+ # back for a call-sign in a live call (2026-10-14).
+ orchestrator, registry, sessions = rig
+ panes = [term for session in registry.sessions for term in session.terminals]
+ with _Origin("voice"):
+ nobody = await orchestrator.run({"action": "watch"})
+ assert nobody["status"] == "needs_clarification" and nobody["working"] == []
+ term = panes[0]
+ term.activity, term.last_prompt = "working", "Run the migration"
+ with _Origin("voice"):
+ watched = await orchestrator.run({"action": "watch"})
+ assert watched["status"] == "watching" and watched["agent"] == term.name
+ assert watched["target"]["terminal_id"] == "pane:" + term.history_id
+ assert term.delegation_result.watched and not sessions.calls
+
+
+async def test_watch_without_a_name_asks_when_several_agents_work(rig, reportable):
+ orchestrator, registry, _sessions = rig
+ panes = [term for session in registry.sessions for term in session.terminals]
+ assert len(panes) >= 2
+ for term in panes[:2]:
+ term.activity = "working"
+ with _Origin("voice"):
+ asked = await orchestrator.run({"action": "watch"})
+ assert asked["status"] == "needs_clarification"
+ assert set(asked["working"]) >= {panes[0].name, panes[1].name}
+ assert all(term.delegation_result is None for term in panes)
+
+
def test_status_is_a_read_and_watch_is_a_logged_action(rig):
import jsonschema
diff --git a/tests/unit/live/test_coordination.py b/tests/unit/live/test_coordination.py
index 2911445dea..3a68df6c57 100644
--- a/tests/unit/live/test_coordination.py
+++ b/tests/unit/live/test_coordination.py
@@ -18,7 +18,7 @@ from jarvis.live.coordination import (
_RULES = WORK_STATUS_RULE + ON_SCREEN_RULE + TEAM_TALK_RULE + conversation_rules("your tools")
# Hyphenated or underscored words in the rules that are plain English, not tools.
-_NOT_TOOLS = {"multi-step", "trade-offs"}
+_NOT_TOOLS = {"multi-step", "trade-offs", "mission_id"}
def test_every_tool_the_rules_name_is_listed_and_every_listed_tool_is_named():
diff --git a/tests/unit/live/test_native_live_fixes.py b/tests/unit/live/test_native_live_fixes.py
index 83dcab6153..b89bb5e316 100644
--- a/tests/unit/live/test_native_live_fixes.py
+++ b/tests/unit/live/test_native_live_fixes.py
@@ -603,6 +603,85 @@ async def test_tools_the_rules_name_stay_direct_under_a_budget(call, make_provid
await live.session.end()
+def _real_named_tools() -> tuple[SupervisorToolDescriptor, ...]:
+ """The tools the rules name, with the descriptions and schemas they ship with."""
+ from jarvis.brain.workspace_git_tool import WorkspaceGitTool
+ from jarvis.brain.workspace_tool import WorkspaceOrchestrationTool
+ from jarvis.commands.registry import get_command
+ from jarvis.plugins.tool.app_command import RegistryCommandTool
+ from jarvis.plugins.tool.ask_agent import AskAgentTool
+ from jarvis.plugins.tool.navigate import NavigateTool
+ from jarvis.plugins.tool.show_on_screen import ShowOnScreenTool
+
+ amend = RegistryCommandTool(get_command("mission-amend"), runtime=None)
+ tools = (
+ WorkspaceOrchestrationTool, WorkspaceGitTool, ShowOnScreenTool, NavigateTool,
+ AskAgentTool, amend,
+ )
+ return tuple(
+ SupervisorToolDescriptor(tool.name, tool.description, tool.schema, "monitor")
+ for tool in tools
+ )
+
+
+@both_providers
+async def test_every_named_tool_fits_a_small_models_budget_as_it_ships(call, make_provider):
+ # workspace-orchestrate alone is larger than the local voice's whole budget,
+ # so a small model never saw it and could neither check nor watch an agent.
+ real = _real_named_tools()
+ assert {tool.name for tool in real} | {"task_status"} == set(NAMED_TOOLS)
+ provider = make_provider()
+ live = call(provider, gateway=FakeToolGateway(catalog_of(30) + real))
+ await live.start()
+ try:
+ tools = provider.opened_with[0].tools
+ described = {tool["description"].split(": ", 1)[0]: tool for tool in tools}
+ assert set(NAMED_TOOLS) - {"task_status"} <= set(described)
+ assert "task_status" in {tool["name"] for tool in tools}
+ orchestrate = described["workspace-orchestrate"]["parameters"]
+ assert {"status", "watch"} <= set(orchestrate["properties"]["action"]["enum"])
+ if provider.tool_declaration_budget_tokens:
+ assert len(json.dumps(tools)) <= provider.tool_declaration_budget_tokens * 4
+ finally:
+ await live.session.end()
+
+
+def test_a_short_declaration_keeps_every_argument_and_drops_only_prose():
+ declaration = {
+ "name": "jarvis_show_on_screen",
+ "description": "show_on_screen: Shows content. " + "More words here. " * 60,
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "title": {"type": "string", "description": "Heading."},
+ "description": {"type": "string", "title": "Body"},
+ "kind": {"type": "string", "enum": ["a", "b"], "description": "Which."},
+ "items": {
+ "type": "array",
+ "items": {"type": "object", "properties": {"x": {"type": "integer",
+ "description": "An x."}}},
+ },
+ },
+ "required": ["title"],
+ "description": "Arguments.",
+ },
+ }
+ short = native._compact(declaration)
+ params = short["parameters"]
+ assert set(params["properties"]) == {"title", "description", "kind", "items"}
+ assert params["required"] == ["title"] and params["properties"]["kind"]["enum"] == ["a", "b"]
+ assert "description" not in params and "description" not in params["properties"]["title"]
+ assert "title" not in params["properties"]["description"]
+ assert params["properties"]["items"]["items"]["properties"]["x"] == {"type": "integer"}
+ assert short["description"].startswith("show_on_screen: Shows content.")
+ assert short["description"].endswith("Full schema: discover_tools.")
+ assert len(short["description"]) < len(declaration["description"])
+ # A short description stays as it is.
+ tiny = {"name": "t", "description": "t: Does t.", "parameters": {"type": "object"}}
+ assert native._compact(tiny)["description"] == "t: Does t."
+
+
@both_providers
@pytest.mark.asyncio
async def test_free_direct_slots_go_only_to_safe_tools(call, make_provider):