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.

fix(ultrawiki): heal generic bridge-source labels on store open

Ruben Lütkef410d63235b6
diff --git a/jarvis/ultrawiki/service.py b/jarvis/ultrawiki/service.py
index 3f4b0978ec..432b2dcb86 100644
--- a/jarvis/ultrawiki/service.py
+++ b/jarvis/ultrawiki/service.py
@@ -376,6 +376,7 @@ class UltraWikiService:
async with self._start_lock:
if self._store is None:
self._store = await self._open_store()
+ await self._heal_bridge_labels(self._store)
if self._uw_enabled() and self._pipeline_task is None:
from jarvis.ultrawiki.pipeline import ( # noqa: PLC0415 — lazy
PipelineWorker,
@@ -893,6 +894,44 @@ class UltraWikiService:
assert source is not None
return source
+ async def _heal_bridge_labels(self, store: Any) -> None:
+ """One-time self-heal: give pre-existing bridge sources their real name.
+
+ ``_resolve_label`` only runs at creation, so sources registered before
+ it existed keep the generic "Connected integration" label forever —
+ the maintainer connected GitHub and could not tell which card it was.
+ Runs once per store open (not per status poll: the candidate lookup
+ probes live registries); the healed label is PERSISTED, so a source is
+ only ever probed while its label is still generic. Best-effort by
+ design — naming is decoration and must never block startup.
+ """
+ try:
+ rows = await store.list_sources()
+ except Exception: # noqa: BLE001 — decoration, never a startup failure
+ log.debug("bridge label heal skipped: source listing failed", exc_info=True)
+ return
+ for row in rows:
+ connector_id = str(row.get("connector") or "")
+ if connector_id != _BRIDGE_CONNECTOR_ID:
+ continue
+ stored = str(row.get("label") or "")
+ config = row.get("config") or {}
+ resolved = self._resolve_label(connector_id, stored, config)
+ if resolved == stored:
+ continue
+ try:
+ await store.upsert_source(
+ str(row.get("id")), connector=connector_id, label=resolved
+ )
+ log.info(
+ "bridge source %s relabeled %r -> %r",
+ row.get("id"),
+ stored,
+ resolved,
+ )
+ except Exception: # noqa: BLE001
+ log.debug("bridge label heal failed for %s", row.get("id"), exc_info=True)
+
@staticmethod
def _resolve_label(
connector_id: str, label: str, config: dict[str, Any] | None
@@ -917,6 +956,9 @@ class UltraWikiService:
integration_id.lower(),
"connected integration",
"connected integrations",
+ # The exact label the pre-fix UI stored for every bridge source.
+ "connected integration (plugins / mcp)",
+ "connected integration (plugins/mcp)",
}
if chosen.lower() not in generic:
return chosen
diff --git a/tests/unit/ultrawiki/test_service.py b/tests/unit/ultrawiki/test_service.py
index 30394ab95c..1d8e546d53 100644
--- a/tests/unit/ultrawiki/test_service.py
+++ b/tests/unit/ultrawiki/test_service.py
@@ -830,3 +830,46 @@ async def test_the_notice_disappears_once_the_adapter_ships(service, monkeypatch
source_row = await service._require_store().get_source(source["id"])
assert source_row["last_notice"] is None
+
+
+async def test_generic_bridge_label_heals_on_start(tmp_path, monkeypatch):
+ """A pre-fix bridge source stored under the generic card name gains the
+ real integration label ("GitHub") on the next service start, persisted so
+ the live-registry lookup never runs again for it."""
+ from jarvis.ultrawiki.connectors import plugin_bridge
+
+ monkeypatch.setattr(
+ plugin_bridge,
+ "list_candidates",
+ lambda: [
+ {
+ "id": "plugin:github",
+ "kind": "plugin",
+ "label": "GitHub",
+ "detail": "connected",
+ }
+ ],
+ )
+ svc = UltraWikiService(make_cfg(tmp_path))
+ try:
+ await svc.ensure_started()
+ store = svc._require_store()
+ await store.upsert_source(
+ "plugin-bridge-legacy1",
+ connector="plugin-bridge",
+ label="Connected integration (plugins / MCP)",
+ config={"integration_id": "plugin:github"},
+ )
+ # Heal runs on store OPEN — restart the service to trigger it again.
+ await svc.shutdown()
+ svc2 = UltraWikiService(make_cfg(tmp_path))
+ try:
+ await svc2.ensure_started()
+ row = await svc2._require_store().get_source("plugin-bridge-legacy1")
+ assert row is not None
+ assert row["label"] == "GitHub"
+ assert row["config"]["integration_id"] == "plugin:github"
+ finally:
+ await svc2.shutdown()
+ finally:
+ await svc.shutdown()