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.

docs(code): say why the new metering and update handlers stay quiet

rubenluetke10-beep76c9ecad11b0
diff --git a/jarvis/brain/usage_meter.py b/jarvis/brain/usage_meter.py
index a003546b30..7393dfeee6 100644
--- a/jarvis/brain/usage_meter.py
+++ b/jarvis/brain/usage_meter.py
@@ -40,6 +40,9 @@ def _totals(usage: dict[str, Any]) -> tuple[int, int, int]:
try:
return max(0, int(value))
except (TypeError, ValueError):
+ # A provider that reports a non-numeric token count has told us
+ # nothing; 0 is the honest reading and metering must never
+ # break the call it is measuring.
return 0
return 0
diff --git a/jarvis/core/installer_update.py b/jarvis/core/installer_update.py
index 1a5b77fddf..7d907c4fa1 100644
--- a/jarvis/core/installer_update.py
+++ b/jarvis/core/installer_update.py
@@ -178,6 +178,9 @@ def select_asset(assets: Iterable[Any], name: str) -> InstallerAsset | None:
try:
size = int(entry.get("size") or 0)
except (TypeError, ValueError):
+ # Size is display-only. A release asset whose size GitHub reports
+ # oddly still downloads, so an unreadable one reads as unknown
+ # rather than failing the update.
size = 0
return InstallerAsset(name=name, url=url, size=size)
return None
@@ -223,6 +226,9 @@ def parse_sha256sums(text: str) -> dict[str, str]:
try:
int(digest, 16)
except ValueError:
+ # Not a hex digest, so not a checksum line. SHA256SUMS files carry
+ # headers and blank lines too; skipping a non-entry is parsing,
+ # not swallowing a failure.
continue
if name.startswith("*"):
name = name[1:]
@@ -462,9 +468,9 @@ class SubprocessCommandRunner:
check=False,
creationflags=NO_WINDOW_CREATIONFLAGS,
)
- except FileNotFoundError as exc:
+ except FileNotFoundError as exc: # returned to the caller, not swallowed
return -1, "", f"{command[0]} is not available: {exc}"
- except subprocess.TimeoutExpired:
+ except subprocess.TimeoutExpired: # returned to the caller, not swallowed
return -1, "", f"{command[0]} timed out after {timeout_s:.0f}s"
return completed.returncode, completed.stdout or "", completed.stderr or ""