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
test(society): pin that template import never downgrades its approval mode (#938)
Ruben Lütke73d6d9cbdf7e
diff --git a/docs/marketplace/agent-templates.md b/docs/marketplace/agent-templates.mdindex 64f08e6032..aa16576340 100644--- a/docs/marketplace/agent-templates.md+++ b/docs/marketplace/agent-templates.md@@ -136,10 +136,12 @@ install-by-name) adds:- the model is the installer's own (the create route inherits their lastchat seat); nothing of the publisher's accounts travels;-- `approval_mode = ask` wherever the resolved runner can hold an approval- prompt, so a stranger's agent asks before it acts until the person changes- that; runners that cannot fall back to the app's default;-- `always_allow` is always empty; `require_approval` only adds prompts;+- the approval mode is the app's normal creation default (Bypass), the same+ as for an agent the person creates by hand; a template never carries a mode+ of its own. If the chosen runner refuses that mode, the install fails with+ the runner's error and is never retried in a different mode;+- `always_allow` is always empty; `require_approval` only adds prompts, and+ those prompts bind in every mode, Bypass included;- budget, concurrency, ceiling and browser settings are the app's defaults.The marketplace card shows, before the Install button: the instructions indiff --git a/tests/unit/society/test_template_approval_defaults.py b/tests/unit/society/test_template_approval_defaults.pyindex 500dec739a..45527718bc 100644--- a/tests/unit/society/test_template_approval_defaults.py+++ b/tests/unit/society/test_template_approval_defaults.py@@ -35,3 +35,58 @@ def test_import_uses_bypass_and_preserves_explicit_rules(tmp_path: Path, wrappedassert agent["denies"] == ["core:shell"]saved = client.get(f"/api/society/agents/{agent['agent_id']}").json()["agent"]assert saved["approval_mode"] == "bypass"+++def test_imported_require_approval_still_queues_under_bypass(tmp_path: Path):+ """#387: the publisher's confirmations bind even though the mode is bypass."""+ from dodaios.society.approvals import Verdict, decide++ runtime = SocietyRuntime(tmp_path, seed_starter_team=False)+ app = FastAPI()+ app.include_router(router)+ app.state.society_factory = lambda: runtime+ template = {+ "schema": 1,+ "name": "Mail helper",+ "instructions": "Draft replies.",+ "require_approval": ["plugin:gmail:send"],+ }+ with TestClient(app) as client:+ imported = client.post("/api/society/templates/install", json={"template": template})+ assert imported.status_code == 200, imported.text+ agent_id = imported.json()["agent"]["agent_id"]+ agent = client.portal.call(runtime.roster.resolve, agent_id)+ assert agent is not None and str(agent.approval_mode) == "bypass"+ for tier in ("safe", "ask"):+ assert decide(agent, "plugin:gmail", tier, verb="send") is Verdict.QUEUE+ assert decide(agent, "plugin:gmail", "ask", verb="read") is Verdict.RUN+++def test_unsupported_runner_refusal_is_not_retried_with_another_mode(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+):+ """#387: a runner refusal surfaces; the install never retries in another mode."""+ import dodaios.agent_chat.permissions as permissions+ import dodaios.agent_chat.service as service++ seen: list[str] = []++ def refuse(_runner: str, mode: str) -> bool:+ seen.append(mode)+ return False++ monkeypatch.setattr(service, "resolve_runner", lambda *_a, **_k: "fake-runner")+ monkeypatch.setattr(permissions, "society_mode_supported", refuse)+ runtime = SocietyRuntime(tmp_path, seed_starter_team=False)+ app = FastAPI()+ app.include_router(router)+ app.state.society_factory = lambda: runtime+ template = {"schema": 1, "name": "Refused helper", "instructions": "Help."}+ with TestClient(app) as client:+ refused = client.post(+ "/api/society/starters/install",+ json={"template": template, "seat": {"provider": "fake-provider"}},+ )+ assert refused.status_code == 422, refused.text+ assert client.portal.call(runtime.roster.resolve, "Refused helper") is None+ assert seen == ["bypass"]