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(agents): the board reads the durable record, so it is no longer permanently empty

rubenluetke10-beepa5343c5bb0c4
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 2cc0d16361..1ed669d7f3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -688,11 +688,9 @@
},
"subagents_view": {
"title": "{name}-Agents",
- "subtitle": "{active} laufen · {total} insgesamt",
+ "subtitle": "{active} laufen · {total} auf der Tafel",
"explicit_spawn_hint": "{name}-Agents starten nur, wenn du ausdrücklich danach fragst — sag z. B. „Spawne einen Agenten dafür“ oder „Mach einen Deep Dive mit einem Agenten“.",
- "clear": "Leeren",
- "clear_tooltip": "Tafel leeren",
- "stat_agents_hint": "in dieser Sitzung gestartet",
+ "stat_agents_hint": "laufend und aus dem Verlauf",
"stat_active_label": "Laufend",
"stat_active_hint": "{tools} Tool-Aufrufe unterwegs",
"stat_active_hint_idle": "nichts unterwegs",
@@ -720,9 +718,12 @@
"task_none": "Keine Aufgabe erfasst",
"result_done": "Fertig",
"result_running": "Läuft",
+ "result_failed": "Fehlgeschlagen",
+ "result_cancelled": "Abgebrochen",
"empty_title": "Gerade laufen keine {agents}.",
"empty_body": "Sobald {name} einen echten {agent} startet, erscheint er hier mit Aufgabe, Status, Tool-Aufrufen, Laufzeit und Ergebnis.",
"snapshot_error": "Die Tafel konnte nicht geladen werden: {detail}",
+ "history_error": "Der Verlauf konnte nicht geladen werden — angezeigt wird nur, was gerade läuft.",
"drill_tools": "Tool-Aufrufe",
"drill_tools_empty": "Keine Tool-Aufrufe erfasst.",
"drill_details": "{agent} – Details",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 22befdde3f..f44a185cd1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -688,11 +688,9 @@
},
"subagents_view": {
"title": "{name}-Agents",
- "subtitle": "{active} running · {total} in total",
+ "subtitle": "{active} running · {total} on the board",
"explicit_spawn_hint": "{name}-Agents start only when you explicitly ask for one — say e.g. “Spawn an agent for this” or “Do a deep dive with an agent”.",
- "clear": "Clear",
- "clear_tooltip": "Clear board",
- "stat_agents_hint": "started in this session",
+ "stat_agents_hint": "running now, plus the recent record",
"stat_active_label": "Running",
"stat_active_hint": "{tools} tool calls in flight",
"stat_active_hint_idle": "nothing in flight",
@@ -720,9 +718,12 @@
"task_none": "No task recorded",
"result_done": "Done",
"result_running": "In progress",
+ "result_failed": "Failed",
+ "result_cancelled": "Cancelled",
"empty_title": "No {agents} are running right now.",
"empty_body": "When {name} starts a real {agent}, it appears here with its task, status, tool calls, runtime and result.",
"snapshot_error": "The board could not be loaded: {detail}",
+ "history_error": "Past runs could not be loaded — showing only what is running right now.",
"drill_tools": "Tool calls",
"drill_tools_empty": "No tool calls recorded.",
"drill_details": "{agent} details",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 5df9b64e2d..60e9ccec13 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -688,11 +688,9 @@
},
"subagents_view": {
"title": "{name}-Agents",
- "subtitle": "{active} en marcha · {total} en total",
+ "subtitle": "{active} en marcha · {total} en el panel",
"explicit_spawn_hint": "Los {name}-Agents solo arrancan cuando lo pides explícitamente — di p. ej. «Spawn un agente para esto» o «Haz un deep dive con un agente».",
- "clear": "Limpiar",
- "clear_tooltip": "Limpiar tablero",
- "stat_agents_hint": "iniciados en esta sesión",
+ "stat_agents_hint": "en marcha y del historial",
"stat_active_label": "En marcha",
"stat_active_hint": "{tools} llamadas a herramientas en curso",
"stat_active_hint_idle": "nada en curso",
@@ -720,9 +718,12 @@
"task_none": "Sin tarea registrada",
"result_done": "Terminado",
"result_running": "En curso",
+ "result_failed": "Fallido",
+ "result_cancelled": "Cancelado",
"empty_title": "Ahora mismo no hay {agents} en marcha.",
"empty_body": "Cuando {name} inicie un {agent} real, aparecerá aquí con su tarea, estado, llamadas a herramientas, duración y resultado.",
"snapshot_error": "No se pudo cargar el panel: {detail}",
+ "history_error": "No se pudo cargar el historial — se muestra solo lo que está en marcha.",
"drill_tools": "Llamadas a herramientas",
"drill_tools_empty": "No se registraron llamadas a herramientas.",
"drill_details": "Detalles de {agent}",
diff --git a/jarvis/ui/web/frontend/src/types/missions.ts b/jarvis/ui/web/frontend/src/types/missions.ts
index 03e0efdd39..e514345386 100644
--- a/jarvis/ui/web/frontend/src/types/missions.ts
+++ b/jarvis/ui/web/frontend/src/types/missions.ts
@@ -234,6 +234,8 @@ export interface MissionSummary {
state: MissionState;
language: string;
created_ms: number;
+ /** Last state change — the end of a landed run. Sent by `GET /api/missions`. */
+ updated_ms?: number;
iteration: number;
cost_usd: number;
parent_mission_id?: string | null;
diff --git a/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx b/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx
index b375901094..ae82770d4e 100644
--- a/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx
@@ -1,18 +1,33 @@
/**
- * JarvisAgentsView — live board of all active Jarvis-Agents.
+ * JarvisAgentsView — board of every Jarvis-Agent, live and past.
*
- * This file is the data half: it hydrates the board from the REST snapshot,
- * keeps it live off the mission WebSocket, and sweeps expired nodes. All of
- * the presentation — header, headline numbers, table and per-row drilldown —
- * lives in `DepartureBoard`, which renders it with the shared
+ * This file is the data half. It reads TWO sources and merges them:
+ *
+ * - `/api/sub-agents/tree` — the live registry. Carries tool calls and a
+ * running clock, but it is an in-memory bus subscriber that drops a finished
+ * node after 60s and starts empty on every app start.
+ * - `/api/missions` — the durable record of the same runs. No tool calls, but
+ * it survives, so the board is not blank whenever nothing happens to be
+ * running in this exact minute.
+ *
+ * Before the merge the board was live-only, which meant every number read 0
+ * and the table read "no agents are running right now" even with hundreds of
+ * finished runs on disk. See `missionRows.ts` for the mapping and why a run
+ * present in both wins as its live node.
+ *
+ * All of the presentation — header, headline numbers, table and per-row
+ * drilldown — lives in `DepartureBoard`, which renders it with the shared
* `components/extensions/primitives` so this section looks like Spend, Skills,
* Plugins, MCPs and CLIs rather than like a screen of its own.
*/
import { useCallback, useEffect, useMemo, useState } from "react";
+import { useQuery } from "@tanstack/react-query";
import { useSubAgentStore, type SubAgentTreeSnapshot } from "@/store/jarvisAgents";
import { DepartureBoard } from "./sub-agents/DepartureBoard";
import { selectTaskRows } from "./sub-agents/rows";
+import { mergeBoardRows } from "./sub-agents/missionRows";
+import { fetchMissions } from "@/components/missions/api";
import { useMissionWebSocket } from "@/components/missions/useMissionWebSocket";
import { useMissionsStore } from "@/components/missions/store";
import { useSectionHealth } from "@/hooks/useProviders";
@@ -22,7 +37,6 @@ export function JarvisAgentsView() {
const subAgents = useSubAgentStore((s) => s.subAgents);
const sweepExpired = useSubAgentStore((s) => s.sweepExpired);
const hydrateSnapshot = useSubAgentStore((s) => s.hydrateSnapshot);
- const clear = useSubAgentStore((s) => s.clear);
const [snapshotError, setSnapshotError] = useState<string | null>(null);
// One row per task: collapse each worker into its mission row so a single
@@ -31,7 +45,22 @@ export function JarvisAgentsView() {
// nodes for the DetailPanel; this only filters the displayed list. Header
// counts and the DepartureBoard metric panel both derive from this array,
// so they stay consistent with the rows actually shown.
- const nodesList = useMemo(() => selectTaskRows(subAgents), [subAgents]);
+ const liveRows = useMemo(() => selectTaskRows(subAgents), [subAgents]);
+
+ // The durable half. Shares its query key with the Missions view, so opening
+ // both costs one request. A failure here is not surfaced as an error: the
+ // live board still works without history, and the section already has a
+ // banner for the snapshot it cannot do without.
+ const historyQuery = useQuery({
+ queryKey: ["missions"],
+ queryFn: fetchMissions,
+ refetchInterval: 30_000,
+ });
+
+ const nodesList = useMemo(
+ () => mergeBoardRows(liveRows, historyQuery.data?.missions ?? []),
+ [liveRows, historyQuery.data],
+ );
const loadSnapshot = useCallback(async (signal?: AbortSignal) => {
try {
@@ -88,7 +117,7 @@ export function JarvisAgentsView() {
agents={nodesList}
snapshotError={snapshotError}
health={health["subagents"] ?? null}
- onClear={() => clear()}
+ historyError={historyQuery.isError}
/>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx
index 587d4c8e71..42f0347d0f 100644
--- a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx
@@ -29,7 +29,6 @@ import {
CircleAlert,
Radio,
TerminalSquare,
- Trash2,
Wrench,
} from "lucide-react";
@@ -40,7 +39,6 @@ import { ScrollArea } from "@/components/ui/scroll-area";
import {
Cell,
type Column,
- IconButton,
Panel,
PanelHeader,
StatTile,
@@ -114,6 +112,11 @@ function resultLabel(node: SubAgentNode, t: (key: string) => string): string {
if (summary) return summary.replace("[summary] ", "");
if (node.status === "completed") return t("subagents_view.result_done");
if (node.status === "running") return t("subagents_view.result_running");
+ // A row from the durable record carries no error text, so without these two
+ // a failed or cancelled past run showed an em dash next to a red status —
+ // as if the outcome were unknown rather than stated one column to the left.
+ if (node.status === "failed") return t("subagents_view.result_failed");
+ if (node.status === "cancelled") return t("subagents_view.result_cancelled");
return "—";
}
@@ -121,14 +124,15 @@ interface Props {
agents?: SubAgentNode[];
snapshotError?: string | null;
health?: SectionHealth | null;
- onClear?: () => void;
+ /** The durable half could not be loaded; the live half still renders. */
+ historyError?: boolean;
}
export function DepartureBoard({
agents = [],
snapshotError = null,
health = null,
- onClear,
+ historyError = false,
}: Props) {
const t = useT();
const assistantName = useEventStore((s) => s.assistantName);
@@ -196,17 +200,6 @@ export function DepartureBoard({
active: activeCount,
total: agents.length,
})}
- actions={
- onClear ? (
- <IconButton
- label={t("subagents_view.clear_tooltip")}
- onClick={onClear}
- disabled={agents.length === 0}
- >
- <Trash2 className="h-4 w-4" />
- </IconButton>
- ) : null
- }
/>
{health && (health.status === "needs_setup" || health.status === "error") && (
@@ -228,6 +221,10 @@ export function DepartureBoard({
</Notice>
)}
+ {historyError && !snapshotError && (
+ <Notice tone="warn">{t("subagents_view.history_error")}</Notice>
+ )}
+
{/* ---------------------------------------------------------------
Headline numbers. Failed keeps its own tile rather than hiding
inside "Done": a run that ended and a run that broke are not the
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/missionRows.test.ts b/jarvis/ui/web/frontend/src/views/sub-agents/missionRows.test.ts
new file mode 100644
index 0000000000..3dbdabebdd
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/missionRows.test.ts
@@ -0,0 +1,133 @@
+import { describe, expect, it } from "vitest";
+
+import type { MissionSummary } from "@/types/missions";
+import type { SubAgentNode } from "@/store/jarvisAgents";
+import { mergeBoardRows, missionToNode, normalizeTraceId } from "./missionRows";
+
+function mission(over: Partial<MissionSummary> = {}): MissionSummary {
+ return {
+ id: "01a02ec4-a894-7360-a3d8-8a7c09ec0eda",
+ prompt: "Audit the release notes",
+ state: "APPROVED",
+ language: "de",
+ created_ms: 1_787_491_035_284,
+ updated_ms: 1_787_491_261_559,
+ iteration: 0,
+ cost_usd: 0.42,
+ ...over,
+ } as MissionSummary;
+}
+
+function liveNode(over: Partial<SubAgentNode> = {}): SubAgentNode {
+ return {
+ trace_id: "aaaa",
+ kind: "jarvis_agent",
+ name: "Assistant-Agent",
+ status: "running",
+ parent_trace_id: null,
+ started_ns: 5_000_000_000_000_000,
+ completed_ns: null,
+ duration_ms: null,
+ cost_usd: 0,
+ tokens_in: 0,
+ tokens_out: 0,
+ utterance: "Live run",
+ context_hints: [],
+ prompts: [],
+ tool_calls: [],
+ children_trace_ids: [],
+ error: null,
+ error_class: null,
+ review_iterations: 0,
+ depth: 0,
+ ui_appeared_at: 1,
+ ...over,
+ };
+}
+
+describe("missionToNode", () => {
+ it("carries the task, the cost and the wall-clock duration", () => {
+ const node = missionToNode(mission());
+ expect(node.utterance).toBe("Audit the release notes");
+ expect(node.cost_usd).toBe(0.42);
+ expect(node.duration_ms).toBe(1_787_491_261_559 - 1_787_491_035_284);
+ expect(node.started_ns).toBe(1_787_491_035_284 * 1_000_000);
+ });
+
+ it.each([
+ ["PENDING", "running"],
+ ["RUNNING", "running"],
+ ["CRITIQUING", "running"],
+ ["LOOPING", "running"],
+ ["APPROVED", "completed"],
+ ["FAILED", "failed"],
+ ["TIMED_OUT", "failed"],
+ ["CANCELLED", "cancelled"],
+ ])("maps mission state %s to board status %s", (state, expected) => {
+ expect(missionToNode(mission({ state: state as MissionSummary["state"] })).status).toBe(
+ expected,
+ );
+ });
+
+ it("gives a still-running mission no duration, so the board counts up itself", () => {
+ const node = missionToNode(mission({ state: "RUNNING" as MissionSummary["state"] }));
+ expect(node.duration_ms).toBeNull();
+ expect(node.completed_ns).toBeNull();
+ });
+
+ it("strips dashes so the id matches a registry trace id", () => {
+ expect(missionToNode(mission()).trace_id).toBe("01a02ec4a8947360a3d88a7c09ec0eda");
+ expect(normalizeTraceId("a-b-c")).toBe("abc");
+ });
+});
+
+describe("mergeBoardRows", () => {
+ it("keeps the live node for a run that is in both sources", () => {
+ const live = liveNode({
+ trace_id: "01a02ec4a8947360a3d88a7c09ec0eda",
+ tool_calls: [
+ { tool_name: "Grep", args_preview: "x", started_ns: 1, status: "completed" },
+ ],
+ });
+
+ const rows = mergeBoardRows([live], [mission()]);
+
+ expect(rows).toHaveLength(1);
+ // The live one wins: only it carries the tool calls the drilldown needs.
+ expect(rows[0].tool_calls).toHaveLength(1);
+ expect(rows[0].status).toBe("running");
+ });
+
+ it("adds past runs the live registry has already forgotten", () => {
+ const rows = mergeBoardRows(
+ [],
+ [
+ mission({ id: "11111111-1111-1111-1111-111111111111", created_ms: 1000 }),
+ mission({ id: "22222222-2222-2222-2222-222222222222", created_ms: 2000 }),
+ ],
+ );
+
+ expect(rows).toHaveLength(2);
+ // Newest first, across both sources.
+ expect(rows[0].started_ns).toBeGreaterThan(rows[1].started_ns);
+ });
+
+ it("sorts a fresh live run above an older past one", () => {
+ const rows = mergeBoardRows(
+ [liveNode({ trace_id: "live", started_ns: 9_000_000_000_000_000 })],
+ [mission({ created_ms: 1000 })],
+ );
+ expect(rows[0].trace_id).toBe("live");
+ });
+
+ it("caps the history so the board stays a board, not an archive", () => {
+ const many = Array.from({ length: 120 }, (_, i) =>
+ mission({ id: `${i}`.padStart(8, "0") + "-0000-0000-0000-000000000000", created_ms: i }),
+ );
+ expect(mergeBoardRows([], many, 50)).toHaveLength(50);
+ });
+
+ it("renders nothing when neither source has anything", () => {
+ expect(mergeBoardRows([], [])).toEqual([]);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/missionRows.ts b/jarvis/ui/web/frontend/src/views/sub-agents/missionRows.ts
new file mode 100644
index 0000000000..8f7778e368
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/missionRows.ts
@@ -0,0 +1,120 @@
+/**
+ * Give the agent board a memory.
+ *
+ * The board used to render only `JarvisAgentRegistry`, which is an in-memory
+ * bus subscriber that drops a finished node after a 60 second TTL and starts
+ * empty on every app start. So unless you happened to be looking at the screen
+ * within a minute of a run, every number read 0 and the table read "no agents
+ * are running right now" — even with hundreds of completed runs on disk. The
+ * live view was working exactly as built; it just had nothing durable behind
+ * it.
+ *
+ * The durable record already exists: the missions table behind `/api/missions`,
+ * which is the SAME thing the board calls an agent — `rows.ts` describes a
+ * mission as the root node carrying the task text. So the board now shows the
+ * union: live registry nodes (which carry tool calls and tick in real time)
+ * plus the mission history underneath them.
+ *
+ * A run present in both wins as its LIVE node, because only that one has the
+ * tool calls and the running clock.
+ */
+import type { MissionSummary } from "@/types/missions";
+import type { SubAgentNode } from "@/store/jarvisAgents";
+
+/** How many past runs the board carries. The table is a board, not an archive. */
+export const HISTORY_LIMIT = 50;
+
+/**
+ * Mission lifecycle → board status.
+ *
+ * The four pre-terminal states all mean "this run has not landed yet", which
+ * is what the board's `running` row shows. TIMED_OUT joins `failed` (it did
+ * not deliver); CANCELLED stays its own status, because stopping a run on
+ * purpose is a decision, not a fault.
+ */
+const STATE_STATUS: Record<string, SubAgentNode["status"]> = {
+ PENDING: "running",
+ RUNNING: "running",
+ CRITIQUING: "running",
+ LOOPING: "running",
+ APPROVED: "completed",
+ FAILED: "failed",
+ TIMED_OUT: "failed",
+ CANCELLED: "cancelled",
+};
+
+/**
+ * Registry trace ids have their dashes stripped (`sub_agents_routes.get_agent`
+ * does the same before a lookup), mission ids keep theirs. Compare on the
+ * stripped form or the same run shows up twice.
+ */
+export function normalizeTraceId(id: string): string {
+ return id.replace(/-/g, "");
+}
+
+export function missionToNode(mission: MissionSummary): SubAgentNode {
+ const status = STATE_STATUS[mission.state] ?? "completed";
+ const createdMs = mission.created_ms;
+ // `updated_ms` is when the row last changed state, so for a landed run it is
+ // its end. A still-running one has no duration yet — the board then counts
+ // up from `started_ns` itself.
+ const updatedMs = mission.updated_ms;
+ const settled = status !== "running";
+ const durationMs =
+ settled && typeof updatedMs === "number" && updatedMs > createdMs
+ ? updatedMs - createdMs
+ : null;
+
+ return {
+ trace_id: normalizeTraceId(mission.id),
+ kind: "jarvis_agent",
+ name: "",
+ status,
+ parent_trace_id: mission.parent_mission_id
+ ? normalizeTraceId(mission.parent_mission_id)
+ : null,
+ started_ns: createdMs * 1_000_000,
+ completed_ns: settled && updatedMs ? updatedMs * 1_000_000 : null,
+ duration_ms: durationMs,
+ cost_usd: mission.cost_usd ?? 0,
+ tokens_in: 0,
+ tokens_out: 0,
+ utterance: mission.prompt,
+ context_hints: [],
+ prompts: [],
+ // The history carries no tool calls — the registry is the only source for
+ // those, and it forgets. An empty list keeps the row un-expandable rather
+ // than opening onto nothing.
+ tool_calls: [],
+ children_trace_ids: [],
+ error: null,
+ error_class: null,
+ review_iterations: mission.iteration ?? 0,
+ depth: 0,
+ ui_appeared_at: createdMs,
+ };
+}
+
+/**
+ * Live nodes first, then any past run the registry no longer holds.
+ *
+ * Sorted newest-first across both sources, so a run that just finished sits
+ * above yesterday's regardless of which source it came from.
+ */
+export function mergeBoardRows(
+ live: SubAgentNode[],
+ missions: MissionSummary[],
+ limit: number = HISTORY_LIMIT,
+): SubAgentNode[] {
+ const seen = new Set(live.map((n) => normalizeTraceId(n.trace_id)));
+ const history: SubAgentNode[] = [];
+
+ for (const mission of missions) {
+ if (history.length >= limit) break;
+ if (seen.has(normalizeTraceId(mission.id))) continue;
+ seen.add(normalizeTraceId(mission.id));
+ history.push(missionToNode(mission));
+ }
+
+ return [...live, ...history].sort((a, b) => b.started_ns - a.started_ns);
+}