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(parity): harden the setup report and release gate per review

Ruben Lütke86b28cc253be
diff --git a/jarvis/ui/web/setup_report_routes.py b/jarvis/ui/web/setup_report_routes.py
index e99d64f1a9..12468259c8 100644
--- a/jarvis/ui/web/setup_report_routes.py
+++ b/jarvis/ui/web/setup_report_routes.py
@@ -74,7 +74,8 @@ def _install_snapshot() -> dict[str, Any]:
root = _update._repo_root()
managed = bool(root is not None and (root / _update._MARKER_NAME).exists())
profile = _update._managed_install_profile(root) if root is not None else "unknown"
- except Exception: # noqa: BLE001 — diagnostics must never raise
+ except Exception as exc: # noqa: BLE001 — diagnostics must never raise
+ log.debug("setup-report: install probe failed: %s", exc)
managed, profile = False, "unknown"
return {"managed": managed, "profile": profile}
@@ -122,7 +123,8 @@ def _credential_presence(request: Request) -> dict[str, bool]:
present = bool(
_providers._is_credential_present(spec, binary_path if spec.id == "codex" else None)
)
- except Exception: # noqa: BLE001 — an unreadable slot reads as absent
+ except Exception as exc: # noqa: BLE001 — an unreadable slot reads as absent
+ log.debug("setup-report: credential probe for %s failed: %s", spec.id, exc)
present = False
out[spec.id] = present
return out
@@ -200,23 +202,29 @@ def _render_text(report: dict[str, Any]) -> str:
# --------------------------------------------------------------------------- #
# Route
# --------------------------------------------------------------------------- #
+# response_model=None: the return union includes a bare Response subclass
+# (text mode), which FastAPI must not try to model as a pydantic field.
[email protected]("", response_model=None)
async def get_setup_report(
request: Request,
fmt: str = Query(default="json", alias="format"),
-) -> Any:
+) -> dict[str, Any] | PlainTextResponse:
"""One share-safe snapshot of what powers THIS install, for device diffing."""
- def _sync_parts() -> tuple[dict[str, Any], dict[str, str | None], dict[str, bool]]:
- # Config reads, plugin-registry resolution, and keyring probes are all
- # synchronous — off the loop so the report never stalls the server.
+ def _sync_parts() -> tuple[
+ dict[str, Any], dict[str, str | None], dict[str, bool], dict[str, Any]
+ ]:
+ # Config reads, plugin-registry resolution, keyring probes, and the
+ # install-marker file reads are all synchronous — off the loop so the
+ # report never stalls the server.
return (
_behavior_snapshot(request),
_active_tiers(request),
_credential_presence(request),
+ _install_snapshot(),
)
- behavior, tiers, credentials = await asyncio.to_thread(_sync_parts)
+ behavior, tiers, credentials, install = await asyncio.to_thread(_sync_parts)
sections = await _section_snapshot(request)
report: dict[str, Any] = {
@@ -224,7 +232,7 @@ async def get_setup_report(
"generated_at": time.strftime("%Y-%m-%dT%H:%M:%S%z"),
"version": _version(),
"platform": _platform_snapshot(),
- "install": _install_snapshot(),
+ "install": install,
"behavior": behavior,
"tiers": tiers,
"credentials": credentials,
diff --git a/scripts/ci/check_release_completeness.py b/scripts/ci/check_release_completeness.py
index c2631b5ec6..6bbca3b880 100644
--- a/scripts/ci/check_release_completeness.py
+++ b/scripts/ci/check_release_completeness.py
@@ -72,7 +72,14 @@ def _run_git(args: list[str], *, cwd: Path) -> tuple[int, str]:
)
except (OSError, subprocess.TimeoutExpired) as exc:
return -1, f"could not run git: {exc}"
- return proc.returncode, (proc.stdout or "").rstrip("\n")
+ out = (proc.stdout or "").rstrip("\n")
+ if proc.returncode != 0:
+ # Git reports the actual failure reason (missing remote, offline, auth)
+ # on STDERR — a failing check must surface it, never an empty string.
+ err = (proc.stderr or "").strip()
+ if err:
+ out = f"{out}\n{err}".strip("\n") if out else err
+ return proc.returncode, out
# --------------------------------------------------------------------------- #
diff --git a/tests/unit/ci/test_check_release_completeness.py b/tests/unit/ci/test_check_release_completeness.py
index dedffe8b16..3a57339caa 100644
--- a/tests/unit/ci/test_check_release_completeness.py
+++ b/tests/unit/ci/test_check_release_completeness.py
@@ -9,6 +9,7 @@ reading, and the published-release tag match.
from __future__ import annotations
+import subprocess
from pathlib import Path
from scripts.ci import check_release_completeness as gate
@@ -65,6 +66,16 @@ def test_dirty_check_keeps_the_first_entry_intact(monkeypatch, tmp_path: Path):
assert "GENTS.md" not in message.replace("AGENTS.md", "")
+def test_run_git_surfaces_stderr_on_failure(tmp_path: Path):
+ # Git writes its failure reason (missing remote, offline, bad ref) to
+ # STDERR; a gate whose whole point is transparency must never print an
+ # empty reason. Exercised against a real git repo, not a stub.
+ subprocess.run(["git", "init", "--quiet", str(tmp_path)], check=True)
+ rc, out = gate._run_git(["rev-parse", "--verify", "no-such-ref"], cwd=tmp_path)
+ assert rc != 0
+ assert out.strip(), "the stderr failure reason must reach the caller"
+
+
def test_release_matches_accepts_v_prefix_and_rejects_other_versions():
assert gate.release_matches("v1.1.0", "1.1.0")
assert gate.release_matches("1.1.0", "1.1.0")