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(society): keep going after a cancelled Grok tool instead of failing the turn
rubenluetke10-beep60cc121a9dc0
diff --git a/jarvis/agent_chat/jarvis_harness.py b/jarvis/agent_chat/jarvis_harness.pyindex 15e600dae5..b8e2376298 100644--- a/jarvis/agent_chat/jarvis_harness.py+++ b/jarvis/agent_chat/jarvis_harness.py@@ -89,8 +89,10 @@ SYSTEM_PREAMBLE: Final[str] = ("`jarvis__run_shell` and their siblings are Jarvis' hands on the whole ""machine. Use the folder's hands for the folder, Jarvis' for everything else.\n\n""Some of those tools ask the person for approval before they run. That is "- "normal and it is not a failure — wait for the answer rather than routing "- "around it.\n\n"+ "normal and it is not a failure — wait for an approval card that is actually "+ "on screen rather than routing around it. If a tool is cancelled, denied, "+ "missing or fails, that is not the end of the task: read the error, try "+ "another path, and keep going until the original goal is done.\n\n""Do not spawn background workers or sub-agents: for this turn, you are the ""worker.")diff --git a/jarvis/agent_chat/permissions.py b/jarvis/agent_chat/permissions.pyindex 1b2f5534ae..ca7d0a58bc 100644--- a/jarvis/agent_chat/permissions.py+++ b/jarvis/agent_chat/permissions.py@@ -149,13 +149,15 @@ _GROK: Final[tuple[PermissionMode, ...]] = (PermissionMode("default","Ask before acting",- "Grok Build's default: edits and commands would ask; in the chat the "- "CLI cannot ask back, so they are declined and reported.",+ "Grok Build's default would ask; in this chat the CLI cannot ask back — "+ "a prompt that still wanted confirmation used to abort the whole turn — "+ "so tools run (`--always-approve`). Plan is the read-only stance.",),PermissionMode("acceptEdits","Auto-accept edits",- "Edits in the working folder run without asking.",+ "Edits and commands run without asking. Print-mode Grok cannot answer a "+ "permission prompt, so this chat also auto-approves shell calls.",),PermissionMode("plan",diff --git a/jarvis/agent_chat/runner_cli.py b/jarvis/agent_chat/runner_cli.pyindex 333fbd461d..d86f342ed6 100644--- a/jarvis/agent_chat/runner_cli.py+++ b/jarvis/agent_chat/runner_cli.py@@ -76,6 +76,7 @@ from jarvis.agent_chat.permissions import normalize_permissionfrom jarvis.agent_chat.runner_api import TurnHandlefrom jarvis.agent_chat.tool_context import register_turn, unregister_turnfrom jarvis.core.process_utils import NO_WINDOW_CREATIONFLAGS+from jarvis.core.response_style import KEEP_GOING_ON_TOOL_FAILURElog = logging.getLogger(__name__)@@ -506,9 +507,11 @@ def plan_grok(else:# Print-mode grok cannot answer a permission prompt. default and# acceptEdits therefore decline MCP tools (live Morning Briefing,- # 2026-09-17: jarvis__gmail "Tool not found" / cancelled). Jarvis'- # gateway still gates every call.+ # 2026-09-17: jarvis__gmail "Tool not found" / cancelled) and abort+ # the whole turn (live Bot ersteller, 2026-09-17: run_terminal_command+ # "User cancelled"). Jarvis' gateway still gates every call.argv += ["--always-approve"]+ argv += ["--rules", KEEP_GOING_ON_TOOL_FAILURE]if model:argv += ["-m", model]if effort:@@ -1095,9 +1098,9 @@ def _with_identity("society_routines before reporting it active. Do not substitute ""a plan, memory note, shell command or workspace file for scheduling. ""Use existing connected-account information; ask only for essential "- "missing information. If a tool is unavailable or fails, report the "- "actual blocker without claiming completion. Existing permission "- "rules still apply.\n"+ "missing information. "+ + KEEP_GOING_ON_TOOL_FAILURE+ + " Existing permission rules still apply.\n"+ CONVERSATIONAL_TURN_REMINDER+ "\n</jarvis_turn_context>\n\n"+ prompt@@ -1167,6 +1170,9 @@ class _ClaudeState:result_text: str = ""#: The turn's ``result`` line arrived — stdin may close, the CLI exits.saw_result: bool = False+ #: Last tool_result that came back as an error — used when the CLI then+ #: aborts the turn instead of thinking again (Grok print-mode cancel).+ last_tool_error: str | None = Nonedef _claude_request_summary(tool_name: str, tool_input: dict[str, Any]) -> str:@@ -1194,12 +1200,32 @@ def _content_text(content: Any) -> str:if isinstance(block, dict):if block.get("type") == "text":parts.append(str(block.get("text") or ""))+ elif block.get("type") == "content":+ nested = _content_text(block.get("content"))+ if nested:+ parts.append(nested)elif "text" in block:parts.append(str(block.get("text") or ""))elif isinstance(block, str):parts.append(block)- return "\n".join(p for p in parts if p)+ joined = "\n".join(p for p in parts if p)+ # Grok wraps a cancelled tool as ``[{type: content, content: {type: text}}]``+ # — keep the payload readable so recovery can see "User cancelled".+ return joined if joined else json.dumps(content, ensure_ascii=False)if isinstance(content, dict):+ if content.get("type") == "text":+ return str(content.get("text") or "")+ if content.get("type") == "content":+ return _content_text(content.get("content"))+ if "text" in content and not any(+ key in content for key in ("type", "image", "image_url", "input_image")+ ):+ return str(content.get("text") or "")+ inner = content.get("content")+ if inner is not None and inner is not content:+ nested = _content_text(inner)+ if nested:+ return nestedreturn json.dumps(content, ensure_ascii=False)return "" if content is None else str(content)@@ -1394,14 +1420,18 @@ def translate_claude_line(obj: dict[str, Any], st: _ClaudeState) -> list[dict[stif isinstance(content, list):for block in content:if isinstance(block, dict) and block.get("type") == "tool_result":+ output = _content_text(block.get("content"))+ is_error = bool(block.get("is_error"))+ if is_error and output.strip():+ st.last_tool_error = output.strip()out.append(make_event("tool_result",{"turn_id": st.turn_id,"call_id": str(block.get("tool_use_id") or ""),- "output": _content_text(block.get("content")),- "is_error": bool(block.get("is_error")),+ "output": output,+ "is_error": is_error,"duration_ms": None,},)@@ -1415,7 +1445,9 @@ def translate_claude_line(obj: dict[str, Any], st: _ClaudeState) -> list[dict[stst.status = "error"errors = obj.get("errors")detail = "; ".join(str(e) for e in errors if e) if isinstance(errors, list) else ""- st.error = st.result_text or detail or str(obj.get("subtype") or "error")+ st.error = (+ st.result_text or detail or st.last_tool_error or str(obj.get("subtype") or "error")+ )usage = obj.get("usage") or {}if isinstance(usage, dict):for k in (@@ -2353,6 +2385,57 @@ def _resume_was_lost(error: str | None) -> bool:return any(m in low for m in _RESUME_LOST_MARKERS)+# A print-mode CLI that cannot ask back treats an unanswered permission+# prompt as "the user cancelled this tool" and then *exits* — Grok+# StopCancelled / agy 1.1.26. The model never gets a second round. These+# markers are that abort, not a person hitting Stop on the chat.+_TOOL_ABORT_MARKERS: Final[tuple[str, ...]] = (+ "user cancelled the execution",+ "cancelled the execution of tool",+ "tool not found",+ "permission_cancelled",+ "permission_rejected",+ "permission denied",+ "hasn't granted permission",+ "has not granted permission",+ "requires approval",+ "declined this action",+ "the person declined",+)+++def _tool_abort_is_recoverable(error: str | None) -> bool:+ low = (error or "").lower()+ return any(m in low for m in _TOOL_ABORT_MARKERS)+++def _keep_going_prompt(user_text: str, error: str | None) -> str:+ err = (error or "the last tool call failed").strip()[:500]+ return (+ "The last tool call was cancelled or failed:\n"+ f"{err}\n\n"+ f"{KEEP_GOING_ON_TOOL_FAILURE}\n\n"+ "Original request:\n"+ f"{user_text}"+ )+++def _merge_cli_outcome(first: _Outcome, second: _Outcome) -> _Outcome:+ usage = dict(first.usage)+ for key, value in second.usage.items():+ usage[key] = usage.get(key, 0) + value+ cost: float | None = None+ if first.cost_usd is not None or second.cost_usd is not None:+ cost = (first.cost_usd or 0.0) + (second.cost_usd or 0.0)+ return _Outcome(+ second.status,+ second.error,+ usage,+ cost,+ second.vendor_session or first.vendor_session,+ )++async def _surface_identity(session: Any) -> str | None:"""A surface whose identity is per session (an agent-society member'sbriefing) hands that text over; ``None`` keeps Jarvis' own layers."""@@ -2463,6 +2546,28 @@ async def run_cli_turn(outcome = await _run_cli_once(handle, user_text, runner, None, identity=ident, bridge=bridge)+ if (+ outcome.status == "error"+ and _tool_abort_is_recoverable(outcome.error)+ and not handle.cancel.is_set()+ ):+ # Print-mode Grok/agy abort the process after a cancelled tool+ # instead of thinking again. Resume the same vendor session once+ # with the error in front so the model can work around it.+ log.info(+ "agent chat %s: recovering from cancelled/failed tool (%s)",+ handle.turn_id,+ (outcome.error or "")[:180],+ )+ recovered = await _run_cli_once(+ handle,+ _keep_going_prompt(user_text, outcome.error),+ runner,+ outcome.vendor_session or resume,+ identity=ident,+ bridge=bridge,+ )+ outcome = _merge_cli_outcome(outcome, recovered)finally:unregister_turn(session.session_id, tool_context)ACCOUNT_OVERRIDE.reset(account_token)@@ -2762,12 +2867,16 @@ async def _run_cli_once(status = "cancelled"elif status == "done":if state.status == "error":- status, error_text = "error", state.error+ status, error_text = (+ "error",+ state.error or getattr(state, "last_tool_error", None),+ )elif proc.returncode not in (0, None):status = "error"error_text = (state.erroror getattr(state, "last_error", None)+ or getattr(state, "last_tool_error", None)or "\n".join(stderr_tail[-8:]).strip()or f"{runner} exited with code {proc.returncode}.")diff --git a/jarvis/core/response_style.py b/jarvis/core/response_style.pyindex c845378fe8..db182812f2 100644--- a/jarvis/core/response_style.py+++ b/jarvis/core/response_style.py@@ -1,5 +1,19 @@"""Default conversational reporting for human-facing chat replies."""+# Shared by the society briefing, Grok print-mode ``--rules``, and the CLI+# resume that continues a turn after a cancelled or denied tool. One wording+# so a compact Grok identity, a resumed vendor session and the brain runner+# all keep going the same way.+KEEP_GOING_ON_TOOL_FAILURE = (+ "A cancelled, denied, missing or failed tool is not the end of the task. "+ "Read the error. Try another path: a different tool, different arguments, "+ "a connected account, or a question only the person can answer. Keep working "+ "until the original goal is done, or until you have a real blocker only the "+ "person can resolve (a missing login, a permission they must grant, a decision "+ "only they can make). Never stop after the first failed attempt. Never claim "+ "the task is finished just because one call failed."+)+CONVERSATIONAL_TURN_REMINDER = ("Reply naturally in short paragraphs, one idea per paragraph. Answer the latest ""point directly, with the observed result first. No mandatory report headings or "diff --git a/jarvis/society/surface.py b/jarvis/society/surface.pyindex d29471c5c4..edc46fa777 100644--- a/jarvis/society/surface.py+++ b/jarvis/society/surface.py@@ -26,7 +26,7 @@ from pathlib import Pathfrom typing import Any, Final, castfrom jarvis.core.protocols import Tool-from jarvis.core.response_style import CONVERSATIONAL_RESPONSE_STYLE+from jarvis.core.response_style import CONVERSATIONAL_RESPONSE_STYLE, KEEP_GOING_ON_TOOL_FAILUREfrom .agent_tools import (MemoryRecallTool,@@ -622,9 +622,11 @@ def build_briefing(else "You do not assign work; ask Jarvis or an orchestrator."))- # API and CLI seats both consume this briefing. Put reply guidance before- # potentially long standing instructions so compact CLI identities retain it.+ # API and CLI seats both consume this briefing. Put reply guidance and the+ # keep-going rule before potentially long standing instructions so compact+ # CLI identities retain them (a cancelled tool must not end the task).parts.append("## How to reply to the person\n" + CONVERSATIONAL_RESPONSE_STYLE)+ parts.append("## When a tool fails\n" + KEEP_GOING_ON_TOOL_FAILURE)if agent.description.strip():parts.append("## Standing instructions\n" + agent.description.strip())diff --git a/tests/unit/agent_chat/test_agent_chat_core.py b/tests/unit/agent_chat/test_agent_chat_core.pyindex 3a808caac7..6b5bb8e8c5 100644--- a/tests/unit/agent_chat/test_agent_chat_core.py+++ b/tests/unit/agent_chat/test_agent_chat_core.py@@ -15,6 +15,8 @@ from jarvis.agent_chat.runner_api import messages_from_eventsfrom jarvis.agent_chat.runner_cli import (_ClaudeState,_CodexState,+ _content_text,+ _tool_abort_is_recoverable,translate_claude_line,translate_codex_line,)@@ -287,6 +289,53 @@ def test_claude_stream_translation_streams_then_finalizes():assert st.cost_usd == 0.01 and st.usage == {"output_tokens": 5} and st.status == "done"+def test_grok_cancelled_tool_payload_is_readable_and_recoverable() -> None:+ """Print-mode Grok wraps a cancelled tool as nested ``content`` blocks.++ The chat used to show raw JSON and then mark the whole turn Failed, so+ the model never got a second round (live Bot ersteller, 2026-09-17).+ """+ nested = [+ {+ "type": "content",+ "content": {+ "type": "text",+ "text": "User cancelled the execution of tool 'run_terminal_command'",+ },+ }+ ]+ text = _content_text(nested)+ assert "User cancelled the execution of tool" in text+ assert _tool_abort_is_recoverable(text)+ assert not _tool_abort_is_recoverable("exited with code 3")+ assert not _tool_abort_is_recoverable(None)++ st = _ClaudeState(turn_id="t")+ events = translate_claude_line(+ {+ "type": "user",+ "message": {+ "content": [+ {+ "type": "tool_result",+ "tool_use_id": "tu1",+ "is_error": True,+ "content": nested,+ }+ ]+ },+ },+ st,+ )+ assert events[0]["payload"]["is_error"]+ assert "User cancelled" in events[0]["payload"]["output"]+ assert st.last_tool_error is not None and "User cancelled" in st.last_tool_error++ translate_claude_line({"type": "result", "subtype": "error", "is_error": True}, st)+ assert st.status == "error"+ assert st.error is not None and _tool_abort_is_recoverable(st.error)++def test_streamed_text_counts_as_an_answer_so_the_result_line_never_repeats_it():"""A turn cut short must not print its answer a second time.@@ -555,7 +604,10 @@ def test_an_old_cli_seated_jarvis_chat_moves_to_its_api_twin(tmp_path):moved = store.get_session(codex.session_id)assert (moved.provider, moved.model) == ("openai", "")- assert (store.get_session(shared.session_id).provider, store.get_session(shared.session_id).model) == (+ assert (+ store.get_session(shared.session_id).provider,+ store.get_session(shared.session_id).model,+ ) == ("openai","gpt-5.5",)diff --git a/tests/unit/agent_chat/test_ide_cli_seats.py b/tests/unit/agent_chat/test_ide_cli_seats.pyindex 31630fb88b..aac92f4487 100644--- a/tests/unit/agent_chat/test_ide_cli_seats.py+++ b/tests/unit/agent_chat/test_ide_cli_seats.py@@ -705,3 +705,140 @@ def test_a_cli_that_dies_silently_reports_its_exit_code(assert _kinds(events) == ["turn_finished"]finished = events[-1]["payload"]assert finished["status"] == "error" and "exited with code 3" in finished["error"]+++_GROK_CANCELLED_TOOL = {+ "type": "assistant",+ "message": {+ "id": "m1",+ "content": [+ {+ "type": "tool_use",+ "id": "tu1",+ "name": "run_terminal_command",+ "input": {"command": "echo hi", "description": "Extract connection status"},+ }+ ],+ },+ "session_id": "sess-recover",+}+_GROK_CANCELLED_RESULT = {+ "type": "user",+ "message": {+ "content": [+ {+ "type": "tool_result",+ "tool_use_id": "tu1",+ "is_error": True,+ "content": [+ {+ "type": "content",+ "content": {+ "type": "text",+ "text": "User cancelled the execution of tool 'run_terminal_command'",+ },+ }+ ],+ }+ ]+ },+}+_GROK_CANCELLED_END = {+ "type": "result",+ "subtype": "error",+ "is_error": True,+ "session_id": "sess-recover",+ "usage": {"input_tokens": 10, "output_tokens": 4},+ "total_cost_usd": 0.01,+}+_GROK_RECOVERED_TEXT = {+ "type": "assistant",+ "message": {+ "id": "m2",+ "content": [{"type": "text", "text": "X is connected; GitHub still needs a login."}],+ },+ "session_id": "sess-recover",+}+_GROK_RECOVERED_END = {+ "type": "result",+ "subtype": "success",+ "is_error": False,+ "result": "X is connected; GitHub still needs a login.",+ "session_id": "sess-recover",+ "usage": {"input_tokens": 12, "output_tokens": 8},+ "total_cost_usd": 0.02,+}+++def test_a_cancelled_tool_resumes_instead_of_failing_the_turn(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ """Print-mode Grok used to abort the whole chat after one cancelled tool."""+ fail = rc.CliPlan(+ _fake_cli([_GROK_CANCELLED_TOOL, _GROK_CANCELLED_RESULT, _GROK_CANCELLED_END]),+ dict(os.environ),+ None,+ "claude",+ "sess-recover",+ )+ ok = rc.CliPlan(+ _fake_cli([_GROK_RECOVERED_TEXT, _GROK_RECOVERED_END]),+ dict(os.environ),+ None,+ "claude",+ "sess-recover",+ )+ prompts: list[str] = []+ resumes: list[str | None] = []++ def planner(**kwargs: object) -> rc.CliPlan:+ prompts.append(str(kwargs["prompt"]))+ raw = kwargs.get("resume")+ resumes.append(raw if isinstance(raw, str) or raw is None else None)+ return fail if len(prompts) == 1 else ok++ monkeypatch.setitem(rc._PLANNERS, "grok-cli", planner)+ events: list[dict] = []++ async def emit(ev: dict) -> None:+ events.append(ev)++ async def ask(*_: object) -> str:+ return "deny"++ session = AgentChatSession(+ session_id="s1",+ title="",+ provider="grok-build",+ model="",+ effort="",+ cwd=str(tmp_path),+ permission_mode="",+ vendor_session=None,+ created_ms=0,+ updated_ms=0,+ message_count=0,+ preview="",+ )+ handle = TurnHandle(+ session=session, turn_id="t1", emit=emit, request_approval=ask, cancel=asyncio.Event()+ )+ vendor = asyncio.run(rc.run_cli_turn(handle, "Which accounts are connected?", "grok-cli"))+ assert vendor == "sess-recover"+ assert len(prompts) == 2+ assert "Which accounts are connected?" in prompts[0]+ assert "User cancelled the execution" in prompts[1]+ assert "keep going" in prompts[1].lower() or "not the end of the task" in prompts[1]+ assert resumes[1] == "sess-recover"+ assert _kinds(events) == [+ "tool_call",+ "tool_result",+ "assistant_text",+ "turn_finished",+ ]+ assert events[1]["payload"]["is_error"]+ assert "X is connected" in events[2]["payload"]["text"]+ finished = events[-1]["payload"]+ assert finished["status"] == "done" and finished["error"] is None+ assert finished["usage"]["input_tokens"] == 22+ assert finished["cost_usd"] == pytest.approx(0.03)diff --git a/tests/unit/agent_chat/test_jarvis_identity.py b/tests/unit/agent_chat/test_jarvis_identity.pyindex 3f7455189e..2d028b3c49 100644--- a/tests/unit/agent_chat/test_jarvis_identity.py+++ b/tests/unit/agent_chat/test_jarvis_identity.py@@ -16,6 +16,7 @@ import pytestfrom jarvis.agent_chat import jarvis_harness, runner_clifrom jarvis.agent_chat.events import make_eventfrom jarvis.core import runtime_refs+from jarvis.core.response_style import KEEP_GOING_ON_TOOL_FAILUREfrom jarvis.mcp import jarvis_tools_server as serverfrom jarvis.ui.web import mcp_server_routes@@ -191,6 +192,8 @@ def test_grok_takes_the_compact_identity_on_argv(monkeypatch, tmp_path: Path):assert prompt.startswith("<jarvis_identity>\nSHORT IDENTITY") and prompt.endswith("hi")assert "--always-approve" in plan.argvassert "--permission-mode" not in plan.argv+ assert "--rules" in plan.argv+ assert plan.argv[plan.argv.index("--rules") + 1] == KEEP_GOING_ON_TOOL_FAILUREdef test_grok_plan_mode_does_not_auto_approve(monkeypatch, tmp_path: Path):@@ -206,6 +209,7 @@ def test_grok_plan_mode_does_not_auto_approve(monkeypatch, tmp_path: Path):)assert plan.argv[plan.argv.index("--permission-mode") + 1] == "plan"assert "--always-approve" not in plan.argv+ assert plan.argv[plan.argv.index("--rules") + 1] == KEEP_GOING_ON_TOOL_FAILUREdef test_grok_with_identity_writes_a_project_mcp_config(monkeypatch, tmp_path: Path):diff --git a/tests/unit/society/test_reply_style.py b/tests/unit/society/test_reply_style.pyindex 142219d94d..a7e059312d 100644--- a/tests/unit/society/test_reply_style.py+++ b/tests/unit/society/test_reply_style.py@@ -5,6 +5,7 @@ from jarvis.agent_chat.runner_cli import _with_identityfrom jarvis.core.response_style import (CONVERSATIONAL_RESPONSE_STYLE,CONVERSATIONAL_TURN_REMINDER,+ KEEP_GOING_ON_TOOL_FAILURE,)from jarvis.society.roster import AgentRecordfrom jarvis.society.surface import build_briefing@@ -25,6 +26,7 @@ def _briefing(extra: str = "") -> str:def test_agent_briefing_includes_reply_style_without_replacing_its_instructions() -> None:briefing = _briefing()assert CONVERSATIONAL_RESPONSE_STYLE in briefing+ assert KEEP_GOING_ON_TOOL_FAILURE in briefingassert "Ask before publishing anything." in briefingassert "You are Research assistant" in briefingassert "end with a handoff" not in briefing@@ -43,6 +45,7 @@ async def test_cli_identity_carries_the_same_reply_policy_on_fresh_and_resumed_tdelivered = _with_identity("Explain the result.", seat, resume)expected = CONVERSATIONAL_TURN_REMINDER if resume else CONVERSATIONAL_RESPONSE_STYLEassert expected in delivered+ assert KEEP_GOING_ON_TOOL_FAILURE in deliveredassert delivered.endswith("Explain the result.")@@ -56,3 +59,4 @@ async def test_reply_policy_survives_long_instructions_in_a_compact_cli_identitycompact = compact_identity(identity)assert len(compact) < len(identity)assert CONVERSATIONAL_RESPONSE_STYLE in compact+ assert KEEP_GOING_ON_TOOL_FAILURE in compactdiff --git a/tests/unit/society/test_surface.py b/tests/unit/society/test_surface.pyindex 580ad855ee..babb231fe6 100644--- a/tests/unit/society/test_surface.py+++ b/tests/unit/society/test_surface.py@@ -7,6 +7,7 @@ from types import SimpleNamespaceimport pytest+from jarvis.core.response_style import KEEP_GOING_ON_TOOL_FAILUREfrom jarvis.society import runtime as runtime_modfrom jarvis.society.agent_tools import (MEMORY_RECALL_TOOL_NAME,@@ -156,9 +157,14 @@ async def test_briefing_is_deterministic_and_complete(rt: SocietyRuntime):assert "## Standing instructions" in a and "external mail only after approval" in aassert "Reach for these first:\n- gmail (plugin:gmail): Read and send mail." in aassert "Also available" in a- assert all(name in a for name in ("browser", "coding-session", "search-web", "wiki-ingest", "wiki-recall"))+ assert all(+ name in a+ for name in ("browser", "coding-session", "search-web", "wiki-ingest", "wiki-recall")+ )assert "spawn-worker" not in aassert f"Capability epoch: {capability_epoch(catalog)}" in a+ assert "## When a tool fails" in a and KEEP_GOING_ON_TOOL_FAILURE in a+ assert a.index("## When a tool fails") < a.index("## Standing instructions")assert "## The Jarvis ecosystem" in a and "society_message_agent" in aassert "## Teammates\n- Jarvis — Lead (lead)\n- Scout — Research scout (orchestrator)" in aassert "Mailbox" not in a.split("## Teammates")[1]