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(tools): call-contact reads real Twilio config; in-app feedback points downloaders at GitHub issues
Ruben Lütkeef4f88f7d926
diff --git a/jarvis/plugins/tool/call_contact.py b/jarvis/plugins/tool/call_contact.pyindex bfc6159e89..9ffbd7ada8 100644--- a/jarvis/plugins/tool/call_contact.py+++ b/jarvis/plugins/tool/call_contact.py@@ -71,20 +71,30 @@ def _default_call_config() -> dict[str, str] | None:Returns a dict with ``account_sid``/``auth_token``/``from_number``/``public_base_url`` when fully configured, else ``None``. Fully defensive:any missing piece or import error yields ``None`` so the tool degrades to a- clean "configure the Telephony section" message. The token is read via- ``get_secret`` only (never from jarvis.toml — AP-2/AP-12).+ clean "configure the Telephony section" message.++ ``JarvisConfig`` has no top-level ``telephony`` field — Twilio lives at+ ``integrations.twilio`` (``config.py`` ``IntegrationsConfig``), and its+ field is ``phone_number``, not ``from_number`` (``config.py``+ ``TwilioConfig``). This mirrors exactly what the working+ ``/api/telephony`` routes read (``telephony_routes.py`` ``_twilio_cfg`` /+ ``_config_payload``). The token is read via ``get_secret`` only (never+ from jarvis.toml — AP-2/AP-12), under the real credential-manager key+ ``twilio_auth_token`` (see ``TwilioConfig`` docstring ++ ``telephony_routes.py`` ``_AUTH_TOKEN_KEY``) — not the ENV var name."""try:from jarvis.core import config as cfgloaded = cfg.load_config()- tcfg = getattr(loaded, "telephony", None)+ integrations = getattr(loaded, "integrations", None)+ tcfg = getattr(integrations, "twilio", None)if tcfg is None:return Noneaccount_sid = getattr(tcfg, "account_sid", None)- from_number = getattr(tcfg, "from_number", None)+ from_number = getattr(tcfg, "phone_number", None)public_base_url = getattr(tcfg, "public_base_url", None)- auth_token = cfg.get_secret("TWILIO_AUTH_TOKEN", env_fallback="TWILIO_AUTH_TOKEN")+ auth_token = cfg.get_secret("twilio_auth_token", env_fallback="TWILIO_AUTH_TOKEN")if not (account_sid and auth_token and from_number and public_base_url):return Nonereturn {diff --git a/jarvis/ui/web/feedback_routes.py b/jarvis/ui/web/feedback_routes.pyindex 3ddec8a46e..a60d0453d7 100644--- a/jarvis/ui/web/feedback_routes.py+++ b/jarvis/ui/web/feedback_routes.py@@ -16,10 +16,17 @@ Outcomes (``status`` field):``"unreachable"`` — network / timeout error reaching Discord.The webhook URL is read exclusively via the secret store / ENV; it is never-hardcoded in source. Configure it via:+hardcoded in source. It is an OPERATOR-only credential (the project+maintainer's own Discord server), never something an end user can configure:Credential Manager key : discord_feedback_webhook_urlENV fallback : DISCORD_FEEDBACK_WEBHOOK_URL++When it is not configured — the default on every fresh install — the endpoint+degrades honestly toward the END USER instead of telling them to set an+operator credential: the response's ``detail`` and ``github_url`` fields point+at the project's public GitHub issues page so they still have somewhere to+report the bug."""from __future__ import annotations@@ -58,6 +65,11 @@ _SCREENSHOT_DECODED_MAX_BYTES = 8 * 1024 * 1024_SECRET_KEY = "discord_feedback_webhook_url"_ENV_KEY = "DISCORD_FEEDBACK_WEBHOOK_URL"+# Public fallback for every downloader when the operator-only Discord webhook+# is not configured (the default — that credential belongs to the project+# maintainer, not to the end user running this install).+_GITHUB_ISSUES_URL = "https://github.com/PersonalJarvis/PersonalJarvis/issues"+# ----------------------------------------------------------------------# Request / response models@@ -76,6 +88,9 @@ class FeedbackResult(BaseModel):ok: boolstatus: Literal["sent", "not_configured", "discord_error", "unreachable"]detail: str+ # Populated only for status == "not_configured": a public URL the frontend+ # can render as a "report it on GitHub" link/fallback. ``None`` otherwise.+ github_url: str | None = None# ----------------------------------------------------------------------@@ -130,14 +145,19 @@ async def submit_feedback(body: FeedbackPayload) -> FeedbackResult:"""webhook_url = get_secret(_SECRET_KEY, env_fallback=_ENV_KEY)if not webhook_url:+ # No operator webhook on this install (the common case for every+ # downloader — that credential is the project maintainer's own, never+ # something an end user can meaningfully set). Degrade honestly:+ # point them at the public GitHub issues page instead of a message+ # that tells them to configure a credential they have no use for.return FeedbackResult(ok=False,status="not_configured",detail=(- "No Discord webhook URL is configured. "- f"Set the credential '{_SECRET_KEY}' or "- f"the environment variable {_ENV_KEY}."+ "This server has no feedback channel configured. "+ f"Please report this directly on GitHub: {_GITHUB_ISSUES_URL}"),+ github_url=_GITHUB_ISSUES_URL,)# Gather server-side context so the client does not have to send it.diff --git a/jarvis/ui/web/frontend/src/views/feedback/api.ts b/jarvis/ui/web/frontend/src/views/feedback/api.tsindex cf50d564da..47f0efd619 100644--- a/jarvis/ui/web/frontend/src/views/feedback/api.ts+++ b/jarvis/ui/web/frontend/src/views/feedback/api.ts@@ -18,6 +18,9 @@ export interface FeedbackResult {ok: boolean;status: FeedbackStatus;detail: string;+ // Populated only for status === "not_configured": a public GitHub issues+ // URL the caller can render as a "report it on GitHub" fallback.+ github_url?: string | null;}const BASE = "/api/feedback";diff --git a/tests/unit/plugins/tool/test_call_contact.py b/tests/unit/plugins/tool/test_call_contact.pyindex caccfebe3d..3f4ee0b23f 100644--- a/tests/unit/plugins/tool/test_call_contact.py+++ b/tests/unit/plugins/tool/test_call_contact.py@@ -233,3 +233,91 @@ async def test_engine_absent_degrades_gracefully(monkeypatch) -> None:result = await tool.execute({"name": "Christoph"}, None)assert result.success is Falseassert "telephony" in (result.error or "").lower()+++# --------------------------------------------------------------------------- #+# ``_default_call_config`` — real config-shape resolution (finding 11)+#+# ``JarvisConfig`` has no top-level ``telephony`` field; Twilio lives under+# ``integrations.twilio`` (config.py:~1398) and its field is ``phone_number``,+# not ``from_number`` (config.py:~1350). Before the fix, ``_default_call_config``+# always returned ``None`` even when Twilio was fully configured, so the "call+# X" voice tool silently no-opped for every install.+# --------------------------------------------------------------------------- #+@dataclass+class _FakeTwilioCfg:+ account_sid: str = "AC_real_test"+ phone_number: str = "+4930000001"+ public_base_url: str = "https://real.example.test"+ enabled: bool = True+++@dataclass+class _FakeIntegrationsCfg:+ twilio: _FakeTwilioCfg = field(default_factory=_FakeTwilioCfg)+++@dataclass+class _FakeJarvisConfig:+ integrations: _FakeIntegrationsCfg = field(default_factory=_FakeIntegrationsCfg)+++def test_default_call_config_resolves_when_twilio_is_configured(monkeypatch) -> None:+ """A fake config shaped like the real ``JarvisConfig`` (Twilio under+ ``integrations.twilio``, field ``phone_number``) must resolve a full call+ config — no longer a false "not set up"."""+ import jarvis.core.config as real_cfg++ fake_config = _FakeJarvisConfig()+ monkeypatch.setattr(real_cfg, "load_config", lambda: fake_config)+ monkeypatch.setattr(+ real_cfg,+ "get_secret",+ lambda key, env_fallback=None: "tok_real_secret" if key == "twilio_auth_token" else None,+ )++ result = call_contact_mod._default_call_config()++ assert result == {+ "account_sid": "AC_real_test",+ "auth_token": "tok_real_secret",+ "from_number": "+4930000001",+ "public_base_url": "https://real.example.test",+ }+++def test_default_call_config_reads_secret_via_the_real_credential_key(monkeypatch) -> None:+ """The Twilio auth token is stored under the ``twilio_auth_token`` credential+ key (see config.py TwilioConfig docstring + telephony_routes.py+ ``_AUTH_TOKEN_KEY``), not under the ENV var name. Resolution must use that+ real key so a token saved via the Telephony UI/wizard is actually found."""+ import jarvis.core.config as real_cfg++ fake_config = _FakeJarvisConfig()+ monkeypatch.setattr(real_cfg, "load_config", lambda: fake_config)++ def _fake_get_secret(key: str, env_fallback: str | None = None) -> str | None:+ # Only the real credential-manager key resolves a value; anything else+ # (e.g. the old, wrong "TWILIO_AUTH_TOKEN" key) must miss.+ return "tok_via_keyring" if key == "twilio_auth_token" else None++ monkeypatch.setattr(real_cfg, "get_secret", _fake_get_secret)++ result = call_contact_mod._default_call_config()++ assert result is not None+ assert result["auth_token"] == "tok_via_keyring"+++def test_default_call_config_returns_none_when_twilio_genuinely_unconfigured(monkeypatch) -> None:+ """A real config shape with Twilio present but not filled in (no phone+ number, no secret) must still degrade to ``None`` — the honest no-op case+ is preserved, not just "any config object is truthy"."""+ import jarvis.core.config as real_cfg++ fake_config = _FakeJarvisConfig()+ fake_config.integrations.twilio.phone_number = ""+ monkeypatch.setattr(real_cfg, "load_config", lambda: fake_config)+ monkeypatch.setattr(real_cfg, "get_secret", lambda key, env_fallback=None: None)++ assert call_contact_mod._default_call_config() is Nonediff --git a/tests/unit/ui/web/test_feedback_routes.py b/tests/unit/ui/web/test_feedback_routes.pynew file mode 100644index 0000000000..f8500559c2--- /dev/null+++ b/tests/unit/ui/web/test_feedback_routes.py@@ -0,0 +1,77 @@+"""Tests for the in-app feedback REST endpoint (finding 13, AP-23 wave 2).++Contract (see jarvis/ui/web/feedback_routes.py):+- POST /api/feedback -> {"ok": bool, "status": str, "detail": str, "github_url": str|None}++When no Discord webhook is configured (the common case for every downloader —+``discord_feedback_webhook_url`` is a maintainer-only operator credential that+was never shipped), the endpoint must degrade HONESTLY: point the end user at+the project's public GitHub issues page instead of instructing them to+configure a credential that is meaningless for them.+"""+from __future__ import annotations++import pytest+from fastapi import FastAPI+from fastapi.testclient import TestClient++GITHUB_ISSUES_URL = "https://github.com/PersonalJarvis/PersonalJarvis/issues"+++def _client() -> TestClient:+ from jarvis.ui.web.feedback_routes import router++ app = FastAPI()+ app.include_router(router)+ return TestClient(app)+++def client() -> TestClient:+ return _client()+++def _payload(**overrides: object) -> dict:+ body = {+ "type": "bug",+ "title": "Something broke",+ "description": "It broke when I clicked the button.",+ }+ body.update(overrides)+ return body+++def test_no_webhook_configured_points_to_github_issues(client: TestClient, monkeypatch) -> None:+ """No webhook configured -> honest downloader-facing fallback: a GitHub+ issues URL, not an instruction to set an operator-only credential."""+ import jarvis.ui.web.feedback_routes as feedback_routes++ monkeypatch.setattr(feedback_routes, "get_secret", lambda *a, **k: None)++ resp = client.post("/api/feedback", json=_payload())++ assert resp.status_code == 200+ body = resp.json()+ assert body["ok"] is False+ # The response must carry a URL the frontend can render as "report it on+ # GitHub" rather than dead-ending the user.+ assert body.get("github_url") == GITHUB_ISSUES_URL+ assert GITHUB_ISSUES_URL in body["detail"]+++def test_no_webhook_configured_does_not_instruct_setting_a_credential(+ client: TestClient, monkeypatch+) -> None:+ """The old behavior told the END USER to set a Discord webhook credential+ ('discord_feedback_webhook_url') — meaningless for a downloader who is not+ the project operator. That misdirection must be gone."""+ import jarvis.ui.web.feedback_routes as feedback_routes++ monkeypatch.setattr(feedback_routes, "get_secret", lambda *a, **k: None)++ resp = client.post("/api/feedback", json=_payload())++ detail_lower = resp.json()["detail"].lower()+ assert "discord_feedback_webhook_url" not in detail_lower+ assert "environment variable" not in detail_lower+ assert "credential" not in detail_lower