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.

feat(spawn): let a plainly heavy brief delegate without a magic word

Harald03253ab9b8f8
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 38b397cf53..75660efb7c 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -45,8 +45,15 @@ from uuid import UUID, uuid4
# classifier (provider_test.classify_provider_error) so the live fallback chain and
# the API-Keys badge can never disagree on "out of credits / over budget" (AP-22).
from jarvis.brain.provider_test import BILLING_LIMIT_MARKERS
+from jarvis.brain.spawn_gate import effort_warrants_delegation
from jarvis.core.bus import EventBus
-from jarvis.core.config import BrainTierConfig, JarvisConfig
+from jarvis.core.config import (
+ FORCE_SPAWN_MODE_BALANCED,
+ FORCE_SPAWN_MODE_PERMISSIVE,
+ BrainTierConfig,
+ JarvisConfig,
+ normalize_force_spawn_mode,
+)
from jarvis.core.events import (
ActionExecuted,
AnnouncementRequested,
@@ -3351,6 +3358,21 @@ class BrainManager:
"""The active reply-language pin: ``auto`` | ``de`` | ``en`` | ``es``."""
return self._reply_language
+ @property
+ def force_spawn_mode(self) -> str:
+ """The live ``brain.routing.force_spawn_mode``: strict/balanced/permissive.
+
+ The ONE live accessor for the setting. ``_should_force_spawn`` reads it
+ here, and ``jarvis.brain.spawn_gate.active_force_spawn_mode`` reads it
+ through the runtime reference to this manager — so the deterministic
+ path and the LLM gate can never end up in different modes on the same
+ turn. Unknown values normalise to the shipped default, never to a mode
+ the user did not ask for.
+ """
+ return normalize_force_spawn_mode(
+ getattr(self._config.brain.routing, "force_spawn_mode", "")
+ )
+
@property
def conversation_language(self) -> str:
"""The sticky language of the conversation so far (de/en/es, or "").
@@ -7496,10 +7518,13 @@ class BrainManager:
opinion/advice question; conversational coaching
(``_is_conversational_coaching``); pointer; navigation; smalltalk;
open-app; installed skill; connected-CLI capability; PC control.
- 5. Strict mode (default): explicit-only — the explicit trigger
- already returned True in step 3, so everything else → False
- (maintainer mandate 2026-07-21). Permissive mode: action verb /
- external marker → True.
+ 5. The force-spawn mode decides what is left (``force_spawn_mode``):
+ ``balanced`` (default) and ``permissive`` first run the EFFORT
+ test — a multi-step artefact brief → True (mandate 2026-08-18).
+ ``strict`` skips it and stays explicit-only, so everything the
+ trigger in step 3 did not catch → False (mandate 2026-07-21).
+ ``permissive`` additionally keeps the legacy heuristic: action
+ verb / external marker → True.
6. Otherwise → False.
"""
# A drag-dropped mission recap is a CONVERSATION about a FINISHED job,
@@ -7754,16 +7779,46 @@ class BrainManager:
and not self._research_wants_artifact(t)
):
return False
- # User-Mandate 2026-05-14: strict-mode is the default. The router
- # used to spawn on every spawn_verb hit ("schreib", "mach",
- # "zeig", "lies", ...), which fired heavy workers for everyday
- # utterances. In strict mode we only spawn when the user
- # explicitly names a heavy-work trigger ("Jarvis-Agent", "Sub-Agent",
- # "spawn", "deep dive", "gründliche Recherche", ...). The legacy
- # verb/marker heuristic stays available via
- # `brain.routing.force_spawn_mode = "permissive"`.
- mode = (self._config.brain.routing.force_spawn_mode or "strict").lower()
- if mode == "strict":
+ # User-Mandate 2026-05-14: the permissive router used to spawn on every
+ # spawn_verb hit ("schreib", "mach", "zeig", "lies", ...), which fired
+ # heavy workers for everyday utterances, so strict became the default:
+ # spawn only when the user explicitly names a heavy-work trigger
+ # ("Jarvis-Agent", "Sub-Agent", "spawn", "deep dive", "gründliche
+ # Recherche", ...). Since 2026-08-18 the default is `balanced` — strict
+ # plus the effort route below — and the legacy verb/marker heuristic
+ # stays available via `brain.routing.force_spawn_mode = "permissive"`.
+ mode = self.force_spawn_mode
+ if mode in (FORCE_SPAWN_MODE_BALANCED, FORCE_SPAWN_MODE_PERMISSIVE):
+ # The EFFORT route (maintainer mandate 2026-08-18: "the goal is that
+ # he just DOES things without being told. Right now he doesn't even
+ # do the things you DO tell him."). Explicit-only left Jarvis unable
+ # to start work on its own judgement — "Bau mir eine Website mit
+ # Flask und einer Startseite" reached this line and became talk.
+ #
+ # This is the retired build-a-deliverable gate coming back NARROWER,
+ # not the retired gate coming back. That one fired on
+ # ``_research_wants_artifact`` alone — a build verb plus an artefact
+ # noun — so a bare "erstell ein Skript" dispatched a mission. The
+ # effort test demands the same deliverable PLUS a request shape,
+ # PLUS no cheap-scope word, PLUS the conversational stand-downs,
+ # PLUS a substance signal and two scope signals in total. It is
+ # deliberately reused from ``spawn_gate`` rather than restated here,
+ # so the deterministic path and the LLM gate judge effort with ONE
+ # test (the same reason ``addressed_pane_blocks_spawn`` delegates to
+ # ``intent.owns_turn``).
+ #
+ # Every stand-down above still wins: this runs last, after the
+ # smalltalk / Whisper-FP / instructional / opinion / coaching /
+ # pointer / skill / capability / pc-control guards.
+ if effort_warrants_delegation(t):
+ log.info(
+ "force-spawn: %s mode — the turn is a multi-step artefact "
+ "brief, delegating without a delegation keyword: %r",
+ mode,
+ t[:80],
+ )
+ return True
+ if mode != FORCE_SPAWN_MODE_PERMISSIVE:
# Maintainer mandate 2026-07-21 (voice session 07:46): a background
# agent starts ONLY on an explicit request — the user names the
# vehicle or a delegation/depth trigger (``force_spawn_phrases``;
@@ -7782,10 +7837,13 @@ class BrainManager:
# background agent (``jarvis.brain.spawn_gate``), and the
# user's confirming yes unlocks exactly one spawn.
# The legacy verb/marker heuristic stays available via
- # ``force_spawn_mode = "permissive"``.
+ # ``force_spawn_mode = "permissive"``. In ``balanced`` the effort
+ # route above already had its say, so reaching here means the turn
+ # is neither an explicit request nor a multi-step artefact brief.
log.info(
- "force-spawn skipped: strict mode is explicit-only — no "
- "delegation trigger in %r",
+ "force-spawn skipped: %s mode needs an explicit delegation "
+ "trigger — none in %r",
+ mode,
t[:80],
)
return False
diff --git a/jarvis/brain/spawn_gate.py b/jarvis/brain/spawn_gate.py
index 21755547c7..9158655e11 100644
--- a/jarvis/brain/spawn_gate.py
+++ b/jarvis/brain/spawn_gate.py
@@ -19,6 +19,14 @@ ONLY when one of these holds:
2. The turn is a short, clear YES to a delegation offer the model made right
after the gate blocked the previous turn (the model is told to offer
instead of spawn; the user's confirmation then unlocks exactly one spawn).
+3. The EFFORT test (``effort_warrants_delegation``) reads the turn as a
+ request for a multi-step artefact — a build/write/refactor brief, or
+ research whose deliverable is a file. Added on the maintainer mandate
+ 2026-08-18 ("the goal is that he just DOES things without being told"),
+ because rules 1 and 2 meant Jarvis could never start work on its own
+ judgement: "Bau mir eine Website mit Flask und einer Startseite" produced
+ an offer, never a website. Available in the ``balanced`` and ``permissive``
+ force-spawn modes, OFF in ``strict`` — see ``jarvis.core.config``.
Everything else is blocked and fed back to the model as a tool error telling
it to answer inline. The deterministic force-spawn path
@@ -37,6 +45,12 @@ import logging
import re
import time
+from jarvis.core.config import (
+ DEFAULT_FORCE_SPAWN_MODE,
+ FORCE_SPAWN_MODE_STRICT,
+ normalize_force_spawn_mode,
+)
+
log = logging.getLogger(__name__)
@@ -255,6 +269,329 @@ def addressed_pane_blocks_spawn(user_text: str) -> bool:
return False
+# ──────────────────────────────────────────────────────────────────────────
+# The EFFORT route (maintainer mandate 2026-08-18)
+# ──────────────────────────────────────────────────────────────────────────
+#
+# The vocabulary route above asks "did the user name the vehicle?". This one
+# asks "is the WORK itself plainly a multi-step artefact?" — a build / write /
+# refactor brief, or research whose deliverable is a file. A question, a
+# lookup, a chat turn and anything cheap stay inline, as before.
+#
+# The direction of error is NOT symmetric here, and the whole test is built
+# around that asymmetry: an unrequested background agent is expensive,
+# surprising and hard to stop (forensic 2026-05-01 — the model hallucinated a
+# spawn on the chit-chat turn "es geht ab" and Jarvis then claimed to have
+# started tests it never started), while a missed delegation costs one inline
+# answer plus the offer the model is told to make. So every stage is
+# conjunctive and EVERY doubt resolves to "no spawn":
+#
+# 1. REQUEST SHAPE the turn must be an order or a request TO Jarvis — not
+# a report of finished work, not an information question.
+# 2. NOT CHEAP an explicit small-scope word ("kurz", "quick", "nur",
+# "einfach") vetoes outright.
+# 3. NOT CONVERSATION the manager's existing stand-down detectors
+# (instructional / opinion / coaching) veto; reused rather
+# than re-decided, so the effort route cannot drift away
+# from the force-spawn path.
+# 4. DELIVERABLE a build verb + an artefact noun, a named file, or a
+# code-work verb + a code object.
+# 5. SCOPE at least one SUBSTANCE signal (two or more named
+# components, an explicit multi-step marker, or a research
+# verb next to the deliverable) AND two signals in total.
+#
+# Where the "unsure" line sits: stage 5. One signal is not enough. "Bau mir
+# eine Website" names one component and stops — the model answers inline and
+# may offer. "Bau mir eine Website mit Flask und einer Startseite" carries two
+# components, a specification and a coordination: three signals, so it goes.
+#
+# All matching is pure regex over the user's own words (AP-11 safe, no LLM in
+# the gate, provider-agnostic) plus the manager's existing detectors.
+
+#: A brief this long is multi-step on its own — but only ever as ONE modifier
+#: signal, never on its own (a long chat turn is still a chat turn).
+_HEAVY_MIN_WORDS = 12
+
+#: First-person past tense: the user is REPORTING work, not ordering it.
+#: ``_BUILD_VERB_RE`` deliberately matches "wrote" / "geschrieben" / "saved"
+#: for the artifact classifier, so without this an "I already wrote the report
+#: and the summary" turn would read as a build brief.
+_REPORTED_WORK_RE: re.Pattern[str] = re.compile(
+ r"\b(?:ich|wir|i|we)\s+(?:hab|habe|haben|hatte|hatten|" # i18n-allow: spoken input
+ r"have|had|already)\b"
+ r"|\b(?:schon|bereits|already)\s+" # i18n-allow: spoken input
+ r"(?:gebaut|geschrieben|erstellt|built|written|created)\b", # i18n-allow: spoken input
+ re.IGNORECASE,
+)
+
+#: An interrogative opener makes the turn a question about the world. Answered
+#: inline, whatever artefact nouns it happens to contain ("Wie baue ich eine
+#: Website mit Flask und einer Startseite?" is a how-to, not a brief).
+_INFO_QUESTION_RE: re.Pattern[str] = re.compile(
+ r"^\s*(?:und\s+|aber\s+|okay,?\s+|ok,?\s+|also,?\s+)?" # i18n-allow: spoken input
+ r"(?:was|wie|warum|wieso|weshalb|wann|wo|wer|wem|wen|welch\w*" # i18n-allow: DE interrogatives
+ r"|what|how|why|when|where|who|whom|which"
+ r"|qu[eé]|c[oó]mo|cu[aá]ndo|d[oó]nde|qui[eé]n)\b", # i18n-allow: ES interrogatives
+ re.IGNORECASE,
+)
+
+#: A polite request frame. A turn ending in "?" is a question UNLESS it is
+#: framed as a request ("Kannst du mir … bauen?"), which is how people ask for
+#: work out loud in German and English alike.
+_REQUEST_FRAME_RE: re.Pattern[str] = re.compile(
+ r"\b(?:kannst|k[oö]nntest|w[uü]rdest|bitte" # i18n-allow: DE request frame
+ r"|ich\s+(?:m[oö]chte|will|brauche|br[aä]uchte|h[aä]tte)" # i18n-allow: DE request frame
+ r"|can\s+you|could\s+you|would\s+you|please"
+ r"|i\s+(?:want|need)|i'?d\s+like)\b",
+ re.IGNORECASE,
+)
+
+#: An explicit small-scope word. Vetoes the effort route outright — the user
+#: said the job is small, and a background agent for a small job is exactly
+#: the surprise this gate exists to prevent. Deliberately generous (the common
+#: German fillers "nur" and "einfach" are in here): over-vetoing costs an
+#: inline answer, under-vetoing costs an unwanted mission.
+_CHEAP_SCOPE_RE: re.Pattern[str] = re.compile(
+ r"\b(?:kurz\w*|klein\w*|schnell\w*|einfach\w*|nur|winzig\w*" # i18n-allow: DE scope words
+ r"|mal\s+eben|eben\s+mal|einzeiler|minimal\w*|trivial\w*" # i18n-allow: DE scope words
+ r"|quick\w*|simple|simply|just|short|briefly|tiny"
+ r"|one[-\s]?liner|single\s+line)\b",
+ re.IGNORECASE,
+)
+
+#: Code work is the second deliverable shape next to a document: a refactor or
+#: a migration produces a diff, which is exactly what the Worker->Critic
+#: pipeline grades. Disjoint from ``_BUILD_VERB_RE`` on purpose — that one
+#: stays untouched so the artifact classifier keeps its current behaviour.
+_CODE_WORK_VERB_RE: re.Pattern[str] = re.compile(
+ r"\b(?:refactor\w*|refaktor\w*|migrat\w*|migrier\w*|portier\w*" # i18n-allow: DE code verbs
+ r"|implementier\w*|implement\w*|rewrite|rewrit\w*|umschreib\w*" # i18n-allow: DE code verbs
+ r"|umbau\w*|modularisier\w*|entkoppel\w*|umstrukturier\w*" # i18n-allow: DE code verbs
+ r"|restructur\w*|clean\s+up)",
+ re.IGNORECASE,
+)
+
+#: The object a code-work verb acts on.
+_CODE_OBJECT_RE: re.Pattern[str] = re.compile(
+ r"\b(?:code|codebase|repo|repository|modul\w*|module|modules" # i18n-allow: DE code nouns
+ r"|funktion\w*|function|functions|klasse|klassen|class|classes" # i18n-allow: DE code nouns
+ r"|projekt\w*|project|api|apis|endpoint\w*|pipeline" # i18n-allow: DE code nouns
+ r"|service|services|paket\w*|package|packages|test|tests)\b", # i18n-allow: DE code nouns
+ re.IGNORECASE,
+)
+
+#: Named parts of a deliverable. Counting DISTINCT ones is the strongest
+#: substance signal there is: a brief that names two or more parts describes a
+#: job with parts, which is what a background agent is for.
+_COMPONENT_NOUN_RE: re.Pattern[str] = re.compile(
+ r"\b(?:startseite\w*|start\s?page|homepage|landing\s?page" # i18n-allow: DE component nouns
+ r"|login|anmeldung|registrierung|sign\s?up|signup" # i18n-allow: DE component nouns
+ r"|datenbank\w*|database|endpoint\w*|route|routen|routes" # i18n-allow: DE component nouns
+ r"|formular\w*|kontaktformular\w*|navigation|men[uü]|menu" # i18n-allow: DE component nouns
+ r"|footer|header|impressum|unterseite\w*|seiten" # i18n-allow: DE component nouns
+ r"|deployment|readme|dokumentation|documentation" # i18n-allow: DE component nouns
+ r"|struktur\w*|architektur\w*|backend|frontend" # i18n-allow: DE component nouns
+ r"|diagramm\w*|chart|charts|tabelle\w*)\b", # i18n-allow: DE component nouns
+ re.IGNORECASE,
+)
+
+#: An explicit multi-step / from-scratch marker.
+_MULTI_STEP_RE: re.Pattern[str] = re.compile(
+ r"\bschritt\s+f[uü]r\s+schritt\b|\bstep\s+by\s+step\b" # i18n-allow: DE multi-step marker
+ r"|\bdanach\b|\banschlie[sß]end\w*|\bzuerst\b" # i18n-allow: DE multi-step marker
+ r"|\bvon\s+grund\s+auf\b|\bmehrere\b|\bmehreren\b" # i18n-allow: DE multi-step marker
+ r"|\bkomplett\w*|\bvollst[aä]ndig\w*" # i18n-allow: DE multi-step marker
+ r"|\bthen\b|\bafterwards?\b|\bend[-\s]?to[-\s]?end\b"
+ r"|\bfrom\s+scratch\b|\bseveral\b|\bmultiple\b",
+ re.IGNORECASE,
+)
+
+#: A research / analysis verb. Next to a file deliverable this is the
+#: "research-with-a-deliverable" shape: the answer is not spoken, it is
+#: written down, and that is a mission the critic can grade via git diff.
+_RESEARCH_VERB_RE: re.Pattern[str] = re.compile(
+ r"\b(?:recherchier\w*|analysier\w*|untersuch\w*|vergleich\w*" # i18n-allow: DE research verbs
+ r"|evaluier\w*|bewert\w*|research\w*|analyz\w*|analys\w*" # i18n-allow: DE research verbs
+ r"|investigat\w*|compar\w*|evaluat\w*|assess\w*|benchmark\w*)",
+ re.IGNORECASE,
+)
+
+#: "… with Flask", "… using Postgres" — a named constraint on the artefact.
+_SPEC_PREPOSITION_RE: re.Pattern[str] = re.compile(
+ r"\b(?:mit|mittels|auf\s+basis\s+von" # i18n-allow: DE prepositions
+ r"|with|using|based\s+on|via)\s+\w",
+ re.IGNORECASE,
+)
+
+#: Coordination — the brief lists more than one thing.
+_COORDINATION_RE: re.Pattern[str] = re.compile(
+ r"\b(?:und|sowie|au[sß]erdem|zus[aä]tzlich" # i18n-allow: DE coordination
+ r"|and|plus|additionally)\b|,",
+ re.IGNORECASE,
+)
+
+
+def _artifact_regexes() -> tuple[re.Pattern[str], ...] | None:
+ """The manager's build-verb / artefact-noun / named-file patterns.
+
+ Imported lazily for the same reason as ``_is_decline_or_feature_talk``:
+ this stays a leaf module. Sharing the manager's ONE set of patterns is the
+ point — the effort route and the force-spawn path must agree on what "an
+ artefact" is. On any import fault the effort route is simply unavailable
+ (``None``), which fails CLOSED: no spawn.
+ """
+ try:
+ from jarvis.brain.manager import ( # noqa: PLC0415
+ _BUILD_VERB_RE,
+ _DOC_NOUN_RE,
+ _NAMED_FILE_RE,
+ )
+ except Exception: # noqa: BLE001 — gate must never crash a tool turn
+ return None
+ return (_BUILD_VERB_RE, _DOC_NOUN_RE, _NAMED_FILE_RE)
+
+
+def _conversational_standdown(text: str) -> bool:
+ """True when an existing detector already calls this turn conversation.
+
+ Reuses the manager's battle-tested stand-downs instead of forming a second
+ opinion: an instructional "how do I …", an opinion/advice question, and
+ conversational coaching. An import fault answers True — the effort route
+ then simply does not fire, which is the safe side.
+
+ ``_looks_like_pc_control`` is deliberately NOT in this set. Its pattern
+ matches the bare verb "schreib", which is also a build verb, so it fires on
+ "schreib mir einen Bericht über X" — the single most common shape of a
+ write-a-deliverable brief. The codebase already resolves that collision the
+ other way round (``_should_force_spawn``: the pc-control stand-down applies
+ only ``and not self._research_wants_artifact(t)`` — an artefact build wins
+ over a screen mention), and on the deterministic path that stand-down has
+ already run before the effort test is reached.
+ """
+ try:
+ from jarvis.brain.manager import ( # noqa: PLC0415
+ _is_conversational_coaching,
+ _is_instructional_question,
+ _is_opinion_advice_question,
+ )
+ except Exception: # noqa: BLE001 — gate must never crash a tool turn
+ return True
+ return bool(
+ _is_instructional_question(text)
+ or _is_opinion_advice_question(text)
+ or _is_conversational_coaching(text)
+ )
+
+
+def effort_warrants_delegation(user_text: str) -> bool:
+ """True when the turn is plainly a multi-step artefact brief.
+
+ The second route to a permitted spawn, next to the delegation vocabulary.
+ See the block comment above for the five stages and for where the "unsure"
+ line sits (stage 5: one scope signal is not enough).
+
+ Pure and side-effect free — the offer window is untouched here, so the
+ caller keeps the one place that arms and disarms it. Callers:
+ ``llm_spawn_allowed`` (LLM-chosen spawns) and
+ ``BrainManager._should_force_spawn`` (the deterministic path), both only in
+ the ``balanced`` / ``permissive`` force-spawn modes.
+ """
+ text = (user_text or "").strip()
+ if not text:
+ return False
+ # 1. request shape
+ if _REPORTED_WORK_RE.search(text):
+ return False
+ if _INFO_QUESTION_RE.search(text):
+ return False
+ if text.endswith("?") and not _REQUEST_FRAME_RE.search(text):
+ return False
+ # 2. explicit small scope
+ if _CHEAP_SCOPE_RE.search(text):
+ return False
+ # 3. the existing conversational stand-downs
+ if _conversational_standdown(text):
+ return False
+ # 4. a deliverable
+ patterns = _artifact_regexes()
+ if patterns is None:
+ return False
+ build_verb_re, doc_noun_re, named_file_re = patterns
+ # A build verb takes either the manager's artefact nouns or a named part of
+ # one ("eine Dokumentation", "eine Datenbank") — the manager's list is a
+ # closed set tuned for its own classifier and is left untouched. Widening
+ # here is safe because stage 5 below, not this stage, is what actually
+ # decides: "Baue mir ein Login" reaches stage 5 with one named part and
+ # stops there.
+ has_deliverable = bool(
+ named_file_re.search(text)
+ or (
+ build_verb_re.search(text)
+ and (doc_noun_re.search(text) or _COMPONENT_NOUN_RE.search(text))
+ )
+ or (_CODE_WORK_VERB_RE.search(text) and _CODE_OBJECT_RE.search(text))
+ )
+ if not has_deliverable:
+ return False
+ # 5. scope — one SUBSTANCE signal is mandatory, two signals in total.
+ named_parts = {
+ match.group(0).lower()
+ for pattern in (doc_noun_re, _COMPONENT_NOUN_RE, _CODE_OBJECT_RE)
+ for match in pattern.finditer(text)
+ }
+ substance = 0
+ if len(named_parts) >= 2:
+ substance += 1
+ if _MULTI_STEP_RE.search(text):
+ substance += 1
+ if _RESEARCH_VERB_RE.search(text):
+ substance += 1
+ if not substance:
+ return False
+ signals = substance
+ if _SPEC_PREPOSITION_RE.search(text):
+ signals += 1
+ if _COORDINATION_RE.search(text):
+ signals += 1
+ if len(text.split()) >= _HEAVY_MIN_WORDS:
+ signals += 1
+ if signals < 2:
+ return False
+ log.info(
+ "spawn gate: effort route — multi-step artefact brief (%d signals) in "
+ "%r",
+ signals,
+ text[:80],
+ )
+ return True
+
+
+def active_force_spawn_mode() -> str:
+ """The live ``brain.routing.force_spawn_mode``.
+
+ Read from the running ``BrainManager`` (the ONE accessor,
+ ``BrainManager.force_spawn_mode``) so a mid-session config change is seen
+ without re-reading ``jarvis.toml`` on every tool call. Without a registered
+ manager there is no user configuration to honour, so the SHIPPED default
+ answers — the effort test itself is the conservative layer here, not this
+ lookup.
+ """
+ try:
+ from jarvis.core import runtime_refs # noqa: PLC0415
+
+ manager = runtime_refs.get_brain_manager()
+ except Exception: # noqa: BLE001 — gate must never crash a tool turn
+ return DEFAULT_FORCE_SPAWN_MODE
+ if manager is None:
+ return DEFAULT_FORCE_SPAWN_MODE
+ return normalize_force_spawn_mode(getattr(manager, "force_spawn_mode", ""))
+
+
+def effort_route_enabled() -> bool:
+ """True when the active mode grants the effort route (not ``strict``)."""
+ return active_force_spawn_mode() != FORCE_SPAWN_MODE_STRICT
+
+
def llm_spawn_allowed(user_text: str) -> bool:
"""Gate an LLM-chosen spawn tool call against the user's ACTUAL turn.
@@ -263,6 +600,13 @@ def llm_spawn_allowed(user_text: str) -> bool:
``user_text`` must be the verbatim user turn (``ctx.user_utterance`` /
the realtime transcript), never the model's paraphrase — a paraphrase can
smuggle in delegation vocabulary the user never spoke.
+
+ An EMPTY turn fails CLOSED, unlike the desktop gate next door
+ (``cu_gate.llm_computer_use_allowed`` fails open). The asymmetry is
+ deliberate: without the user's words there is nothing to judge, and the
+ 2026-05-01 forensic is exactly a spawn nobody asked for being reported as
+ started work. A blocked spawn costs an inline answer; an invented one costs
+ a background agent and a false claim.
"""
text = (user_text or "").strip()
if not text:
@@ -286,6 +630,15 @@ def llm_spawn_allowed(user_text: str) -> bool:
if _marker_spans(text):
OFFER_WINDOW.disarm()
return True
+ # The effort route (2026-08-18). Placed AFTER every guard above and after
+ # the vocabulary route, so it can only ever widen what an already-clean
+ # turn may do — a decline, feature talk, or an addressed workspace terminal
+ # still wins. Two independent judgements have to agree before anything
+ # starts: the model chose to call the spawn tool, and this deterministic
+ # test reads the turn as a multi-step artefact brief.
+ if effort_route_enabled() and effort_warrants_delegation(text):
+ OFFER_WINDOW.disarm()
+ return True
if OFFER_WINDOW.consume_confirm(text):
log.info("spawn gate: delegation offer confirmed — spawn allowed once")
return True
@@ -352,7 +705,10 @@ __all__ = [
"SPAWN_BLOCKED_MODEL_FEEDBACK",
"SPAWN_VEHICLE_TOOL_NAMES",
"DelegationOfferWindow",
+ "active_force_spawn_mode",
"addressed_pane_blocks_spawn",
+ "effort_route_enabled",
+ "effort_warrants_delegation",
"llm_spawn_allowed",
"names_spawn_vehicle",
"spawn_blocked_feedback",
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 83b1e38194..76d733ab1f 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -711,6 +711,43 @@ class BrainPlausibilityConfig(BaseModel):
stale_wake_seconds: float = 30.0
+#: The three force-spawn modes, widest-first in what they let through.
+#:
+#: ``permissive`` legacy heuristic — any action verb / external-system marker
+#: dispatches a worker. Historically over-eager (a knowledge
+#: question like "Was ist ein Verbrenner-Motor?" spawned one).
+#: ``balanced`` the shipped default since 2026-08-18: an explicit delegation
+#: request, OR a turn that the deterministic EFFORT test reads
+#: as a plainly multi-step artefact brief
+#: (``jarvis.brain.spawn_gate.effort_warrants_delegation``).
+#: ``strict`` explicit-only (mandate 2026-07-21): the user must name the
+#: vehicle or a delegation/depth trigger, or confirm an offer.
+#:
+#: Kept here, next to the field, so the manager's force-spawn branch and the
+#: LLM spawn gate read ONE definition instead of two drifting string literals.
+FORCE_SPAWN_MODE_STRICT = "strict"
+FORCE_SPAWN_MODE_BALANCED = "balanced"
+FORCE_SPAWN_MODE_PERMISSIVE = "permissive"
+FORCE_SPAWN_MODES: tuple[str, ...] = (
+ FORCE_SPAWN_MODE_STRICT,
+ FORCE_SPAWN_MODE_BALANCED,
+ FORCE_SPAWN_MODE_PERMISSIVE,
+)
+DEFAULT_FORCE_SPAWN_MODE = FORCE_SPAWN_MODE_BALANCED
+
+
+def normalize_force_spawn_mode(value: object) -> str:
+ """Return a known force-spawn mode for ``value``.
+
+ Empty, unknown or non-string values resolve to
+ :data:`DEFAULT_FORCE_SPAWN_MODE` — a typo in ``jarvis.toml`` must not brick
+ routing, and the two live readers (``BrainManager.force_spawn_mode`` and
+ ``jarvis.brain.spawn_gate``) must never disagree about what a value means.
+ """
+ mode = str(value or "").strip().lower()
+ return mode if mode in FORCE_SPAWN_MODES else DEFAULT_FORCE_SPAWN_MODE
+
+
class BrainRoutingConfig(BaseModel):
"""Heuristic rules for the deterministic force-spawn classification.
@@ -800,16 +837,37 @@ class BrainRoutingConfig(BaseModel):
"vollstaendige analyse", "vollständige analyse",
])
- # Force-Spawn-Mode: "strict" honours only `force_spawn_phrases`,
- # "permissive" falls back to the legacy spawn_verbs + external markers
- # heuristic. Default is "strict" per user mandate 2026-05-14; since the
- # 2026-07-21 mandate strict is EXPLICIT-ONLY — a background agent starts
- # only when the user names the vehicle or a delegation/depth trigger from
- # `force_spawn_phrases`. The former implicit strict-mode spawns (generic
- # sub-agent work, heavy-research artifacts, build-a-deliverable) are
- # retired; non-explicit heavy tasks are answered inline or OFFERED as a
- # delegation the user confirms (jarvis/brain/spawn_gate.py).
- force_spawn_mode: str = "strict"
+ # Force-Spawn-Mode — see FORCE_SPAWN_MODES above for the three values.
+ #
+ # "strict" honours only `force_spawn_phrases`; since the 2026-07-21 mandate
+ # it is EXPLICIT-ONLY — a background agent starts only when the user names
+ # the vehicle or a delegation/depth trigger. That mandate fixed unwanted
+ # spawns and created the opposite failure the maintainer reported on
+ # 2026-08-18: "the goal is that he just DOES things without being told.
+ # Right now he doesn't even do the things you DO tell him." A plain "build
+ # me a website with Flask and a start page" produced talk, never work.
+ #
+ # "balanced" (default since 2026-08-18) adds ONE second route: the
+ # deterministic effort test in `jarvis.brain.spawn_gate`
+ # (`effort_warrants_delegation`). It permits a spawn when the turn is a
+ # request for a multi-step artefact — a build/write/refactor brief, or
+ # research whose deliverable is a file — and refuses questions, lookups,
+ # chat and anything cheap. The test is conjunctive and every doubt resolves
+ # to "no spawn", because an unrequested background agent is expensive and
+ # surprising while a missed delegation costs one inline answer plus an
+ # offer the user can accept.
+ #
+ # "permissive" keeps the legacy spawn_verbs + external-marker heuristic.
+ #
+ # A user who wants the 2026-07-21 behaviour back sets "strict" — nothing in
+ # that mode changed. Read by `BrainManager.force_spawn_mode` (the ONE live
+ # accessor), consumed by `_should_force_spawn` and by the LLM spawn gate.
+ force_spawn_mode: str = DEFAULT_FORCE_SPAWN_MODE
+
+ @field_validator("force_spawn_mode", mode="before")
+ @classmethod
+ def _normalize_force_spawn_mode(cls, v: object) -> str:
+ return normalize_force_spawn_mode(v)
# Intelligent router (2026-06-21 user mandate "Jarvis must choose wisely among
# ALL tools, like Claude Code"). When the ACTIVE talker cannot emit tool_calls
diff --git a/tests/unit/brain/test_artifact_build_routing.py b/tests/unit/brain/test_artifact_build_routing.py
index 2822b278d9..118009c4e2 100644
--- a/tests/unit/brain/test_artifact_build_routing.py
+++ b/tests/unit/brain/test_artifact_build_routing.py
@@ -37,9 +37,13 @@ class _Inert:
raise AssertionError("no exec in a classification test")
-def _manager() -> BrainManager:
+def _manager(mode: str = "strict") -> BrainManager:
+ # "strict" is what this file pins: explicit-only, the 2026-07-21 mandate.
+ # It stopped being the shipped default on 2026-08-18 (that is "balanced"
+ # now) but it is unchanged and still selectable, so every assertion below
+ # keeps its meaning — see test_spawn_effort_route.py for balanced mode.
config = JarvisConfig()
- config.brain.routing.force_spawn_mode = "strict" # production default
+ config.brain.routing.force_spawn_mode = mode
return BrainManager(
config=config,
bus=EventBus(),
@@ -118,6 +122,28 @@ def test_non_build_requests_do_not_force_spawn(utterance: str) -> None:
)
+def test_balanced_mode_takes_the_long_brief_but_not_the_one_liners() -> None:
+ """The 2026-08-18 effort route, measured against this file's own corpus.
+
+ ``FAILING`` is the live 2026-06-21 utterance: four sentences, an HTML file,
+ a visualization and a trip to prepare — a multi-step brief, and in balanced
+ mode it delegates again. The short build commands above stay inline in
+ EVERY mode: one artefact noun and nothing else is where the effort test
+ draws its unsure line.
+ """
+ balanced = _manager("balanced")
+ assert balanced._should_force_spawn(FAILING) is True
+ for utterance in _BUILD_DELIVERABLE:
+ assert balanced._should_force_spawn(utterance) is False, (
+ f"one-line build command {utterance!r} must stay inline even in "
+ "balanced mode"
+ )
+ for utterance in _NOT_A_BUILD_MISSION:
+ assert balanced._should_force_spawn(utterance) is False, (
+ f"{utterance!r} is not a mission in any mode"
+ )
+
+
def test_artifact_discriminator_recognises_html_file() -> None:
"""The shared artifact detector must treat 'an HTML file' as a deliverable —
without requiring a literal dotted extension."""
diff --git a/tests/unit/brain/test_spawn_effort_route.py b/tests/unit/brain/test_spawn_effort_route.py
new file mode 100644
index 0000000000..8bee6575d9
--- /dev/null
+++ b/tests/unit/brain/test_spawn_effort_route.py
@@ -0,0 +1,349 @@
+"""The EFFORT route: Jarvis may delegate heavy work without a magic word.
+
+Maintainer mandate 2026-08-18: "the goal is that he just DOES things without
+being told. Right now he doesn't even do the things you DO tell him." The
+explicit-only rule (mandate 2026-07-21) meant a plain "build me a website with
+Flask and a start page" produced an offer and waited — never work.
+
+The second route added for that is deterministic and conservative: a request
+for a multi-step artefact may delegate on its own; a question, a lookup, a chat
+turn and anything cheap may not. Direction of error is asymmetric on purpose —
+these tests pin BOTH sides, because a spurious background agent is expensive
+and surprising while a missed delegation only costs an inline answer.
+
+Every earlier protection is re-pinned here: the 2026-05-01 hallucinated-spawn
+forensic, the decline and feature-talk guards, the offer/confirmation window,
+fail-closed on an empty turn, and ``strict`` mode keeping its old behaviour
+verbatim.
+"""
+from __future__ import annotations
+
+from typing import Any
+
+import pytest
+
+from jarvis.brain.manager import BrainManager
+from jarvis.brain.spawn_gate import (
+ OFFER_WINDOW,
+ active_force_spawn_mode,
+ effort_route_enabled,
+ effort_warrants_delegation,
+ llm_spawn_allowed,
+)
+from jarvis.core import runtime_refs
+from jarvis.core.bus import EventBus
+from jarvis.core.config import (
+ DEFAULT_FORCE_SPAWN_MODE,
+ FORCE_SPAWN_MODE_BALANCED,
+ FORCE_SPAWN_MODE_PERMISSIVE,
+ FORCE_SPAWN_MODE_STRICT,
+ BrainRoutingConfig,
+ JarvisConfig,
+ normalize_force_spawn_mode,
+)
+
+
+class _ModeOnlyManager:
+ """The one attribute ``active_force_spawn_mode`` reads off the live manager."""
+
+ def __init__(self, mode: str) -> None:
+ self.force_spawn_mode = mode
+
+
+def in_mode():
+ """Run a block with a given force-spawn mode registered as the live one."""
+
+ def _apply(mode: str) -> None:
+ runtime_refs.set_brain_manager(_ModeOnlyManager(mode))
+
+ yield _apply
+ runtime_refs._reset_for_tests()
+
+
[email protected](autouse=True)
+def _fresh_offer_window():
+ OFFER_WINDOW.disarm()
+ yield
+ OFFER_WINDOW.disarm()
+
+
+class _FakeSpawnTool:
+ name = "spawn_worker"
+ schema: dict[str, Any] = {}
+
+
+class _Inert:
+ async def execute(self, *_a: Any, **_k: Any) -> Any: # pragma: no cover
+ raise AssertionError("no execution in a classification test")
+
+
+def _manager(mode: str = FORCE_SPAWN_MODE_BALANCED) -> BrainManager:
+ config = JarvisConfig()
+ config.brain.routing.force_spawn_mode = mode
+ return BrainManager(
+ config=config,
+ bus=EventBus(),
+ tools={"spawn_worker": _FakeSpawnTool()},
+ tool_executor=_Inert(), # type: ignore[arg-type]
+ )
+
+
+# ── (a) a multi-step artefact brief delegates without a magic word ─────────
+
+#: The maintainer's own example, plus the same shape in the other supported
+#: languages and in code-work form. None of these names an agent, a worker, a
+#: mission, "spawn", "delegate" or "in the background".
+_HEAVY_BRIEFS = [
+ "Bau mir eine Website mit Flask und einer Startseite", # i18n-allow: DE brief
+ "Baue mir eine Flask-App mit Login, Datenbank und einer Startseite", # i18n-allow: DE brief
+ "Erstelle mir eine vollständige Dokumentation für das Projekt " # i18n-allow: DE brief
+ "mit Architektur und Deployment", # i18n-allow: DE brief
+ "Recherchier die besten E-Bikes unter 3000 Euro und schreib mir " # i18n-allow: DE brief
+ "einen Bericht als Markdown-Datei", # i18n-allow: DE brief
+ "Kannst du mir eine Landingpage mit Kontaktformular und " # i18n-allow: DE brief
+ "Impressum bauen?", # i18n-allow: DE brief
+ "Refactor the auth module and split the tests into their own package",
+ "Build me a dashboard with a login page and a database behind it",
+]
+
+
[email protected]("utterance", _HEAVY_BRIEFS)
+def test_heavy_brief_delegates_without_delegation_vocabulary(
+ utterance: str, in_mode
+) -> None:
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ assert effort_warrants_delegation(utterance) is True
+ assert llm_spawn_allowed(utterance) is True
+
+
+def test_the_maintainers_example_also_force_spawns_deterministically() -> None:
+ """A tool-incapable talker must reach the same answer as the LLM gate."""
+ utterance = "Bau mir eine Website mit Flask und einer Startseite" # i18n-allow: DE brief
+ assert _manager()._should_force_spawn(utterance) is True
+
+
+# ── (b) a plain question never delegates ──────────────────────────────────
+
+_QUESTIONS = [
+ "Was ist ein Verbrenner-Motor?", # i18n-allow: DE question
+ "Wie viele Milliardäre gibt es in Starnberg?", # i18n-allow: DE question
+ "Wie baue ich eine Website mit Flask und einer Startseite?", # i18n-allow: DE question
+ "What is the richest place in Europe after Monaco?",
+ "How do I write a report with charts and a summary?",
+ "Which database should I use for a website with a login?",
+]
+
+
[email protected]("utterance", _QUESTIONS)
+def test_question_never_delegates(utterance: str, in_mode) -> None:
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ assert effort_warrants_delegation(utterance) is False
+ assert llm_spawn_allowed(utterance) is False
+
+
+# ── (c) a cheap one-step request never delegates ──────────────────────────
+
+_CHEAP_REQUESTS = [
+ "Erstell ein Skript", # i18n-allow: DE request
+ "Bau mir eine Website", # i18n-allow: DE request
+ "Schreib das in eine Datei", # i18n-allow: DE request
+ "Schreib mir eine kurze Zusammenfassung von dem Artikel", # i18n-allow: DE request
+ "Erstell mir bitte ein kleines Skript das die Uhrzeit ausgibt", # i18n-allow: DE request
+ "Zeig mir das Wetter", # i18n-allow: DE request
+ "Write a quick script that prints the time",
+ "Just create a simple HTML page with a heading",
+]
+
+
[email protected]("utterance", _CHEAP_REQUESTS)
+def test_cheap_request_never_delegates(utterance: str, in_mode) -> None:
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ assert effort_warrants_delegation(utterance) is False
+ assert llm_spawn_allowed(utterance) is False
+
+
+def test_one_scope_signal_is_not_enough() -> None:
+ """Where the unsure line sits: one named part, no spawn; two, spawn."""
+ assert effort_warrants_delegation("Baue mir ein Login") is False # i18n-allow: DE
+ assert (
+ effort_warrants_delegation(
+ "Baue mir ein Login und eine Datenbank dafür" # i18n-allow: DE
+ )
+ is True
+ )
+
+
+def test_finished_work_is_reported_not_requested(in_mode) -> None:
+ """A build verb in the past tense is a report, never a brief."""
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ said = (
+ "Ich habe die Website schon gebaut und die Startseite geschrieben" # i18n-allow: DE
+ )
+ assert effort_warrants_delegation(said) is False
+ assert llm_spawn_allowed(said) is False
+
+
+# ── (d) the explicit vocabulary route still works ─────────────────────────
+
+
+ "utterance",
+ [
+ "Spawn an agent to research the best cities.",
+ "Spawne einen Subagenten und recherchier das.", # i18n-allow: DE trigger
+ "Delegate this to a worker, please.",
+ "Mach das im Hintergrund.", # i18n-allow: DE trigger
+ "Delega esto a un agente.",
+ ],
+)
+def test_explicit_vocabulary_still_unlocks_the_spawn(
+ utterance: str, in_mode
+) -> None:
+ in_mode(FORCE_SPAWN_MODE_STRICT) # even with the effort route switched off
+ assert llm_spawn_allowed(utterance) is True
+
+
+# ── (e) the offer / confirmation path still works ─────────────────────────
+
+
+def test_offer_and_confirmation_still_unlock_exactly_one_spawn(in_mode) -> None:
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ # A substantive turn the effort test does NOT take: blocked, offer armed.
+ assert llm_spawn_allowed("Find me the best cities to move to.") is False
+ # The user's short yes on the next turn unlocks the spawn once.
+ assert llm_spawn_allowed("Ja, mach das.") is True # i18n-allow: DE confirmation
+ assert llm_spawn_allowed("Ja, mach das.") is False # i18n-allow: DE confirmation
+
+
+def test_declining_the_offer_closes_the_window(in_mode) -> None:
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ assert llm_spawn_allowed("Find me the best cities to move to.") is False
+ assert llm_spawn_allowed("Nein, lass mal.") is False # i18n-allow: DE veto
+ assert llm_spawn_allowed("Ja, mach das.") is False # i18n-allow: DE confirmation
+
+
+def test_a_delegated_heavy_brief_clears_a_pending_offer(in_mode) -> None:
+ """An allowed spawn disarms the window — the documented gate contract."""
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ assert llm_spawn_allowed("Find me the best cities to move to.") is False
+ assert (
+ llm_spawn_allowed(
+ "Bau mir eine Website mit Flask und einer Startseite" # i18n-allow: DE brief
+ )
+ is True
+ )
+ assert llm_spawn_allowed("Ja, mach das.") is False # i18n-allow: DE confirmation
+
+
+# ── (f) the 2026-05-01 forensic must still never spawn ────────────────────
+
+
+ "utterance",
+ [
+ # voice session 2026-04-30 22:38 — the smalltalk turn on which the
+ # model hallucinated a spawn and Jarvis then claimed to have started
+ # tests it never started.
+ "es geht ab", # i18n-allow: forensic utterance
+ # voice session 2026-07-18 08:25 / 08:29 — conversational remarks that
+ # spawned an unrequested agent before the gate existed.
+ "Kann er jetzt überhaupt, der kann sich ja " # i18n-allow: forensic utterance
+ "jeden Tag 'ne Golf Stream kaufen.", # i18n-allow: forensic utterance
+ "Ah, ich will gucken, wo ich als nächstes hinziehe.", # i18n-allow: forensic utterance
+ "Research the best cities to move to.",
+ ],
+)
+def test_live_forensic_turns_still_block(utterance: str, in_mode) -> None:
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ assert effort_warrants_delegation(utterance) is False
+ assert llm_spawn_allowed(utterance) is False
+
+
+def test_empty_turn_still_fails_closed(in_mode) -> None:
+ """No words, no judgement, no background agent — see the gate docstring."""
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ for empty in ("", " ", "\n"):
+ assert effort_warrants_delegation(empty) is False
+ assert llm_spawn_allowed(empty) is False
+
+
+def test_decline_beats_the_effort_route(in_mode) -> None:
+ """A heavy brief with an explicit refusal must not delegate."""
+ in_mode(FORCE_SPAWN_MODE_BALANCED)
+ said = (
+ "Bau mir eine Website mit Flask und einer Startseite, " # i18n-allow: DE brief
+ "aber spawn dafür keinen Subagenten" # i18n-allow: DE decline
+ )
+ assert llm_spawn_allowed(said) is False
+
+
+# ── mode wiring: the switch is read, and strict keeps its old behaviour ────
+
+
+def test_balanced_is_the_shipped_default() -> None:
+ assert DEFAULT_FORCE_SPAWN_MODE == FORCE_SPAWN_MODE_BALANCED
+ assert BrainRoutingConfig().force_spawn_mode == FORCE_SPAWN_MODE_BALANCED
+ assert JarvisConfig().brain.routing.force_spawn_mode == FORCE_SPAWN_MODE_BALANCED
+
+
+ ("raw", "expected"),
+ [
+ ("strict", FORCE_SPAWN_MODE_STRICT),
+ (" STRICT ", FORCE_SPAWN_MODE_STRICT),
+ ("permissive", FORCE_SPAWN_MODE_PERMISSIVE),
+ ("balanced", FORCE_SPAWN_MODE_BALANCED),
+ ("", DEFAULT_FORCE_SPAWN_MODE),
+ (None, DEFAULT_FORCE_SPAWN_MODE),
+ ("wharrgarbl", DEFAULT_FORCE_SPAWN_MODE),
+ ],
+)
+def test_mode_normalization(raw: object, expected: str) -> None:
+ assert normalize_force_spawn_mode(raw) == expected
+
+
+def test_a_configured_strict_mode_survives_normalization() -> None:
+ """The escape hatch: a user who wants explicit-only keeps it."""
+ config = JarvisConfig()
+ config.brain.routing = BrainRoutingConfig(force_spawn_mode="strict")
+ assert _manager_from(config).force_spawn_mode == FORCE_SPAWN_MODE_STRICT
+
+
+def _manager_from(config: JarvisConfig) -> BrainManager:
+ return BrainManager(
+ config=config,
+ bus=EventBus(),
+ tools={"spawn_worker": _FakeSpawnTool()},
+ tool_executor=_Inert(), # type: ignore[arg-type]
+ )
+
+
+def test_strict_mode_switches_the_effort_route_off(in_mode) -> None:
+ in_mode(FORCE_SPAWN_MODE_STRICT)
+ assert effort_route_enabled() is False
+ assert active_force_spawn_mode() == FORCE_SPAWN_MODE_STRICT
+ utterance = "Bau mir eine Website mit Flask und einer Startseite" # i18n-allow: DE brief
+ # The classifier still answers the same — only the ROUTE is off.
+ assert effort_warrants_delegation(utterance) is True
+ assert llm_spawn_allowed(utterance) is False
+ assert _manager(FORCE_SPAWN_MODE_STRICT)._should_force_spawn(utterance) is False
+
+
+def test_balanced_and_permissive_both_grant_the_effort_route(in_mode) -> None:
+ for mode in (FORCE_SPAWN_MODE_BALANCED, FORCE_SPAWN_MODE_PERMISSIVE):
+ in_mode(mode)
+ assert effort_route_enabled() is True
+ assert active_force_spawn_mode() == mode
+
+
+def test_gate_falls_back_to_the_shipped_default_without_a_live_manager() -> None:
+ runtime_refs._reset_for_tests()
+ assert active_force_spawn_mode() == DEFAULT_FORCE_SPAWN_MODE
+
+
+def test_manager_property_is_the_one_live_accessor() -> None:
+ assert _manager(FORCE_SPAWN_MODE_BALANCED).force_spawn_mode == (
+ FORCE_SPAWN_MODE_BALANCED
+ )
+ assert _manager("nonsense").force_spawn_mode == DEFAULT_FORCE_SPAWN_MODE