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(agentic-ide): stop chat-preamble pane titles from a contract-blind CLI

rubenluetke10-beep5c425d4903af
diff --git a/jarvis/agentic_ide/recap_engine.py b/jarvis/agentic_ide/recap_engine.py
index b4bd7abbff..ba15ad9b94 100644
--- a/jarvis/agentic_ide/recap_engine.py
+++ b/jarvis/agentic_ide/recap_engine.py
@@ -163,6 +163,17 @@ MIN_DETAIL_WORDS = 5
MODEL_OUTPUT_TOKENS = 400
MODEL_RETRY_OUTPUT_TOKENS = 800
+#: How long the first line of an UNLABELLED answer may be and still be read as
+#: the headline. A model that dropped its labels still wrote a label-length
+#: line; a chatty CLI answers in a paragraph, and its first "line" is the whole
+#: paragraph. Live 2026-08-11: with every API key dead, the recaps rode a
+#: subscription CLI whose system contract is only prepended text, it answered
+#: conversationally, and the forgiving unlabelled path shipped "Understood! I
+#: see …" as the settled title of every pane. Checked against the RAW line,
+#: before :func:`recap.condense` hides the evidence. Labelled answers are
+#: exempt: "HEADLINE:" states the intent, and the condense cap does the rest.
+UNLABELLED_HEADLINE_CHARS = 72
+
#: What the user may type into a recap of their own. The same two lengths, with
#: room to spare — a hand-written recap is checked here rather than silently
#: shortened, so nobody writes three sentences and gets one and a half back.
@@ -802,6 +813,12 @@ def _valid_model_headline(headline: str) -> bool:
return False
if '"' in headline or "`" in headline or _SHELL_FRAGMENT_RE.search(headline):
return False
+ # A navigation label neither exclaims nor trails off into a colon: those
+ # are the shapes of a chat answer ("Hello! It looks like …", "Here you
+ # go:"), and they are structural, so they hold in every interface language
+ # where a phrase list would not.
+ if "!" in headline or headline.endswith(("?", ":")):
+ return False
if headline.lstrip().startswith(("...", "./", "../", "/", "\\")):
return False
return all(
@@ -815,13 +832,17 @@ def parse_answer(text: str, *, writer: str = "") -> SmartRecap | None:
Deliberately forgiving. Models drop the labels, swap their order, wrap the
whole thing in a code fence, or answer in one paragraph — and a recap is not
- worth failing over any of that. The one thing that is NOT accepted is an
- answer with no headline in it, because a blank header would look like a
- broken pane rather than a missing sentence.
+ worth failing over any of that. Two things are NOT accepted: an answer with
+ no headline in it, because a blank header would look like a broken pane
+ rather than a missing sentence — and a chat-shaped answer, because a CLI
+ agent that reacted to the contract instead of following it opens with an
+ acknowledgement, and "Understood! I see …" as a settled pane title is the
+ live failure this guard exists for.
"""
headline = ""
detail_parts: list[str] = []
seen_detail = False
+ labelled = False
for raw in str(text or "").splitlines():
line = raw.strip().strip("`").strip()
if not line:
@@ -829,6 +850,7 @@ def parse_answer(text: str, *, writer: str = "") -> SmartRecap | None:
lowered = line.lower()
if lowered.startswith("headline:"):
headline = line.split(":", 1)[1].strip()
+ labelled = True
seen_detail = False
continue
if lowered.startswith("detail:"):
@@ -843,7 +865,14 @@ def parse_answer(text: str, *, writer: str = "") -> SmartRecap | None:
headline = line
seen_detail = True
- headline = recap.condense(headline.strip().strip('"').rstrip(".").strip(), HEADLINE_CHARS)
+ headline = headline.strip().strip('"').rstrip(".").strip()
+ # An unlabelled first line is only trusted as a headline while it is
+ # label-sized. A chatty answer is one paragraph, and condensing it into the
+ # budget would dress a chat opener up as a title (see
+ # :data:`UNLABELLED_HEADLINE_CHARS` for the live incident).
+ if not labelled and len(headline) > UNLABELLED_HEADLINE_CHARS:
+ return None
+ headline = recap.condense(headline, HEADLINE_CHARS)
detail = recap.condense(" ".join(detail_parts).strip().strip('"'), DETAIL_CHARS)
if not _valid_model_headline(headline):
return None
@@ -1085,6 +1114,7 @@ __all__ = [
"MIN_NEW_LINES",
"MIN_REFRESH_S",
"STABLE_AFTER_LINES",
+ "UNLABELLED_HEADLINE_CHARS",
"NO_PROVIDER_NOTE",
"WHY_DISABLED",
"WHY_NOT_STARTED",
diff --git a/jarvis/brain/resolver.py b/jarvis/brain/resolver.py
index 65d5fbec96..aaffc72b5f 100644
--- a/jarvis/brain/resolver.py
+++ b/jarvis/brain/resolver.py
@@ -450,6 +450,23 @@ def _subscription_connected(provider: str) -> bool:
return False
+def _native_system_channel(provider: str) -> bool:
+ """Whether ``provider`` forwards a caller's system contract on a real channel.
+
+ Asked of the provider CLASS, like :func:`_subscription_connected`, so a new
+ subscription brain answers for itself (AP-21). ``True`` means the CLI takes
+ the contract as its system prompt; ``False`` (or no flag at all) means the
+ contract can only be PREPENDED to the user prompt, where an agentic CLI may
+ read it as text to react to rather than orders to follow. Never raises — an
+ unloadable class simply does not get the preference.
+ """
+ try:
+ brain_cls = _get_registry().get_class(provider)
+ except Exception: # noqa: BLE001 - an unloadable plugin earns no preference
+ return False
+ return bool(getattr(brain_cls, "native_system_prompt", False))
+
+
def _subscription_candidates(config: JarvisConfig) -> list[str]:
"""Registered brain providers billed against a subscription, in card order.
@@ -505,6 +522,16 @@ def resolve_subscription_brain(
log.info("resolve_subscription_brain: candidates unavailable", exc_info=True)
return None
+ # Contract fidelity outranks card order: a CLI with a dedicated system
+ # channel obeys the caller's contract, while one that can only prepend it
+ # answers as an agent reading orders inside its input. Live 2026-08-11:
+ # antigravity, first by card order, wrote every Agentic IDE pane title as a
+ # chat acknowledgement ("Understood! I see …") while the signed-in Claude
+ # CLI — which takes a real ``--system-prompt`` — was never asked. The sort
+ # is stable, so card order still decides among equals, and a preferred
+ # provider that is not signed in falls through exactly as before.
+ candidates.sort(key=lambda provider: not _native_system_channel(provider))
+
for provider in candidates:
if not _subscription_connected(provider):
log.debug("resolve_subscription_brain: %s not signed in", provider)
diff --git a/jarvis/plugins/brain/antigravity.py b/jarvis/plugins/brain/antigravity.py
index 3bab8649dd..68ade4cf39 100644
--- a/jarvis/plugins/brain/antigravity.py
+++ b/jarvis/plugins/brain/antigravity.py
@@ -201,6 +201,14 @@ class AntigravityBrain:
context_window: int = 1_048_576
supports_tools: bool = True # ignored on the CLI path (mirrors CodexBrain)
supports_vision: bool = False
+ # Neither agy nor the Gemini CLI takes a real system prompt in headless
+ # mode: structured mode PREPENDS the caller's contract to the user prompt
+ # (render_structured_prompt), where the agent may read it as text to react
+ # to rather than orders to follow. Live 2026-08-11: every Agentic IDE pane
+ # title became a chat acknowledgement ("Understood! I see …") the moment
+ # this provider wrote the recaps. The subscription resolver uses this flag
+ # to prefer a sibling with a dedicated system channel when one is signed in.
+ native_system_prompt: bool = False
def __init__(
self,
diff --git a/jarvis/plugins/brain/claude_cli.py b/jarvis/plugins/brain/claude_cli.py
index 719d87ef6b..56fb45b1f7 100644
--- a/jarvis/plugins/brain/claude_cli.py
+++ b/jarvis/plugins/brain/claude_cli.py
@@ -126,6 +126,14 @@ class ClaudeCliBrain:
# Computer-Use screenshot to a brain that cannot serve it (AP-21).
supports_tools: bool = False
supports_vision: bool = False
+ # Structured mode hands the caller's contract to ``--system-prompt`` — a
+ # channel the model treats as its instructions, not as user text to react
+ # to. The subscription resolver prefers providers that can say True here:
+ # a sibling that can only PREPEND the contract to the prompt is an
+ # autonomous agent reading orders inside its input, and its observed
+ # failure is an acknowledgement ("Understood! I see …") shipped as the
+ # answer.
+ native_system_prompt: bool = True
def __init__(
self,
diff --git a/jarvis/plugins/brain/codex.py b/jarvis/plugins/brain/codex.py
index a81ff95d01..57320c7701 100644
--- a/jarvis/plugins/brain/codex.py
+++ b/jarvis/plugins/brain/codex.py
@@ -316,6 +316,12 @@ class CodexBrain:
# plan blind. The class default is the safe blind value; __init__ flips it to
# True only when an API key (→ the vision-capable API path) is configured.
supports_vision: bool = False
+ # The subscription CLI path has no dedicated system channel: structured
+ # mode prepends the caller's contract to the flattened prompt
+ # (render_structured_prompt). The subscription resolver prefers a sibling
+ # that forwards the contract on a real system channel when one is signed
+ # in — see the antigravity note for the live failure this prevents.
+ native_system_prompt: bool = False
def __init__(
self,
diff --git a/tests/unit/agentic_ide/test_recap_engine.py b/tests/unit/agentic_ide/test_recap_engine.py
index fa93155a6f..40a9a49a9d 100644
--- a/tests/unit/agentic_ide/test_recap_engine.py
+++ b/tests/unit/agentic_ide/test_recap_engine.py
@@ -373,6 +373,42 @@ def test_cli_debris_is_rejected_as_a_model_headline(answer: str) -> None:
assert recap_engine.parse_answer(answer) is None
+ "answer",
+ [
+ # Live 2026-08-11: with every API key dead, the recaps rode a
+ # subscription CLI whose contract is only prepended text — it answered
+ # conversationally, and these opened the settled title of every pane.
+ "Understood! I see a Claude Code session working through German i18n keys.",
+ "Hello! It looks like you have a coding agent running in this terminal.",
+ "It looks like Claude Code is reviewing the pane title heuristics in this "
+ "repository and has not finished that work yet.",
+ "Here are the German translations this session has produced so far, with "
+ "the files they came from.",
+ "Here you go:",
+ "HEADLINE: Understood! Reviewing the transcript now\n"
+ "DETAIL: The pane is being read and a proper summary follows.",
+ ],
+)
+def test_a_chat_shaped_answer_is_rejected_rather_than_shipped_as_a_title(
+ answer: str,
+) -> None:
+ """A CLI agent that REACTS to the contract must not name the pane."""
+ assert recap_engine.parse_answer(answer) is None
+
+
+def test_a_short_unlabelled_label_is_still_accepted() -> None:
+ """The chat-shape guard must not take the forgiving path down with it."""
+ answer = recap_engine.parse_answer(
+ "Login tests — 3 failures on one fixture\n"
+ "The goal was to stabilize the login suite. Three tests still fail on a "
+ "missing fixture."
+ )
+
+ assert answer is not None
+ assert answer.headline == "Login tests — 3 failures on one fixture"
+
+
# ------------------------------------------------------------ the summary itself
diff --git a/tests/unit/brain/test_resolve_subscription_brain.py b/tests/unit/brain/test_resolve_subscription_brain.py
index 4d229de5a9..44c6fc478d 100644
--- a/tests/unit/brain/test_resolve_subscription_brain.py
+++ b/tests/unit/brain/test_resolve_subscription_brain.py
@@ -22,15 +22,22 @@ class _FakeRegistry:
available: list[str],
accepts_structured: tuple[str, ...] = (),
fail: tuple[str, ...] = (),
+ native_system: tuple[str, ...] = (),
) -> None:
self._available = list(available)
self._accepts = set(accepts_structured)
self._fail = set(fail)
+ self._native = set(native_system)
self.calls: list[tuple[str, dict[str, Any]]] = []
def available(self) -> list[str]:
return list(self._available)
+ def get_class(self, name: str) -> type:
+ return type(
+ "FakeBrain", (), {"native_system_prompt": name in self._native}
+ )
+
def instantiate(self, name: str, **kwargs: Any) -> Any:
self.calls.append((name, dict(kwargs)))
if name in self._fail:
@@ -70,6 +77,42 @@ def test_a_provider_that_cannot_take_structured_prompts_is_skipped(monkeypatch)
assert resolver.resolve_subscription_brain(_cfg()) == "brain:claude-cli"
+def test_a_native_system_channel_outranks_card_order(monkeypatch) -> None:
+ """Contract fidelity beats card position.
+
+ Live 2026-08-11: antigravity, first by card order, wrote every Agentic IDE
+ pane title as a chat acknowledgement ("Understood! I see …") because its
+ contract is only prepended text — while the signed-in Claude CLI, which
+ takes a real system prompt, was never asked.
+ """
+ registry = _FakeRegistry(
+ available=["antigravity", "claude-cli"],
+ accepts_structured=("antigravity", "claude-cli"),
+ native_system=("claude-cli",),
+ )
+ monkeypatch.setattr(resolver, "_get_registry", lambda: registry)
+ monkeypatch.setattr(resolver, "_subscription_connected", lambda name: True)
+
+ assert resolver.resolve_subscription_brain(_cfg()) == "brain:claude-cli"
+
+
+def test_a_preferred_provider_that_is_not_signed_in_still_falls_through(
+ monkeypatch,
+) -> None:
+ """The preference reorders candidates; the connection probe still gates."""
+ registry = _FakeRegistry(
+ available=["antigravity", "claude-cli"],
+ accepts_structured=("antigravity", "claude-cli"),
+ native_system=("claude-cli",),
+ )
+ monkeypatch.setattr(resolver, "_get_registry", lambda: registry)
+ monkeypatch.setattr(
+ resolver, "_subscription_connected", lambda name: name == "antigravity"
+ )
+
+ assert resolver.resolve_subscription_brain(_cfg()) == "brain:antigravity"
+
+
def test_disconnected_subscriptions_are_not_offered(monkeypatch) -> None:
"""A CLI that is installed but not logged in must not be chosen."""
registry = _FakeRegistry(available=["codex"], accepts_structured=("codex",))