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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix: move output scans off the event loop
rubenluetke10-beep5eee0215965e
diff --git a/jarvis/ui/web/outputs_routes.py b/jarvis/ui/web/outputs_routes.pyindex 54ecc14e9e..1eddeed5f7 100644--- a/jarvis/ui/web/outputs_routes.py+++ b/jarvis/ui/web/outputs_routes.py@@ -505,6 +505,13 @@ async def list_outputs(request: Request) -> OutputsResponse:raise HTTPException(status_code=500, detail=f"Outputs root not readable: {exc}") from excentries = sorted(entries_by_name.values(), key=lambda path: path.name, reverse=True)+ # Artifact archives can contain entire generated projects. Walking them is+ # blocking filesystem work and must never run on the ASGI event-loop thread:+ # a live 2026-08-09 trace caught this glob freezing every HTTP route and+ # WebSocket for 15 seconds. Keep the walk sequential (one disk worker, not+ # one per mission) so a large archive cannot turn into an I/O stampede.+ artifact_counts = await asyncio.to_thread(_count_all_deliverables, entries)+sessions: list[dict[str, Any]] = []# Map dir-name → mission-id prefix derived from the dir-name itself.# Persistent ``mission_<short>`` dirs encode the mission_id prefix@@ -606,7 +613,7 @@ async def list_outputs(request: Request) -> OutputsResponse:0.0,(end_ms - mission_row["created_ms"]) / 1000.0,)- artifact_count = _count_deliverables(entry)+ artifact_count = artifact_counts.get(entry, 0)summary["artifact_count"] = artifact_countsummary["has_partial_output"] = (artifact_count > 0 and summary["status"] in ("error", "cancelled")@@ -623,6 +630,11 @@ async def list_outputs(request: Request) -> OutputsResponse:return OutputsResponse.model_validate({"sessions": sessions})+def _count_all_deliverables(entries: list[Path]) -> dict[Path, int]:+ """Count archived deliverables sequentially on a worker thread."""+ return {entry: _count_deliverables(entry) for entry in entries}++def _count_deliverables(session_dir: Path) -> int:"""Count genuine archived files without reading their contents."""count = 0diff --git a/tests/unit/ui/web/test_outputs_routes.py b/tests/unit/ui/web/test_outputs_routes.pyindex b2994e8bd5..dccdfe6e77 100644--- a/tests/unit/ui/web/test_outputs_routes.py+++ b/tests/unit/ui/web/test_outputs_routes.py@@ -18,6 +18,7 @@ design).from __future__ import annotations+import asyncioimport jsonimport timefrom collections.abc import AsyncIterator@@ -245,6 +246,37 @@ async def test_list_outputs_empty_root(app: FastAPI) -> None:assert r.json() == {"sessions": []}+async def test_list_outputs_counts_artifacts_off_the_event_loop(+ app: FastAPI,+ db_conn: aiosqlite.Connection,+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """A deep archive walk must not freeze HTTP and WebSocket handling."""+ mission_id = "019e3600-a84e-7000-8000-000000000123"+ session = _make_mission_dir(tmp_path, mission_id)+ _seed(session / "tasks" / "task-1" / "artifacts" / "files" / "report.md")+ await _insert_mission(db_conn, mission_id=mission_id, state="completed")++ from jarvis.ui.web import outputs_routes++ original = outputs_routes._count_deliverables++ def assert_worker_thread(path: Path) -> int:+ with pytest.raises(RuntimeError, match="no running event loop"):+ asyncio.get_running_loop()+ return original(path)++ monkeypatch.setattr(outputs_routes, "_count_deliverables", assert_worker_thread)++ with TestClient(app) as client:+ response = client.get("/api/outputs")++ assert response.status_code == 200+ assert response.json()["sessions"][0]["artifact_count"] == 1++@pytest.mark.asyncioasync def test_list_outputs_includes_legacy_sessions_when_canonical_root_exists(app: FastAPI, tmp_path: Path