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.

chore: auto-save WIP via Claude stop-hook safety net (2026-06-30 17:07)

Ruben Lütke2fffe98447b3
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index ecce41c0ce..ad52346959 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -3498,6 +3498,10 @@ class BrainManager:
# allowlist forms). Reset at the start of every generate() turn.
_evidence_directive: str = ""
_evidence_required_tool: str = ""
+ # True when the mandated tool this turn is a WRITE/create action (e.g.
+ # contact-upsert) rather than a read lookup — switches the honest backstop
+ # to write wording and lets a clarifying question stand. Reset per turn.
+ _evidence_required_is_write: bool = False
# Per-turn self-control directive (general settings/config control). Reset
# at the start of every generate() turn; appended to the system prompt.
_self_control_directive: str = ""
@@ -5812,6 +5816,7 @@ class BrainManager:
# early-returns before the gate runs).
self._evidence_directive = ""
self._evidence_required_tool = ""
+ self._evidence_required_is_write = False
# General self-control directive — reset here, set below once the
# smalltalk classification for this turn is known.
self._self_control_directive = ""
@@ -6004,6 +6009,36 @@ class BrainManager:
self._evidence_directive = verdict.directive
self._evidence_required_tool = verdict.tool_name
+ # Say-do honesty guard for WRITES (contacts). The read evidence gate
+ # above never fires on a "save this person" turn (it is not a lookup),
+ # so a confirmed offer ("ja, leg die an … die Mail ist …") used to be
+ # answered with a chatty "Okay, sehr gut" and NO contact-upsert call —
+ # the address book stayed empty (live session 2026-06-30). Mandate the
+ # real tool this turn, reusing the evidence machinery: the prompt
+ # directive, the smalltalk tool-widening (_evidence_required_tool stays
+ # visible), and the unverified-answer backstop that catches a fake
+ # confirmation. Only when the read gate did not already mandate a tool,
+ # and only if contact-upsert is actually registered (a deployment
+ # without contacts degrades to no mandate — never a mandate for a
+ # missing tool, §3 open-source).
+ if (
+ not self._evidence_required_tool
+ and "contact-upsert" in (getattr(self, "_tools", None) or {})
+ ):
+ from jarvis.brain.contact_intent import (
+ CONTACT_WRITE_DIRECTIVE,
+ detect_contact_write_intent,
+ )
+
+ if detect_contact_write_intent(user_text):
+ self._evidence_directive = CONTACT_WRITE_DIRECTIVE
+ self._evidence_required_tool = "contact-upsert"
+ self._evidence_required_is_write = True
+ log.info(
+ "Say-do guard: contact-write intent — mandating "
+ "contact-upsert this turn"
+ )
+
# Phase 5 / ADR-0006: pre-call budget gate. Block rather than request
# when cooldown is active or the task/daily budget is exhausted.
trace_uuid = turn_trace_id
@@ -6588,23 +6623,26 @@ class BrainManager:
# question"). Replace it with an honest non-data fallback; never speak an
# answer a mandated read tool was supposed to ground. Runs AFTER recovery
# so a leaked-but-recovered mandated tool (real data) is not pre-empted.
- if recovered is None and _evidence_answer_is_unverified(
- self._evidence_required_tool,
- _turn_executed,
- response_text,
- suppressed=self._last_turn_suppressed,
- ):
- log.warning(
- "Evidence gate mandated %s but it never ran (executed=%s) — "
- "replacing the unverified answer with an honest fallback.",
- self._evidence_required_tool,
- sorted(_turn_executed),
- )
- response_text = _evidence_unfulfilled_answer(
+ if recovered is None and self._evidence_required_tool:
+ _replacement = _unfulfilled_replacement(
+ required_tool=self._evidence_required_tool,
+ executed=_turn_executed,
+ response_text=response_text,
+ suppressed=self._last_turn_suppressed,
+ is_write=self._evidence_required_is_write,
lang=resolve_output_language(
self._reply_language, "unknown", user_text, default="de"
- )
+ ),
)
+ if _replacement is not None:
+ log.warning(
+ "Mandated tool %s never ran (executed=%s, write=%s) — "
+ "replacing the unverified answer with an honest fallback.",
+ self._evidence_required_tool,
+ sorted(_turn_executed),
+ self._evidence_required_is_write,
+ )
+ response_text = _replacement
# 4. History + Events
if use_history:
diff --git a/jarvis/memory/wiki/curator_llm.py b/jarvis/memory/wiki/curator_llm.py
index 8afb26b115..1845be93cf 100644
--- a/jarvis/memory/wiki/curator_llm.py
+++ b/jarvis/memory/wiki/curator_llm.py
@@ -72,7 +72,9 @@ _CHEAP_MODEL_FALLBACK: dict[str, str] = {
"claude-api": "claude-haiku-4-5-20251001",
"gemini": "gemini-3-flash-preview",
"openai": "gpt-5.5",
- "codex": "gpt-5.5",
+ # codex removed: not in TIER_DEFAULTS_BY_PROVIDER["router"]; the fallback
+ # map must stay in lock-step with the live router defaults (drift guard in
+ # test_cheap_model_fallback_map_matches_live_router_defaults).
"deepseek": "deepseek-chat",
# Gateway: background curation must not bill a paid Anthropic model on a
# free OpenRouter key (§3/AP-22) — use a free general-purpose model.
diff --git a/jarvis/plugins/tool/navigate.py b/jarvis/plugins/tool/navigate.py
index 91a4fa85bb..ab31d78be2 100644
--- a/jarvis/plugins/tool/navigate.py
+++ b/jarvis/plugins/tool/navigate.py
@@ -30,6 +30,7 @@ KNOWN: frozenset[str] = frozenset(
"mcps",
"tasks",
"sessions",
+ "run_inspector",
"clis",
"cli-test-hub",
"board",
@@ -44,6 +45,8 @@ KNOWN: frozenset[str] = frozenset(
"socials",
"taskbar",
"contacts",
+ "feedback",
+ "agent-instructions",
}
)
diff --git a/tests/e2e/test_self_mod_e2e.py b/tests/e2e/test_self_mod_e2e.py
index 921b09a568..789589b1c3 100644
--- a/tests/e2e/test_self_mod_e2e.py
+++ b/tests/e2e/test_self_mod_e2e.py
@@ -648,11 +648,15 @@ class TestRestApi:
assert "events" in body
assert body["total_returned"] >= 1
- def test_get_mutable_returns_8_specs(self, api_app: FastAPI) -> None:
+ def test_get_mutable_returns_schema_derived_specs(self, api_app: FastAPI) -> None:
+ # The mutable set is now derived automatically from the full JarvisConfig
+ # schema (schema_introspect.py), so the count grows with the schema.
+ # The hard-coded 8 was the old hand-maintained list; the floor here is a
+ # meaningful regression guard (schema shrinking would be a bug).
client = TestClient(api_app)
response = client.get("/api/self-mod/mutable")
assert response.status_code == 200
- assert len(response.json()["specs"]) == 8
+ assert len(response.json()["specs"]) >= 50
def test_get_backups_empty_when_no_mutations(
self, api_app: FastAPI
diff --git a/tests/integration/test_launcher_headless.py b/tests/integration/test_launcher_headless.py
index 92f408bd81..7073f87785 100644
--- a/tests/integration/test_launcher_headless.py
+++ b/tests/integration/test_launcher_headless.py
@@ -42,7 +42,14 @@ def _patch_webserver(monkeypatch):
def _make_cfg(port: int = 18123):
- return SimpleNamespace(ui=SimpleNamespace(admin_api_port=port, dev_mode=False))
+ # `args.port` is read by _run_headless before falling back to _fast_admin_port();
+ # the SimpleNamespace stub must carry the attribute (None = use auto-detect).
+ return SimpleNamespace(
+ ui=SimpleNamespace(admin_api_port=port, dev_mode=False),
+ port=None,
+ dev=False,
+ no_lock=True,
+ )
def test_headless_starts_and_stops_on_signal():
diff --git a/tests/integration/test_provider_routes.py b/tests/integration/test_provider_routes.py
index b1e98d021d..49883ba93b 100644
--- a/tests/integration/test_provider_routes.py
+++ b/tests/integration/test_provider_routes.py
@@ -210,7 +210,7 @@ def test_list_providers_exposes_credential_help_and_billing(
by_id = {p["id"]: p for p in body["providers"]}
assert by_id["gemini"]["credential_help"]
assert by_id["gemini"]["billing"] == "api"
- assert by_id["antigravity"]["billing"] == "subscription"
+ assert by_id["antigravity"]["billing"] == "subscription_or_api"
assert by_id["codex"]["billing"] == "subscription_or_api"
assert by_id["faster-whisper"]["billing"] == "local"
diff --git a/tests/unit/brain/test_contacts_integration.py b/tests/unit/brain/test_contacts_integration.py
index ae1bdc07fe..a8e02c4ea0 100644
--- a/tests/unit/brain/test_contacts_integration.py
+++ b/tests/unit/brain/test_contacts_integration.py
@@ -104,8 +104,10 @@ def test_email_by_name_directive_present_when_tools_wired() -> None:
prompt = _manager(tools=tools)._build_system_prompt()
assert "contact-lookup" in prompt
assert "gmail" in prompt
- # A recognizable marker so the directive is unambiguous in the prompt.
- assert "KONTAKT" in prompt.upper()
+ # The directive block opens with the "CONTACTS:" label; this is the
+ # unambiguous marker that the directive is present (the German "KONTAKT"
+ # label was dropped when the persona was reworked to English-first).
+ assert "CONTACTS" in prompt
def test_email_by_name_directive_absent_without_gmail() -> None:
diff --git a/tests/unit/brain/test_custom_system_prompt_in_manager.py b/tests/unit/brain/test_custom_system_prompt_in_manager.py
index 8fd8839965..e30d3ae499 100644
--- a/tests/unit/brain/test_custom_system_prompt_in_manager.py
+++ b/tests/unit/brain/test_custom_system_prompt_in_manager.py
@@ -40,8 +40,9 @@ def _isolate_data_dir(tmp_path, monkeypatch: pytest.MonkeyPatch):
def test_default_persona_block_present_without_custom() -> None:
prompt = _manager()._build_system_prompt()
- # A signature line from the packaged JARVIS_PERSONA.md persona block.
- assert "voice-based meta-orchestrator" in prompt
+ # A signature phrase from the packaged JARVIS_PERSONA.md persona block
+ # (persona was reworked; "voice companion" opens the new first sentence).
+ assert "voice companion" in prompt
def test_custom_prompt_replaces_default_persona_block() -> None:
diff --git a/tests/unit/brain/test_navigation_intent.py b/tests/unit/brain/test_navigation_intent.py
index 5ea02e8ddd..36c64c0dcc 100644
--- a/tests/unit/brain/test_navigation_intent.py
+++ b/tests/unit/brain/test_navigation_intent.py
@@ -24,7 +24,6 @@ from jarvis.brain.navigation_intent import match_navigation_intent
("wechsel zu den Notizen", "memory"),
("show the agents", "agents"),
("open settings", "settings"),
- ("switch to the terminal", "terminal"),
("go to the board", "board"),
("navigate to socials", "socials"),
("zeig mir die sub-agents", "agents"),
diff --git a/tests/unit/memory/wiki/test_curator_llm.py b/tests/unit/memory/wiki/test_curator_llm.py
index 4d6fcf542a..3798124577 100644
--- a/tests/unit/memory/wiki/test_curator_llm.py
+++ b/tests/unit/memory/wiki/test_curator_llm.py
@@ -663,7 +663,13 @@ def test_resolve_explicit_curator_model_wins() -> None:
def test_resolve_explicit_provider_empty_model_uses_cheap_router_model() -> None:
- """Explicit provider + empty model => that provider's cheap router model."""
+ """Explicit provider + empty model => that provider's cheap router model.
+
+ grok was removed from the brain-provider catalog and from
+ TIER_DEFAULTS_BY_PROVIDER["router"], so _cheap_model_for("grok") returns
+ None — the resolver propagates that and lets the registry pick its own
+ default. This is the correct degradation path for unknown providers.
+ """
from jarvis.memory.wiki.curator_llm import _resolve_provider_and_model
@@ -675,7 +681,9 @@ def test_resolve_explicit_provider_empty_model_uses_cheap_router_model() -> None
)
provider, model = _resolve_provider_and_model(cfg.memory.wiki.curator, cfg)
assert provider == "grok"
- assert model == "grok-4.3"
+ # grok is no longer in the router-tier defaults or _CHEAP_MODEL_FALLBACK;
+ # the resolver returns None so the registry picks its own default.
+ assert model is None
def test_resolve_unknown_provider_returns_none_model() -> None:
diff --git a/tests/unit/ui/test_provider_spec_antigravity.py b/tests/unit/ui/test_provider_spec_antigravity.py
index 08f146588a..84bf8faa28 100644
--- a/tests/unit/ui/test_provider_spec_antigravity.py
+++ b/tests/unit/ui/test_provider_spec_antigravity.py
@@ -17,7 +17,7 @@ def test_antigravity_provider_spec():
assert spec.tier == "brain"
assert spec.brain_switchable is False
assert spec.auth_mode == "antigravity"
- assert spec.secret_keys == () # OAuth-only, no API-key slot
+ assert spec.secret_keys == ("gemini_api_key",) # dual-billing: OAuth OR Gemini API key
assert spec.login_cli is not None
# agy has no `login` subcommand (it hangs) — the login is a bare interactive run.
assert "login" not in spec.login_cli