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(outputs): hide worker cache artifacts
Ruben Lütke76f1f58bbb69
diff --git a/jarvis/missions/kontrollierer/deliverable_paths.py b/jarvis/missions/kontrollierer/deliverable_paths.pyindex b4563eae35..62e753b2cd 100644--- a/jarvis/missions/kontrollierer/deliverable_paths.py+++ b/jarvis/missions/kontrollierer/deliverable_paths.py@@ -112,6 +112,19 @@ _BROWSER_PROFILE_SEG_RE: Final[re.Pattern[str]] = re.compile()+# A worker may redirect uv's cache into its sandbox when the global user cache+# is not writable. The cache then sits inside the worktree and the archive's+# intentionally broad ignored-file union can mistake hundreds of uv metadata,+# virtualenv, and zero-byte lock files for deliverables. Match only hidden+# directory-style names (``.uv-cache`` / ``.uv-cache-<purpose>``); a normal+# final filename such as ``uv-cache-analysis.md`` is handled below as a genuine+# deliverable.+_UV_CACHE_ROOT_SEG_RE: Final[re.Pattern[str]] = re.compile(+ r"^\.uv-cache(?:[._-].*)?$",+ re.IGNORECASE,+)++def is_browser_scratch_segment(segment: str) -> bool:"""True iff *segment* is a browser user-data / automation profile root dir."""return bool(_BROWSER_PROFILE_SEG_RE.match(segment))@@ -131,13 +144,17 @@ def is_nondeliverable_scratch(rel: str) -> bool:norm = rel.replace("\\", "/").strip("/")if not norm:return False- for seg in norm.split("/"):- if not seg or seg == ".":- continue+ segments = [seg for seg in norm.split("/") if seg and seg != "."]+ for index, seg in enumerate(segments):if seg in _JUNK_DIR_NAMES:return Trueif is_browser_scratch_segment(seg):return True+ # uv cache roots are directories. Restrict the prefix match to a+ # non-final segment so a hidden report file named after the incident is+ # not accidentally suppressed.+ if index < len(segments) - 1 and _UV_CACHE_ROOT_SEG_RE.match(seg):+ return Truereturn Falsediff --git a/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsx b/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsxindex 90459de263..fbc65b38cc 100644--- a/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsx+++ b/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsx@@ -240,6 +240,44 @@ describe("OutputsView rerun button gating", () => {});describe("OutputsView artifact actions", () => {+ it("shows clean paths with primary files before nested assets", async () => {+ installFetchMock(+ [session({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],+ [+ {+ path: "tasks/019edf/artifacts/files/assets/site.css",+ size: 10,+ mtime: 1_750_000_003,+ is_text: true,+ preview: "body {}",+ },+ {+ path: "tasks/019edf/artifacts/files/report10.md",+ size: 10,+ mtime: 1_750_000_002,+ is_text: true,+ preview: "# Ten",+ },+ {+ path: "tasks/019edf/artifacts/files/report2.md",+ size: 10,+ mtime: 1_750_000_001,+ is_text: true,+ preview: "# Two",+ },+ ],+ );++ renderView();++ await waitFor(() =>+ expect(screen.getAllByTestId("artifact-path")).toHaveLength(3),+ );+ expect(+ screen.getAllByTestId("artifact-path").map((node) => node.textContent),+ ).toEqual(["report2.md", "report10.md", "assets/site.css"]);+ });+it("does not render a direct download action for saved mission artifacts", async () => {installFetchMock([session({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],@@ -257,10 +295,11 @@ describe("OutputsView artifact actions", () => {renderView();await waitFor(() =>- expect(- screen.getByText("tasks/019edf/artifacts/files/report.md"),- ).toBeDefined(),+ expect(screen.getByText("report.md")).toBeDefined(),);+ expect(+ screen.queryByText("tasks/019edf/artifacts/files/report.md"),+ ).toBeNull();expect(screen.queryByTitle("Download")).toBeNull();// The artifact opens in an app of the user's choice (chooser), not a fixed@@ -294,9 +333,7 @@ describe("OutputsView artifact actions", () => {renderView();await waitFor(() =>- expect(- screen.getByText("tasks/019edf/artifacts/files/report.md"),- ).toBeDefined(),+ expect(screen.getByText("report.md")).toBeDefined(),);fireEvent.click(screen.getByTitle("Change how this opens"));@@ -339,9 +376,7 @@ describe("OutputsView artifact actions", () => {renderView();await waitFor(() =>- expect(- screen.getByText("tasks/019edf/artifacts/files/report.md"),- ).toBeDefined(),+ expect(screen.getByText("report.md")).toBeDefined(),);fireEvent.click(screen.getByTitle("Open"));diff --git a/jarvis/ui/web/frontend/src/views/OutputsView.tsx b/jarvis/ui/web/frontend/src/views/OutputsView.tsxindex a516e552e2..752af2e831 100644--- a/jarvis/ui/web/frontend/src/views/OutputsView.tsx+++ b/jarvis/ui/web/frontend/src/views/OutputsView.tsx@@ -595,14 +595,34 @@ function isPlumbingArtifact(path: string): boolean {);}+const ARCHIVED_DELIVERABLE_PREFIX = /^tasks\/[^/]+\/artifacts\/files\//;++/** Hide archive plumbing from the label while retaining the full path for APIs. */+function deliverableDisplayPath(path: string): string {+ return path.replace(ARCHIVED_DELIVERABLE_PREFIX, "");+}++/** Put primary top-level files first, then group nested assets alphabetically. */+function compareDeliverablePaths(a: ArtifactSummary, b: ArtifactSummary): number {+ const left = deliverableDisplayPath(a.path);+ const right = deliverableDisplayPath(b.path);+ const depth = left.split("/").length - right.split("/").length;+ return depth || left.localeCompare(right, undefined, {+ numeric: true,+ sensitivity: "base",+ });+}+function ArtifactsSection({ slug }: { slug: string }) {const t = useT();const q = useArtifactsForOutput(slug);const caps = useOutputsCapabilities();const nativeActions = caps.data?.native_file_actions ?? false;const allFiles = q.data?.files ?? [];- // Show genuine deliverables + the captured diff; hide stream/stderr/mcp noise.- const files = allFiles.filter((f) => !isPlumbingArtifact(f.path));+ // Keep a defensive client-side plumbing filter for older API responses.+ const files = allFiles+ .filter((f) => !isPlumbingArtifact(f.path))+ .sort(compareDeliverablePaths);return (<section className="rounded-xl border border-border bg-card/40 p-4">@@ -738,8 +758,12 @@ function ArtifactRow({) : (<ChevronRight className="h-3 w-3 shrink-0 text-muted-foreground" />)}- <span className="min-w-0 flex-1 truncate font-mono text-[11px]">- {file.path}+ <span+ className="min-w-0 flex-1 truncate font-mono text-[11px]"+ data-testid="artifact-path"+ title={file.path}+ >+ {deliverableDisplayPath(file.path)}</span></button><span className="shrink-0 text-[10px] text-muted-foreground">diff --git a/tests/missions/kontrollierer/test_capture_diff.py b/tests/missions/kontrollierer/test_capture_diff.pyindex 1207f655c0..254a7988a8 100644--- a/tests/missions/kontrollierer/test_capture_diff.py+++ b/tests/missions/kontrollierer/test_capture_diff.py@@ -730,3 +730,30 @@ def test_archive_skips_browser_profile_scratch(if "chrome-profile-dd6355b81ddb49db87fc5045a7012b19" in p.parts]assert not leaked, f"browser-profile scratch leaked into archive: {leaked}"+++def test_archive_skips_sandbox_local_uv_cache(+ worktree: Path, kontrollierer: Kontrollierer, tmp_path: Path+) -> None:+ """A writable uv fallback cache must not become hundreds of results."""+ (worktree / "wiki-audit.md").write_text("# Findings\n", encoding="utf-8")+ cache = worktree / ".uv-cache-audit"+ (cache / "wheels-v6" / "pypi" / "fastapi").mkdir(parents=True)+ (cache / "wheels-v6" / "pypi" / "fastapi" / "fastapi.lock").write_bytes(b"")+ (cache / "builds-v0" / ".tmp123").mkdir(parents=True)+ (cache / "builds-v0" / ".tmp123" / "pyvenv.cfg").write_text(+ "home = worker cache\n", encoding="utf-8"+ )++ mission_dir = tmp_path / "mission_root"+ mission_dir.mkdir()+ artifacts = kontrollierer._archive_task_artifacts(+ worktree=worktree,+ mission_dir=mission_dir,+ task_id="019fa4bc91100000",+ )++ assert artifacts is not None+ files_dir = artifacts / "files"+ assert (files_dir / "wiki-audit.md").is_file()+ assert not (files_dir / ".uv-cache-audit").exists()diff --git a/tests/missions/kontrollierer/test_deliverable_paths.py b/tests/missions/kontrollierer/test_deliverable_paths.pyindex ebe2cffed7..dcc6de05b1 100644--- a/tests/missions/kontrollierer/test_deliverable_paths.py+++ b/tests/missions/kontrollierer/test_deliverable_paths.py@@ -35,6 +35,8 @@ _REAL_JUNK = ["qa-artifacts/chrome-profile-215c81b1bed945dbb720aeb3f32b38d3/Variations","qa-artifacts/chrome-profile-53f907ebce1e41fe82c76f8894c64cf0/first_party_sets.db-journal","qa-artifacts/chrome-profile-2889ad51367a4d8c9ae31efac95bb17f/Crashpad/settings.dat",+ ".uv-cache-audit/wheels-v6/pypi/fastapi/fastapi-0.138.0-py3-none-any.lock",+ ".uv-cache-wiki/builds-v0/.tmp123/Lib/site-packages/_virtualenv.py",]# Real genuine deliverables from the SAME mission — every one must survive@@ -60,6 +62,8 @@ _LEGIT_LOOKALIKES = ["output.log", # gitignored log IS a deliverable"data_0", # a bare data_N file outside a profile"scoped_directory/main.py", # 'scoped_dir' prefix but not a temp profile+ "reports/uv-cache-analysis.md", # ordinary report name, not a hidden cache root+ ".uv-cache-audit.md", # final filename, not a directory segment]diff --git a/tests/unit/ui/web/test_outputs_routes.py b/tests/unit/ui/web/test_outputs_routes.pyindex b84cd1b2a6..b2994e8bd5 100644--- a/tests/unit/ui/web/test_outputs_routes.py+++ b/tests/unit/ui/web/test_outputs_routes.py@@ -905,6 +905,38 @@ def test_is_deliverable_relpath_excludes_browser_scratch() -> None:assert _is_deliverable_relpath((*base, "qa-artifacts", "melbourne-plan-render.png"))+def test_is_deliverable_relpath_excludes_uv_cache_scratch() -> None:+ """A sandbox-local uv cache is process state, never a mission result."""+ base = ("tasks", "019fa4bc-9110", "artifacts", "files")+ assert not _is_deliverable_relpath(+ (*base, ".uv-cache-audit", "wheels-v6", "pypi", "fastapi.lock")+ )+ assert not _is_deliverable_relpath(+ (*base, ".uv-cache-wiki", "builds-v0", ".tmp123", "pyvenv.cfg")+ )+ assert _is_deliverable_relpath((*base, "reports", "uv-cache-analysis.md"))+++async def test_list_artifacts_hides_uv_cache_from_existing_missions(+ app: FastAPI, tmp_path: Path+) -> None:+ """Read-side filtering repairs missions archived before the source fix."""+ d = _make_mission_dir(tmp_path, "019fa4bc8d2b")+ files = d / "tasks" / "019fa4bc-9110" / "artifacts" / "files"+ _seed(files / ".uv-cache-audit" / "wheels-v6" / "fastapi.lock", "")+ _seed(files / ".uv-cache-audit" / "builds-v0" / "pyvenv.cfg", "cache")+ _seed(files / "wiki-audit.md", "# Findings")++ with TestClient(app) as client:+ r = client.get(f"/api/outputs/{d.name}/artifacts")++ assert r.status_code == 200+ assert [item["path"] for item in r.json()["files"]] == [+ "tasks/019fa4bc-9110/artifacts/files/wiki-audit.md"+ ]++@pytest.mark.asyncioasync def test_list_artifacts_lists_only_deliverables(app: FastAPI, tmp_path: Path) -> None:"""Only genuine deliverables are listed; the forensic ``diff.patch`` one