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(core): document intentional exception fallbacks

Ruben Lütke5790a120e3d4
diff --git a/jarvis/agentic_ide/prompt_history.py b/jarvis/agentic_ide/prompt_history.py
index 058637ab0d..8d407a9c8f 100644
--- a/jarvis/agentic_ide/prompt_history.py
+++ b/jarvis/agentic_ide/prompt_history.py
@@ -47,6 +47,7 @@ class PromptHistoryEntry:
sequence = int(value.get("sequence") or 0)
at = float(value.get("at") or 0.0)
except (TypeError, ValueError):
+ # Invalid persisted numeric metadata makes only this row unusable.
return None
submitted = value.get("submitted")
if submitted not in (True, False, None):
@@ -96,6 +97,7 @@ def load(history_id: str) -> list[PromptHistoryEntry]:
try:
parsed = PromptHistoryEntry.from_dict(json.loads(line))
except (json.JSONDecodeError, UnicodeDecodeError):
+ # A damaged row is counted and reported after the scan.
parsed = None
if parsed is None:
damaged += 1
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 6bdb4a6106..c3bb4c8a33 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -3758,6 +3758,7 @@ def _coerce_env_value(v: str) -> Any:
try:
parsed = json.loads(v)
except (TypeError, ValueError):
+ # Invalid JSON-shaped input intentionally falls through to scalar coercion.
pass
else:
if isinstance(parsed, (dict, list)):
diff --git a/jarvis/core/self_mod/writer.py b/jarvis/core/self_mod/writer.py
index bce678be50..202e5c730d 100644
--- a/jarvis/core/self_mod/writer.py
+++ b/jarvis/core/self_mod/writer.py
@@ -225,7 +225,11 @@ class AtomicConfigWriter:
for path in root.glob(BACKUP_FILE_GLOB):
try:
stat = path.stat()
- except OSError:
+ except FileNotFoundError:
+ # Concurrent backup GC may remove the entry after globbing it.
+ continue
+ except OSError as exc:
+ _LOG.warning("Could not inspect self-mod backup %s: %s", path, exc)
continue
# The new, out-of-watchdog location wins if an old backup has
# the same generated filename. Legacy directories are read-only
@@ -272,6 +276,7 @@ class AtomicConfigWriter:
try:
candidate.relative_to(root.resolve())
except ValueError:
+ # The resolved candidate escapes this allowed backup root.
continue
if candidate.is_file():
self._restore(candidate)
@@ -503,6 +508,7 @@ class AtomicConfigWriter:
os.replace(tmp_path, target)
return
except PermissionError as exc:
+ # Retry transient sharing violations; the last failure is raised below.
last_error = exc
if last_error is not None:
raise last_error
diff --git a/jarvis/ultrawiki/answer.py b/jarvis/ultrawiki/answer.py
index e692f81d98..fd6098ee22 100644
--- a/jarvis/ultrawiki/answer.py
+++ b/jarvis/ultrawiki/answer.py
@@ -227,6 +227,7 @@ async def answer_question(
try:
_parse_provider_answer(text, len(evidence))
except ValueError as exc:
+ # The validation diagnostic tells the fallback chain to try another provider.
return str(exc)
return None
diff --git a/jarvis/ultrawiki/connectors/local_folder.py b/jarvis/ultrawiki/connectors/local_folder.py
index 7252520a4a..61ae7d12e3 100644
--- a/jarvis/ultrawiki/connectors/local_folder.py
+++ b/jarvis/ultrawiki/connectors/local_folder.py
@@ -206,6 +206,7 @@ def _is_linked_git_worktree(path: Path) -> bool:
try:
return (path / ".git").is_file()
except OSError:
+ # An unreadable marker cannot prove that this is a linked worktree.
return False
diff --git a/jarvis/ultrawiki/service.py b/jarvis/ultrawiki/service.py
index d64ac394dc..df249a8edf 100644
--- a/jarvis/ultrawiki/service.py
+++ b/jarvis/ultrawiki/service.py
@@ -172,6 +172,7 @@ def _seconds_since(value: Any, now: datetime) -> float | None:
try:
parsed = datetime.fromisoformat(text.replace("Z", "+00:00"))
except ValueError:
+ # An unusable persisted timestamp is treated as never synchronized.
return None
if parsed.tzinfo is None:
parsed = parsed.replace(tzinfo=UTC)
@@ -181,7 +182,8 @@ def _seconds_since(value: Any, now: datetime) -> float | None:
def _is_due(value: Any, interval_s: Any, now: datetime) -> bool:
try:
interval = float(interval_s)
- except (TypeError, ValueError):
+ except (TypeError, ValueError) as exc:
+ log.warning("UltraWiki ignored invalid synchronization interval %r: %s", interval_s, exc)
return False
if interval <= 0:
return False
@@ -552,6 +554,7 @@ class UltraWikiService:
try:
await asyncio.wait_for(cancel_event.wait(), timeout=max(0.0, grace_s))
except TimeoutError:
+ # The timeout is the expected signal that the startup grace elapsed.
pass
if cancel_event.is_set():
return
@@ -567,6 +570,7 @@ class UltraWikiService:
cancel_event.wait(), timeout=FRESHNESS_TICK_S
)
except TimeoutError:
+ # The timeout is the expected signal for the next scheduler tick.
pass
async def _sync_due_sources(
@@ -699,8 +703,11 @@ class UltraWikiService:
freshness_task.cancel()
try:
await asyncio.wait_for(freshness_task, timeout=2.0)
- except (TimeoutError, asyncio.CancelledError):
+ except asyncio.CancelledError:
+ # Cancellation is the expected completion path during shutdown.
pass
+ except TimeoutError:
+ log.warning("UltraWiki freshness task did not stop within 2 seconds")
except Exception as exc: # noqa: BLE001 — shutdown best-effort
log.warning("UltraWiki freshness shutdown error: %s", exc)
self._freshness_task = None