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 18:33)

Ruben Lütkef837605fbe88
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index a3b03e5663..b67287fe79 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -823,6 +823,31 @@ def _is_opinion_advice_question(user_text: str) -> bool:
return bool(_OPINION_ADVICE_QUESTION_RE.search(user_text or ""))
+def _conversational_turn_suppresses_read_mandate(user_text: str) -> bool:
+ """True when an opinion/advice/conversational turn must stand the READ
+ evidence gate down instead of forcing a tool.
+
+ Live 2026-06-30 (Bora-Bora voice session): the user asked a plain travel
+ question — "...bin jetzt bei meinem Budget bei so 25.000 Euro ... passt es?".
+ The word "budget" matched the cloud-billing domain, the gate FORCED
+ ``cli_gcloud``, the model answered the travel question without that
+ (irrelevant) tool, and the honesty backstop then VOIDED the good answer
+ (``executed=[]``). The very same classifier that already inlines such a turn
+ (force-spawn skip, log "opinion/advice/conversational question — inline")
+ suppresses the read mandate here, so a chat/advice turn is never dead-ended
+ by an irrelevant tool it never needed. The tool stays in the surface, so the
+ model keeps discretion to call it — it is just never *forced*, and the answer
+ is never voided.
+
+ Narrow on purpose (no confab regression): fires ONLY on an actual
+ opinion/advice/conversational opener. A bare data lookup ("Was sind meine
+ Abrechnungen?", live 2026-06-17) matches no opener and stays gated. Pure
+ regex (AP-11). WRITE mandates (``resolve_save_mandate``) are intentional and
+ handled separately — only the READ gate stands down here.
+ """
+ return _is_opinion_advice_question(user_text)
+
+
# A spawn / sub-agent / worker token in DE/EN/ES (declined forms included). Used
# by both the decline guard below and nowhere else — kept local on purpose.
_SPAWN_TOKEN = (
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 7c93be6db6..d64d2e5666 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -625,12 +625,17 @@ class EvidenceDomainsConfig(BaseModel):
# "cloud" domain), so a billing question deterministically FORCES a
# real cli_gcloud call (or an honest refusal) instead of relying on the
# model's discretion (live 2026-06-17). Keywords are cloud/billing
- # specific — NO bare "kosten"/"cost" so "was kostet X" never hijacks.
+ # specific — NO bare "kosten"/"cost" so "was kostet X" never hijacks, and
+ # NO bare "budget" so a travel/household/project budget never forces a
+ # billing call (live 2026-06-30 Bora-Bora session: "bei meinem Budget bei
+ # 25.000 Euro" voided a good travel answer). Cloud-budget phrasing is kept
+ # via the explicit "cloud budget"/"gcp budget" phrases instead.
"cloud": [
"google cloud", "gcp", "gcloud", "cloud-cli", "cloud cli",
"google-kosten", "google kosten", "cloud-kosten", "cloud kosten",
"cloud-rechnung", "cloud rechnung", "cloud billing", "billing account",
- "abrechnung", "abrechnungen", "guthaben", "billing", "budget",
+ "cloud budget", "cloud-budget", "gcp budget", "gcloud budget",
+ "abrechnung", "abrechnungen", "guthaben", "billing",
],
# Local screen / window-activity history. Served by the always-on
# internal `awareness-recall` tool (wired into the domain→tool map in
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
index 3f8d3a759e..e4217be5cb 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
@@ -167,3 +167,85 @@ describe("ConnectIconButton click-lock", () => {
expect(onConnect).toHaveBeenCalledTimes(2);
});
});
+
+// A revoked / expired plugin (status needs_reauth) must NOT look like a never-
+// connected one. It surfaces a distinct "Reconnect" affordance that re-runs the
+// same connect flow — the one-click repair for a dead token.
+describe("ConnectIconButton reconnect state", () => {
+ it("renders a Reconnect button for needs_reauth that triggers onConnect", async () => {
+ const onConnect = vi.fn(() => Promise.resolve());
+ render(
+ <ConnectIconButton
+ status="needs_reauth"
+ onConnect={onConnect}
+ onDisconnect={() => {}}
+ />,
+ );
+ const btn = screen.getByRole("button", { name: "Reconnect plugin" });
+ expect(btn).toBeDefined();
+ await act(async () => {
+ fireEvent.click(btn);
+ });
+ expect(onConnect).toHaveBeenCalledTimes(1);
+ });
+
+ it("never shows a plain Connect or Disconnect button for needs_reauth", () => {
+ render(
+ <ConnectIconButton
+ status="needs_reauth"
+ onConnect={() => {}}
+ onDisconnect={() => {}}
+ />,
+ );
+ expect(screen.queryByRole("button", { name: "Connect plugin" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Disconnect plugin" })).toBeNull();
+ });
+});
+
+describe("PluginsView keeps revoked plugins visible", () => {
+ it("shows a needs_reauth plugin under Installed with a Reconnect-needed badge", async () => {
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ if (String(input) === "/api/marketplace/plugins") {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ version: 1,
+ schema_version: "t",
+ total: 1,
+ connected: 0,
+ plugins: [
+ {
+ id: "gmail",
+ display_name: "Gmail",
+ description: "Mail",
+ category: "Communication",
+ logo_slug: "gmail",
+ auth: { mode: "oauth_pkce_loopback" },
+ status: "needs_reauth",
+ live_callable: false,
+ },
+ ],
+ }),
+ } as Response;
+ }
+ throw new Error(`unexpected fetch ${String(input)}`);
+ });
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
+
+ renderPluginsView();
+
+ // Open the Installed tab — the revoked plugin must be there, not hidden in
+ // Browse as if never connected.
+ await waitFor(() => {
+ expect(screen.getByRole("button", { name: /^Installed\b/i })).toBeDefined();
+ });
+ fireEvent.click(screen.getByRole("button", { name: /^Installed\b/i }));
+
+ await waitFor(() => {
+ expect(screen.getByText("Gmail")).toBeDefined();
+ });
+ expect(screen.getByText(/reconnect/i)).toBeDefined();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
index ee7bdd136b..c26ccce8d8 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
@@ -7,12 +7,14 @@ import {
ExternalLink,
Search,
RefreshCw,
+ RotateCw,
Plus,
Check,
Copy,
Sparkles,
X,
Loader2,
+ AlertTriangle,
} from "lucide-react";
import { ViewHeader } from "@/views/ChatsView";
import { ScrollArea } from "@/components/ui/scroll-area";
@@ -321,8 +323,28 @@ export function PluginsView() {
() => data?.plugins.map(adapt) ?? [],
[data],
);
+ // "Installed" keeps every plugin the user ever connected — including a revoked
+ // (needs_reauth) or errored one — so a dead token surfaces a Reconnect prompt
+ // here instead of silently dropping back into Browse as a plain "+".
const installed = useMemo(
- () => allPlugins.filter((p) => p.status === "connected"),
+ () =>
+ allPlugins.filter(
+ (p) =>
+ p.status === "connected" ||
+ p.status === "needs_reauth" ||
+ p.status === "error",
+ ),
+ [allPlugins],
+ );
+ const connectedCount = useMemo(
+ () => allPlugins.filter((p) => p.status === "connected").length,
+ [allPlugins],
+ );
+ const needsAttentionCount = useMemo(
+ () =>
+ allPlugins.filter(
+ (p) => p.status === "needs_reauth" || p.status === "error",
+ ).length,
[allPlugins],
);
@@ -346,7 +368,11 @@ export function PluginsView() {
? "Loading catalog…"
: error
? "Backend unreachable"
- : `${allPlugins.length} available · ${installed.length} connected`
+ : `${allPlugins.length} available · ${connectedCount} connected${
+ needsAttentionCount > 0
+ ? ` · ${needsAttentionCount} need reconnect`
+ : ""
+ }`
}
right={
<Button
@@ -896,15 +922,21 @@ function PluginRow({
onDisconnect,
}: { plugin: Plugin } & ConnectHandlers) {
const isConnected = plugin.status === "connected";
+ const needsReauth = plugin.status === "needs_reauth";
+ const isError = plugin.status === "error";
const isMulticolor = !!plugin.logoUrl;
return (
<article
className={cn(
"group flex items-center gap-3 rounded-lg border bg-card/40 px-3 py-2.5 transition-colors",
- isConnected
- ? "border-primary/30"
- : "border-border hover:border-primary/40 hover:bg-card/70",
+ isConnected && "border-primary/30",
+ needsReauth && "border-amber-500/40",
+ isError && "border-destructive/40",
+ !isConnected &&
+ !needsReauth &&
+ !isError &&
+ "border-border hover:border-primary/40 hover:bg-card/70",
)}
>
<div className="grid h-10 w-10 shrink-0 place-items-center rounded-md border border-border/60 bg-white">
@@ -931,6 +963,18 @@ function PluginRow({
· Live
</span>
)}
+ {needsReauth && (
+ <span className="inline-flex items-center gap-1 text-[9px] font-medium uppercase tracking-wider text-amber-500">
+ <AlertTriangle className="h-2.5 w-2.5" />
+ Reconnect needed
+ </span>
+ )}
+ {isError && (
+ <span className="inline-flex items-center gap-1 text-[9px] font-medium uppercase tracking-wider text-destructive">
+ <AlertTriangle className="h-2.5 w-2.5" />
+ Error
+ </span>
+ )}
</div>
<p className="truncate text-xs text-muted-foreground">{plugin.description}</p>
</div>
@@ -994,6 +1038,33 @@ export function ConnectIconButton({
}
};
+ // A revoked / errored token re-runs the SAME connect flow, but is shown as a
+ // distinct amber "Reconnect" affordance so it can never be mistaken for a
+ // never-connected "+" (the silent-rot bug this view used to have).
+ const needsReconnect = status === "needs_reauth" || status === "error";
+ if (needsReconnect) {
+ return (
+ <button
+ type="button"
+ onClick={handleClick}
+ disabled={busy}
+ aria-busy={busy}
+ className={cn(
+ "grid h-7 w-7 shrink-0 place-items-center rounded-full border border-amber-500/50 bg-amber-500/10 text-amber-500 transition-all hover:bg-amber-500/20 group-hover:scale-105",
+ busy && "cursor-not-allowed opacity-60 group-hover:scale-100",
+ )}
+ aria-label="Reconnect plugin"
+ title="Reconnect"
+ >
+ {busy ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <RotateCw className="h-3.5 w-3.5" />
+ )}
+ </button>
+ );
+ }
+
return (
<button
type="button"
diff --git a/tests/unit/brain/test_evidence_gate_conversational_standdown.py b/tests/unit/brain/test_evidence_gate_conversational_standdown.py
new file mode 100644
index 0000000000..47dd0e50fe
--- /dev/null
+++ b/tests/unit/brain/test_evidence_gate_conversational_standdown.py
@@ -0,0 +1,116 @@
+"""A false READ tool-mandate must never collapse a conversational voice turn.
+
+Live 2026-06-30 (Bora-Bora voice session, ``voice-session-2026-06-30_17-58``):
+the user asked a plain travel question — "...bin jetzt bei meinem Budget bei so
+25.000 Euro für zwei Personen, passt es?". The word **"budget"** sat in the
+Google-Cloud-billing keyword list, so the evidence gate FORCED ``cli_gcloud``;
+the model answered the travel question without that (irrelevant) tool, and the
+honesty backstop then VOIDED the good answer with a canned failure phrase
+(``executed=[]``). Two defenses, tested here:
+
+* A1 — a bare "budget" no longer selects the cloud-billing domain.
+* A2 — an opinion/advice/conversational turn stands the READ gate down entirely
+ (it never *forces* a tool, so the answer is never voided), while a pure data
+ lookup ("Was sind meine Abrechnungen?") stays gated (no confab regression).
+* B3 — when a *genuine* read mandate is unmet, the spoken fallback NAMES the
+ capability ("…deine Cloud-Abrechnung…") instead of the generic "the tool",
+ which also carries the info forward in history for a follow-up "which tool?".
+"""
+from jarvis.brain.evidence_gate import check_evidence_domain
+from jarvis.brain.manager import (
+ _conversational_turn_suppresses_read_mandate,
+ _evidence_unfulfilled_answer,
+)
+from jarvis.core.capabilities import CapabilityRegistry
+from jarvis.core.config import EvidenceDomainsConfig
+
+_RECOMBINED_BORA = (
+ "Was geht ab? Was ist morgen für ein Tag? Guten Tag, ich habe noch eine "
+ "Frage an dich und zwar möchte ich nach Bora Bora, was würdest du mir "
+ "empfehlen, was ich für den Urlaub brauche? Ich hab jetzt so für zwei "
+ "Wochen geplant und bin jetzt bei meinem Budget bei so 25.000 Euro für "
+ "zwei Personen, passt es?"
+)
+
+
+def _cloud_gate(text: str):
+ return check_evidence_domain(
+ text,
+ enabled=True,
+ domains=EvidenceDomainsConfig().domains,
+ capability_registry=CapabilityRegistry(),
+ domain_tool_map={"cloud": "cli_gcloud"},
+ refusal_hint_fn=None,
+ )
+
+
+# --- A1: bare "budget" must not hijack the cloud-billing domain --------------
+
+
+def test_bare_travel_budget_does_not_force_gcloud():
+ # A travel / household / project budget is not a cloud bill (mirror of the
+ # existing "was kostet X" hard negative).
+ v = _cloud_gate("Was ist mit meinem Budget für den Urlaub?")
+ assert v.kind == "pass"
+
+
+def test_real_cloud_billing_question_still_forces_gcloud():
+ # Capability preserved: a genuine cloud-billing lookup still mandates the CLI.
+ for utterance in [
+ "Zeig mir meine cloud billing",
+ "Zeig mir mein cloud budget",
+ "Was sind meine aktuellsten Abrechnungen?",
+ ]:
+ v = _cloud_gate(utterance)
+ assert v.kind == "require_tool", utterance
+ assert v.tool_name == "cli_gcloud", utterance
+
+
+# --- A2: conversational turns stand the READ gate down ----------------------
+
+
+def test_conversational_turn_suppresses_read_mandate():
+ # The exact Bora-Bora turn (continuation-recombined) is opinion/advice.
+ assert _conversational_turn_suppresses_read_mandate(_RECOMBINED_BORA) is True
+ assert _conversational_turn_suppresses_read_mandate(
+ "Was würdest du mir empfehlen für meinen Urlaub?"
+ ) is True
+
+
+def test_pure_data_lookup_is_not_suppressed():
+ # The 2026-06-17 confabulation guard must NOT be re-opened: a bare data
+ # lookup carries no opinion/advice opener, so it stays gated.
+ assert _conversational_turn_suppresses_read_mandate(
+ "Was sind meine Abrechnungen?"
+ ) is False
+ assert _conversational_turn_suppresses_read_mandate(
+ "Wie hoch ist meine Cloud-Abrechnung?"
+ ) is False
+
+
+# --- B3: the unmet-mandate fallback names the capability --------------------
+
+
+def test_unfulfilled_answer_names_the_domain():
+ de = _evidence_unfulfilled_answer(lang="de", domain="cloud")
+ assert "Cloud-Abrechnung" in de
+ assert "durchgelaufen" in de.lower() or "abrufen" in de.lower()
+ # Honesty preserved — never claims the tool "blocked" / invents a reason.
+ assert "blockiert" not in de.lower() and "erkl" not in de.lower()
+ en = _evidence_unfulfilled_answer(lang="en", domain="calendar")
+ assert "calendar" in en.lower()
+ es = _evidence_unfulfilled_answer(lang="es", domain="email")
+ assert "bandeja" in es.lower() or "entrada" in es.lower()
+
+
+def test_unfulfilled_answer_unknown_domain_uses_generic():
+ # An unrecognised domain degrades to the existing generic phrase.
+ assert _evidence_unfulfilled_answer(
+ lang="de", domain="totally-unknown"
+ ) == _evidence_unfulfilled_answer(lang="de")
+
+
+def test_unfulfilled_answer_no_domain_is_unchanged_generic():
+ # Back-compat: the no-domain call keeps the original generic wording.
+ de = _evidence_unfulfilled_answer(lang="de")
+ assert "abrufen" in de.lower() or "durchgelaufen" in de.lower()
diff --git a/tests/unit/brain/test_signalless_write_tool_hide.py b/tests/unit/brain/test_signalless_write_tool_hide.py
new file mode 100644
index 0000000000..2f3fda80c8
--- /dev/null
+++ b/tests/unit/brain/test_signalless_write_tool_hide.py
@@ -0,0 +1,90 @@
+"""A signalless turn must not be able to reach a deterministic write/record tool.
+
+Latent exposure found 2026-06-30 (deep-dive agent 2): on a no-action
+conversational turn the model still sees the foreground write/record tools
+(``contact-upsert``, ``update-profile``, ``wiki-ingest``, ``google_calendar``
+writes, ``call-contact``). The existing ``_hide_action_tools_on_signalless_turn``
+only stripped ``computer_use`` + the spawn vehicles. This widens it to the
+write/record tools too — with a hard exemption for any tool the deterministic
+layer ALREADY mandated this turn (a real "merk dir, dass…" keeps ``wiki-ingest``
+via ``resolve_save_mandate``; a calendar READ keeps ``google_calendar`` via the
+evidence gate), so the say-do write feature and calendar reads do not regress.
+"""
+from __future__ import annotations
+
+import re
+
+from jarvis.brain.manager import BrainManager
+
+_NEVER = re.compile(r"(?!)") # matches nothing — no explicit heavy-work vehicle
+
+
+def _mgr() -> BrainManager:
+ m = BrainManager.__new__(BrainManager) # bypass heavy __init__
+ m._force_spawn_pattern = _NEVER
+ m._evidence_required_tool = ""
+ # Signalless by default; individual tests flip these as needed.
+ m._turn_has_action_intent = lambda _t: False # type: ignore[method-assign]
+ m._research_wants_artifact = lambda _t: False # type: ignore[method-assign]
+ return m
+
+
+def _surface() -> dict:
+ return {
+ "search_web": object(), # read — must stay
+ "wiki-recall": object(), # read — must stay
+ "screenshot": object(), # read — must stay
+ "contact-upsert": object(), # write — hide on signalless
+ "update-profile": object(), # write — hide on signalless
+ "wiki-ingest": object(), # write — hide on signalless
+ "google_calendar": object(), # write path — hide on signalless
+ "call-contact": object(), # action (places a call) — hide
+ "computer_use": object(), # existing hidden
+ "spawn_worker": object(), # existing hidden
+ }
+
+
+def test_signalless_turn_hides_write_and_record_tools():
+ m = _mgr()
+ out = m._hide_action_tools_on_signalless_turn(_surface(), "Was geht ab?")
+ for hidden in (
+ "contact-upsert", "update-profile", "wiki-ingest",
+ "google_calendar", "call-contact", "computer_use", "spawn_worker",
+ ):
+ assert hidden not in out, hidden
+ # Read-only tools are never stripped — the turn stays answerable inline.
+ for kept in ("search_web", "wiki-recall", "screenshot"):
+ assert kept in out, kept
+
+
+def test_action_intent_keeps_the_write_tools():
+ m = _mgr()
+ m._turn_has_action_intent = lambda _t: True # type: ignore[method-assign]
+ out = m._hide_action_tools_on_signalless_turn(
+ _surface(), "Trag meinen Urlaub in den Kalender ein"
+ )
+ assert "google_calendar" in out
+ assert "contact-upsert" in out
+
+
+def test_mandated_write_tool_is_exempt_say_do_stays_green():
+ # resolve_save_mandate fired for "merk dir, dass…" and set the mandate; the
+ # signalless hide must NOT strip the mandated write tool, or the say-do
+ # write feature breaks again (project_bug_contact_say_do_gap_no_upsert).
+ m = _mgr()
+ m._evidence_required_tool = "wiki-ingest"
+ out = m._hide_action_tools_on_signalless_turn(
+ _surface(), "Merk dir, dass ich nach Bora Bora will"
+ )
+ assert "wiki-ingest" in out # the mandated tool survives
+ assert "contact-upsert" not in out # other write tools still hidden
+
+
+def test_explicit_subagent_vehicle_keeps_tools():
+ m = _mgr()
+ m._force_spawn_pattern = re.compile(r"deep dive|subagent", re.I)
+ out = m._hide_action_tools_on_signalless_turn(
+ _surface(), "Mach einen deep dive und trag das ein"
+ )
+ assert "spawn_worker" in out
+ assert "google_calendar" in out