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(routing): don't force-spawn when the user names the auto-spawn feature

Ruben Lütkefc801e3fd600
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 6cb2ff32bc..008b0a0e50 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -921,6 +921,39 @@ def _is_spawn_decline(user_text: str) -> bool:
return bool(_SPAWN_DECLINE_RE.search(user_text or ""))
+# The user NAMING the auto-spawn *feature* — talking about it, complaining about
+# it, asking to fix it — as opposed to COMMANDING a spawn. "Auto-Spawn" /
+# "automatic spawn(ing)" is a feature NAME, never a vehicle imperative: nobody
+# dispatches a worker by saying "auto-spawn". The negation-blind vehicle hoist in
+# ``_should_force_spawn`` would otherwise substring-match the "spawn" inside
+# "auto-spawn" (the hyphen is a \b word boundary) and force-spawn the very thing
+# the user is complaining about. Anchored on the "auto"/"automatic" qualifier so
+# a bare imperative ("Spawne einen Subagenten …") is untouched — the 2026-06-15
+# mandate ("when I say subagent it MUST spawn") stays intact.
+_SPAWN_FEATURE_RE = re.compile(
+ r"\bauto[-\s]?spawn\w*" # auto-spawn / autospawn / auto spawn(ing)
+ r"|\bautomatic(?:ally)?[\s-]+spawn\w*" # automatic spawn / automatically spawning
+ r"|\bautomatisch\w*[\s-]+spawn\w*", # automatisches spawnen
+ re.IGNORECASE,
+)
+
+
+def _is_spawn_feature_reference(user_text: str) -> bool:
+ """True when the user names the auto-spawn *feature* (talks about / complains
+ about / asks to fix it) instead of commanding a worker spawn.
+
+ Must override the negation-blind explicit-trigger hoist in
+ ``_should_force_spawn`` — mirroring ``_is_spawn_decline`` — because that hoist
+ substring-matches the "spawn" inside "Auto-Spawn" and would force-spawn the
+ very feature the user is complaining about. Live bug 2026-07-01 (voice session
+ 21:26:44): "Auto-Spawn, das müssen wir erstmal fixen" spawned a full Opus
+ mission whose "still on it" heartbeats then spoke out of nowhere for minutes.
+ Anchored on "auto"/"automatic" so a bare imperative that NAMES the vehicle
+ ("Spawne einen Subagenten …") is not matched and still force-spawns.
+ """
+ return bool(_SPAWN_FEATURE_RE.search(user_text or ""))
+
+
# Conversational coaching: "help me [get better at a soft / cognitive /
# conversational skill]" — asking, thinking, phrasing, deciding, understanding,
# expressing, communicating. This is CONVERSATION (Jarvis answers inline and
@@ -4393,6 +4426,19 @@ class BrainManager:
if _is_spawn_decline(t):
log.info("force-spawn skipped: explicit spawn decline — answer inline")
return False
+ # The user NAMING the auto-spawn feature (complaining about it, asking to
+ # fix it) is talk ABOUT the feature, not a command. "Auto-Spawn" carries
+ # the substring "spawn" that the negation-blind vehicle hoist below matches
+ # at the hyphen boundary; without this stand-down, complaining about
+ # auto-spawn force-spawns the very thing complained about. Checked BEFORE
+ # the hoist, exactly like the decline guard. Live bug 2026-07-01 (voice
+ # session 21:26:44): "Auto-Spawn, das müssen wir erstmal fixen" spawned a
+ # full Opus mission whose heartbeats then spoke out of nowhere.
+ if _is_spawn_feature_reference(t):
+ log.info(
+ "force-spawn skipped: auto-spawn feature named, not commanded — inline"
+ )
+ return False
# User mandate (2026-06-15, "when I say subagent it MUST spawn"): an
# EXPLICIT heavy-work trigger that NAMES the execution vehicle
# ("subagent", "spawn", "openclaw", "delegate") is an UNAMBIGUOUS request
diff --git a/tests/unit/brain/test_spawn_feature_reference_not_command.py b/tests/unit/brain/test_spawn_feature_reference_not_command.py
new file mode 100644
index 0000000000..72865dc717
--- /dev/null
+++ b/tests/unit/brain/test_spawn_feature_reference_not_command.py
@@ -0,0 +1,129 @@
+"""Naming the auto-spawn FEATURE must not be read as a spawn COMMAND.
+
+Live bug 2026-07-01 (voice session 21:26:44). The user made a META complaint
+ABOUT the auto-spawn feature (the verbatim utterance is pinned below in
+``LIVE_META_UTTERANCE``), not a task. But
+``BrainManager._should_force_spawn`` hoists any ``force_spawn_phrases`` match to
+an immediate ``True`` ahead of every disambiguation guard, and its
+vehicle-trigger regex ``(?:^|\\b)(?:…|spawn|…)(?:\\b|$)`` matches the "Spawn"
+inside "Auto-Spawn" (the hyphen is a word boundary). So a full Opus swarm mission
+force-spawned — and its bounded "still on it" heartbeats then spoke out of
+nowhere for minutes. The irony: complaining about auto-spawn triggered an
+auto-spawn.
+
+Fix: ``auto-spawn`` / ``automatic spawn(ing)`` is a feature NAME, never a vehicle
+imperative — nobody dispatches a worker by saying "auto-spawn". A dedicated
+guard (``_is_spawn_feature_reference``) stands the force-spawn down BEFORE the
+negation-blind vehicle hoist, mirroring the existing ``_is_spawn_decline`` guard.
+The 2026-06-15 mandate ("when I say subagent it MUST spawn") is preserved: an
+explicit imperative ("Spawne einen Subagenten …") carries no "auto"/"automatic"
+prefix and still force-spawns.
+
+Deterministic — no LLM, no real brain. Exercises ``_should_force_spawn`` and the
+``_is_spawn_feature_reference`` predicate directly.
+"""
+from __future__ import annotations
+
+from typing import Any
+
+import pytest
+
+from jarvis.brain.manager import BrainManager
+from jarvis.core.bus import EventBus
+from jarvis.core.config import JarvisConfig
+
+
+class _FakeSpawnTool:
+ name = "spawn_worker"
+ schema: dict[str, Any] = {}
+
+
+class _FakeDispatchTool:
+ name = "dispatch_to_harness"
+ schema: dict[str, Any] = {}
+
+
+class _InertExecutor:
+ async def execute(self, *_a: Any, **_k: Any) -> Any: # pragma: no cover
+ raise AssertionError("executor must not run in a classification test")
+
+
+def _manager() -> BrainManager:
+ """Strict-mode (production default) manager with the spawn tool wired."""
+ config = JarvisConfig()
+ config.brain.routing.force_spawn_mode = "strict"
+ return BrainManager(
+ config=config,
+ bus=EventBus(),
+ tools={
+ "spawn_worker": _FakeSpawnTool(),
+ "dispatch_to_harness": _FakeDispatchTool(),
+ },
+ tool_executor=_InertExecutor(), # type: ignore[arg-type]
+ )
+
+
+# The exact live utterance that mis-fired (2026-07-01 21:26:44).
+LIVE_META_UTTERANCE = (
+ "Ja, mach das mal. Ach, Ticker, das ist echt nervig. " # i18n-allow
+ "Auto-Spawn, das müssen wir erstmal fixen, Digga." # i18n-allow
+)
+
+
+def test_live_auto_spawn_complaint_does_not_force_spawn() -> None:
+ """The reported bug: complaining about auto-spawn must NOT force-spawn."""
+ manager = _manager()
+ assert manager._should_force_spawn(LIVE_META_UTTERANCE) is False, (
+ "a complaint ABOUT the auto-spawn feature was read as a spawn command "
+ "— the 'Spawn' inside 'Auto-Spawn' hoisted to a force-spawn"
+ )
+
+
+# Talking ABOUT the feature (naming / complaining / asking to fix), DE/EN.
+_FEATURE_REFERENCES = [
+ "Auto-Spawn, das müssen wir fixen", # i18n-allow
+ "Das Auto-Spawn nervt total", # i18n-allow
+ "auto spawn triggert dauernd ungewollt", # i18n-allow
+ "autospawn is broken",
+ "can you fix the automatic spawning",
+]
+
+
[email protected]("utterance", _FEATURE_REFERENCES)
+def test_feature_reference_predicate_matches(utterance: str) -> None:
+ from jarvis.brain.manager import _is_spawn_feature_reference
+
+ assert _is_spawn_feature_reference(utterance) is True
+
+
[email protected]("utterance", _FEATURE_REFERENCES)
+def test_feature_reference_does_not_force_spawn(utterance: str) -> None:
+ manager = _manager()
+ assert manager._should_force_spawn(utterance) is False, (
+ f"feature reference {utterance!r} was wrongly force-spawned"
+ )
+
+
+# The 2026-06-15 mandate must survive: an explicit imperative that NAMES the
+# vehicle still force-spawns. None of these carries an "auto"/"automatic" prefix.
+_EXPLICIT_COMMANDS = [
+ "Spawne einen Subagenten der die Logs analysiert", # i18n-allow
+ "Delegier das an einen Subagenten", # i18n-allow
+ "Starte OpenClaw und bau mir einen ausführlichen Report", # i18n-allow
+]
+
+
[email protected]("utterance", _EXPLICIT_COMMANDS)
+def test_explicit_spawn_command_still_force_spawns(utterance: str) -> None:
+ manager = _manager()
+ assert manager._should_force_spawn(utterance) is True, (
+ f"explicit vehicle command {utterance!r} must still force-spawn "
+ "(mandate 2026-06-15)"
+ )
+
+
[email protected]("utterance", _EXPLICIT_COMMANDS)
+def test_explicit_command_is_not_a_feature_reference(utterance: str) -> None:
+ from jarvis.brain.manager import _is_spawn_feature_reference
+
+ assert _is_spawn_feature_reference(utterance) is False