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: say why each new quiet exception handler stays quiet

rubenluetke10-beepdc5779d1ddd7
diff --git a/jarvis/agent_chat/service.py b/jarvis/agent_chat/service.py
index 5f3bc633e3..88ca560bf5 100644
--- a/jarvis/agent_chat/service.py
+++ b/jarvis/agent_chat/service.py
@@ -87,7 +87,7 @@ def _app_loop() -> tuple[asyncio.AbstractEventLoop | None, bool]:
"""
try:
return asyncio.get_running_loop(), True
- except RuntimeError:
+ except RuntimeError: # no loop on this thread: fall through to the dispatching loop
pass
try:
from anyio.from_thread import run_sync
diff --git a/jarvis/agent_chat/turn_host.py b/jarvis/agent_chat/turn_host.py
index dad9a1739f..142876e9f4 100644
--- a/jarvis/agent_chat/turn_host.py
+++ b/jarvis/agent_chat/turn_host.py
@@ -483,6 +483,7 @@ class TurnHost:
try:
raw = await stream.readline()
except (ValueError, asyncio.LimitOverrunError):
+ # an over-long stderr line is dropped; readline already cleared it
continue
if not raw:
return
@@ -523,7 +524,7 @@ def _line_type(text: str) -> str:
return ""
try:
obj = json.loads(text)
- except ValueError:
+ except ValueError: # a non-JSON line simply has no type
return ""
return str(obj.get("type") or "") if isinstance(obj, dict) else ""
diff --git a/jarvis/agent_chat/turn_host_client.py b/jarvis/agent_chat/turn_host_client.py
index 0183241bc4..502a4491ae 100644
--- a/jarvis/agent_chat/turn_host_client.py
+++ b/jarvis/agent_chat/turn_host_client.py
@@ -667,7 +667,8 @@ def read_spool() -> list[dict[str, Any]]:
records: list[dict[str, Any]] = []
try:
paths = sorted(spool_dir().glob("*.json"))
- except OSError:
+ except OSError as exc:
+ log.warning("turn host spool could not be listed; spooled turns stay on disk: %s", exc)
return records
for path in paths:
try:
diff --git a/jarvis/agentic_ide/editor_backups.py b/jarvis/agentic_ide/editor_backups.py
index 2d60f95710..f0a70c2357 100644
--- a/jarvis/agentic_ide/editor_backups.py
+++ b/jarvis/agentic_ide/editor_backups.py
@@ -84,7 +84,7 @@ def _write_json(target: Path, payload: dict[str, Any]) -> None:
def _read_json(source: Path) -> dict[str, Any] | None:
try:
data = json.loads(source.read_text(encoding="utf-8"))
- except FileNotFoundError:
+ except FileNotFoundError: # no backup yet is the normal case
return None
except (OSError, ValueError) as exc:
# A damaged backup must not keep the editor from starting.
@@ -107,7 +107,7 @@ def save_tabs(
clean.append({"path": path, "mode": mode, "preview": bool(tab.get("preview"))})
try:
active_path = _normalise_relative(active) if active else None
- except EditError:
+ except EditError: # an unusable active tab just leaves none active
active_path = None
_write_json(_folder_dir(folder) / "tabs.json", {"tabs": clean, "active": active_path})
@@ -141,7 +141,7 @@ def drop_backup(folder: str | os.PathLike[str], path: str) -> None:
target = _backup_file(folder, _normalise_relative(path))
try:
target.unlink()
- except FileNotFoundError:
+ except FileNotFoundError: # already gone is what forgetting wants
return
diff --git a/jarvis/agentic_ide/file_editing.py b/jarvis/agentic_ide/file_editing.py
index cbecc1a30d..ab4cf7f004 100644
--- a/jarvis/agentic_ide/file_editing.py
+++ b/jarvis/agentic_ide/file_editing.py
@@ -218,7 +218,7 @@ def _mixed_eol(text: str) -> bool:
def _canonical_codec(name: str) -> str | None:
try:
return codecs.lookup(name).name
- except LookupError:
+ except LookupError: # an unknown codec name is answered with None
return None
@@ -233,14 +233,14 @@ def _decode(data: bytes) -> tuple[str, str] | None:
if data.startswith(bom):
try:
return data[len(bom) :].decode(codec), codec
- except UnicodeDecodeError:
+ except UnicodeDecodeError: # a broken UTF-16 file is not text; the caller says so
return None
if b"\x00" in data[:_BINARY_SNIFF_BYTES]:
return None
encoding = "utf-8-sig" if data.startswith(_UTF8_BOM) else "utf-8"
try:
return data.decode(encoding), encoding
- except UnicodeDecodeError:
+ except UnicodeDecodeError: # not UTF-8: try the detector below
pass
# Lazy import: only a non-UTF-8 file pays for the detector.
from charset_normalizer import from_bytes
@@ -255,11 +255,11 @@ def _decode(data: bytes) -> tuple[str, str] | None:
if codec in family and codec != preferred:
try:
return data.decode(preferred), preferred
- except UnicodeDecodeError:
+ except UnicodeDecodeError: # the family's preferred codec fails: use the detected one
break
try:
return data.decode(codec), codec
- except UnicodeDecodeError:
+ except UnicodeDecodeError: # undecodable means binary; the caller says so
return None
@@ -329,6 +329,7 @@ def file_version(root: str | os.PathLike[str], path: str) -> str | None:
return ""
return _version_of(target.read_bytes())
except (FileNotFoundError, IsADirectoryError, NotADirectoryError):
+ # a missing file has no version; the caller reports it
return None
except PermissionError:
# Windows reports reading a folder as "access denied".
@@ -342,7 +343,7 @@ def _atomic_write(target: Path, data: bytes) -> None:
mode: int | None = None
try:
mode = stat.S_IMODE(target.stat().st_mode)
- except FileNotFoundError:
+ except FileNotFoundError: # a new file has no mode to keep
mode = None
handle, temp_name = tempfile.mkstemp(
prefix=f".{target.name}.", suffix=".jarvis-save", dir=target.parent
@@ -523,6 +524,7 @@ def _git_listed_files(base: Path) -> list[str] | None:
creationflags=NO_WINDOW_CREATIONFLAGS,
)
except (FileNotFoundError, subprocess.TimeoutExpired):
+ # no git or a slow one: the caller falls back to a plain walk
return None
if result.returncode != 0:
return None
@@ -567,7 +569,7 @@ def _move_to_trash(target: Path) -> bool:
"""
try:
from send2trash import send2trash # type: ignore[import-not-found]
- except ImportError:
+ except ImportError: # no trash support: the editor asks before a permanent delete
return False
try:
send2trash(str(target))
diff --git a/jarvis/agentic_ide/file_search.py b/jarvis/agentic_ide/file_search.py
index d12e550d82..1c7c0f586f 100644
--- a/jarvis/agentic_ide/file_search.py
+++ b/jarvis/agentic_ide/file_search.py
@@ -155,7 +155,7 @@ def _read_searchable(base: Path, path: str) -> str | None:
if target.stat().st_size > MAX_SEARCH_BYTES:
return None
data = target.read_bytes()
- except OSError:
+ except OSError: # an unreadable file is left out of the search results
return None
# Read it exactly the way the editor opens it (UTF-8, UTF-16, Windows code
# pages, …), so a search finds what the editor shows; binaries stay out.
@@ -323,10 +323,10 @@ def replace_in_files(
expected_version=loaded.version,
encoding=loaded.encoding,
)
- except EditConflict:
+ except EditConflict: # reported to the person in the skipped list
skipped.append({"path": path, "reason": "changed while replacing"})
continue
- except (EditError, re.error) as exc:
+ except (EditError, re.error) as exc: # reported to the person in the skipped list
skipped.append({"path": path, "reason": str(exc)})
continue
replaced_files.append(loaded.path)
diff --git a/jarvis/agentic_ide/python_intel.py b/jarvis/agentic_ide/python_intel.py
index 2048baad7e..faa8b5936a 100644
--- a/jarvis/agentic_ide/python_intel.py
+++ b/jarvis/agentic_ide/python_intel.py
@@ -180,7 +180,7 @@ def definitions(
continue # a library outside the workspace: nothing to open here
try:
_resolve(root, relative)
- except EditError:
+ except EditError: # a path outside the workspace cannot be opened
continue
results.append({"path": relative, "line": name.line, "column": (name.column or 0) + 1})
return results
diff --git a/jarvis/ui/web/society_browser_routes.py b/jarvis/ui/web/society_browser_routes.py
index d4823224ec..63b3111bb8 100644
--- a/jarvis/ui/web/society_browser_routes.py
+++ b/jarvis/ui/web/society_browser_routes.py
@@ -297,7 +297,7 @@ async def agent_browser_live(websocket: WebSocket, agent_id: str) -> None:
# Motion recorded before this input is older than it.
hover.clear()
commands.put_nowait(item)
- except asyncio.QueueFull:
+ except asyncio.QueueFull: # the client is told below that the input was dropped
await send(
{
"kind": "control",