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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(missions): the "real request" surfaces show the ask, not the standing directive
rubenluetke10-beep3a4e9bffa186
diff --git a/jarvis/missions/stream_evidence.py b/jarvis/missions/stream_evidence.pyindex 25de8fa76c..e9516af519 100644--- a/jarvis/missions/stream_evidence.py+++ b/jarvis/missions/stream_evidence.py@@ -1122,14 +1122,33 @@ def _normalize_informational_idioms(text: str) -> str:return _MAKE_RESEARCH_IDIOM_RE.sub("research", text)-def _request_body(prompt: str) -> str:- """Strip the standing quality directive that spawn_worker prepends so the- classifier sees only the real request.+# The SECOND directive layer, added by ``spawn_worker._build_mission_prompt``+# under the quality directive on the force-spawn path. It lives here, next to+# the code that strips it, and the builder imports it: the two drifted apart+# once already (only the first layer was ever removed), and a shared constant+# is what stops that recurring.+FORCE_SPAWN_DIRECTIVE: Final[str] = (+ "Carry out the underlying user request directly. Use a sensible, "+ "complete default deliverable instead of asking which format the "+ "user wants, unless a genuinely indispensable fact is missing."+)+UNDERLYING_REQUEST_LEAD: Final[str] = "Underlying request: "- ``spawn_worker._build_mission_prompt`` joins- ``f"{_QUALITY_DIRECTIVE}\\n\\n{body}"``; the directive is recognised by its- stable phrasing. When no directive is present (tests / other callers) the- whole prompt is classified.++def _request_body(prompt: str) -> str:+ """Strip the standing directives that spawn_worker prepends so the caller+ sees only the real request.++ ``spawn_worker._build_mission_prompt`` can stack THREE layers:+ the quality directive, then ``FORCE_SPAWN_DIRECTIVE``, then+ ``UNDERLYING_REQUEST_LEAD`` + the task. This used to remove only the+ first, so every consumer of "the real request" — report titles, generated+ filenames, the agent board's task column — surfaced "Carry out the+ underlying user request directly. Use a sensible…" instead of the ask.+ On the agent board that made 45 of 50 rows read identically.++ Every layer is optional: a prompt carrying neither directive (tests, other+ callers) is returned whole."""head, sep, tail = prompt.partition("\n\n")low = head.lower()@@ -1138,7 +1157,15 @@ def _request_body(prompt: str) -> str:or "never ship one" in lowor "inhalt folgt" in low):- return tail+ prompt = tail++ # Cut at the lead only when the text before it really is the directive, so+ # a user who happens to write "Underlying request:" keeps their wording.+ lead_at = prompt.find(UNDERLYING_REQUEST_LEAD)+ if lead_at != -1 and "carry out the underlying user request" in prompt[:lead_at].lower():+ rest = prompt[lead_at + len(UNDERLYING_REQUEST_LEAD) :]+ if rest.strip():+ return restreturn prompt@@ -1444,7 +1471,9 @@ def summarize_answers(answers: list[str], *, cap: int = 600) -> str:__all__ = [+ "FORCE_SPAWN_DIRECTIVE","StreamEvidence",+ "UNDERLYING_REQUEST_LEAD","clean_request_body","diff_has_action_evidence","extract_stream_evidence",diff --git a/jarvis/plugins/tool/spawn_worker.py b/jarvis/plugins/tool/spawn_worker.pyindex 0d2c9c72af..67a31ce746 100644--- a/jarvis/plugins/tool/spawn_worker.py+++ b/jarvis/plugins/tool/spawn_worker.py@@ -42,7 +42,11 @@ from jarvis.core.bus import EventBusfrom jarvis.core.events import JarvisAgentAnnouncement, JarvisAgentBackgroundCompletedfrom jarvis.core.protocols import ExecutionContext, ToolResultfrom jarvis.missions.manager import MissionManager-from jarvis.missions.stream_evidence import strip_spawn_meta+from jarvis.missions.stream_evidence import (+ FORCE_SPAWN_DIRECTIVE,+ UNDERLYING_REQUEST_LEAD,+ strip_spawn_meta,+)from jarvis.voice.action_phrases import action_phrase, resolve_ambient_languagelog = logging.getLogger(__name__)@@ -273,12 +277,10 @@ def _build_mission_prompt(if topic_matchelse stripped)- body = (- "Carry out the underlying user request directly. Use a sensible, "- "complete default deliverable instead of asking which format the "- "user wants, unless a genuinely indispensable fact is missing.\n\n"- f"Underlying request: {task}"- )+ # Both halves come from stream_evidence, which is also what strips+ # them back off for report titles, filenames and the agent board's+ # task column. Inlining the wording here is what let the two drift.+ body = f"{FORCE_SPAWN_DIRECTIVE}\n\n{UNDERLYING_REQUEST_LEAD}{task}"else:body = utteranceelse:diff --git a/tests/missions/test_spawn_meta_parity.py b/tests/missions/test_spawn_meta_parity.pyindex f5752750f1..15d5afb5ab 100644--- a/tests/missions/test_spawn_meta_parity.py+++ b/tests/missions/test_spawn_meta_parity.py@@ -24,3 +24,42 @@ def test_strip_spawn_meta_is_public_on_stream_evidence() -> None:"""``strip_spawn_meta`` is the public, shared entry point."""assert callable(stream_evidence.strip_spawn_meta)assert "strip_spawn_meta" in stream_evidence.__all__+def test_worker_prompt_and_stripper_share_the_directive_wording() -> None:+ """The force-spawn directive is ONE string, referenced by both sides.++ It used to be an inline literal in the builder and a set of guessed+ phrases in the stripper. When the wording changed, the stripper silently+ stopped matching and every "real request" surface — report titles,+ generated filenames, the agent board's task column — started showing+ "Carry out the underlying user request directly…" instead of the ask.+ """+ assert spawn_worker.FORCE_SPAWN_DIRECTIVE is stream_evidence.FORCE_SPAWN_DIRECTIVE+ assert spawn_worker.UNDERLYING_REQUEST_LEAD is stream_evidence.UNDERLYING_REQUEST_LEAD+++def test_clean_request_body_removes_everything_the_builder_prepends() -> None:+ """Round trip: what the builder stacks on, the stripper takes back off.++ This is the assertion the original drift would have failed. It does not+ name any directive wording, so rewording either layer keeps it honest.+ """+ ask = "build me a complete social section with friend stats"+ built = spawn_worker._build_mission_prompt(+ utterance=f"spawn an agent to {ask}",+ action="",+ target="",+ context_hints=[],+ )++ cleaned = stream_evidence.clean_request_body(built)++ assert ask in cleaned+ # No fragment of either directive layer survives.+ assert "production-quality" not in cleaned.lower()+ assert "carry out the underlying user request" not in cleaned.lower()+ assert stream_evidence.UNDERLYING_REQUEST_LEAD not in cleaned+++def test_clean_request_body_leaves_an_undirected_prompt_alone() -> None:+ """A prompt carrying neither layer is returned whole."""+ assert stream_evidence.clean_request_body("just do the thing") == "just do the thing"