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(ide): title panes by their goal instead of T1, T2
rubenluetke10-beep29e9061dcbbe
diff --git a/jarvis/agentic_ide/recap_engine.py b/jarvis/agentic_ide/recap_engine.pyindex 861a0780a0..d391295db3 100644--- a/jarvis/agentic_ide/recap_engine.py+++ b/jarvis/agentic_ide/recap_engine.py@@ -270,7 +270,7 @@ past all of that to the work itself.Answer with exactly two physical lines and nothing else:-HEADLINE: <about 5 words, HARD MAXIMUM 48 characters. A self-contained \+HEADLINE: <3 to 5 words, HARD MAXIMUM 48 characters. A self-contained \navigation label for the user's problem or desired outcome, normally \"subject — result". No pane name, agent name, quotation marks, or trailing \period.>@@ -294,7 +294,7 @@ activity may follow after it if room remains."Which generic engineering activity is happening?" Use the user's vocabulary \when the original request is visible; otherwise infer the outcome cautiously \from the work.-- Aim for about 5 words. Shorter is acceptable only when the subject genuinely \+- Aim for 3 to 5 words. Fewer is acceptable only when the subject genuinely \needs fewer; never pad, never exceed 48 characters.- Keep file paths, class names, commands and implementation mechanisms OUT of \the headline. Put useful technical evidence in DETAIL instead.@@ -635,7 +635,6 @@ def refresh_soon(term: Any, *, lines: Sequence[str], folder: str = "") -> None:Never raises. Called on every pane of every poll, so a failure here would bea failure of the workspace view."""- global _inflighttry:if not _enabled():return@@ -670,19 +669,48 @@ def refresh_soon(term: Any, *, lines: Sequence[str], folder: str = "") -> None:returnexcept Exception: # noqa: BLE001 - recap never blocks a compositionlogger.debug("Agentic IDE recap: compose-busy check failed", exc_info=True)- try:- loop = asyncio.get_running_loop()- except RuntimeError:- # No event loop — a synchronous caller (a CLI state dump, a test).- # The deterministic recap is the whole answer there.+ _spawn(term, key, rows, folder)+ except Exception as exc: # noqa: BLE001 - a recap must never break a state read+ logger.debug("Agentic IDE recap: scheduling failed ({})", exc)+++def _spawn(term: Any, key: str, rows: list[str], folder: str) -> None:+ """Start :func:`_run` on the app's event loop, from whichever thread asks.++ The ``/recaps`` route is a plain ``def`` and runs in the server's worker+ threadpool (it walks every pane's replay buffer, which must not block the+ loop). A worker thread has no running loop of its own, so the old+ ``get_running_loop()`` guard returned there on every poll and no pane was+ ever summarized — every header stayed on the prompt's first words. anyio's+ ``from_thread`` hands the start back to the loop that owns the worker; the+ bookkeeping below then runs on that loop's thread, as it always did.+ """++ def start() -> None:+ global _inflight+ entry = _state(key)+ if entry.inflight or _inflight >= MAX_CONCURRENT:returnentry.inflight = True_inflight += 1- task = loop.create_task(_run(term, key, rows, folder))+ task = asyncio.get_running_loop().create_task(_run(term, key, rows, folder))_tasks.add(task)task.add_done_callback(_tasks.discard)- except Exception as exc: # noqa: BLE001 - a recap must never break a state read- logger.debug("Agentic IDE recap: scheduling failed ({})", exc)++ try:+ asyncio.get_running_loop()+ except RuntimeError:+ try:+ from anyio.from_thread import run_sync++ # Raises RuntimeError outside an anyio worker thread.+ run_sync(start)+ except RuntimeError:+ # No event loop anywhere — a synchronous caller (a CLI state dump,+ # a test). The deterministic recap is the whole answer there.+ return+ return+ start()async def _run(term: Any, key: str, rows: list[str], folder: str) -> None:diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.title.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.title.test.tsxnew file mode 100644index 0000000000..63119fbc4d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.title.test.tsx@@ -0,0 +1,35 @@+import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it } from "vitest";+import type { TerminalRecap } from "@/lib/agenticIdeApi";+import { useEventStore } from "@/store/events";+import { usePaneRecapsStore } from "@/store/paneRecaps";+import { useWorkspacePanesStore } from "@/store/workspacePanes";+import { WorkspaceTerminalHeader } from "./WorkspaceTerminalHeader";++const BASE = { name: "T3", workspaceId: "w1", agent: "codex", displayName: "Codex", appearance: "dark" as const, status: "live" as const };++beforeEach(() => {+ // Off the IDE section, so the shared recap poll never fetches in a test.+ useEventStore.setState({ activeSection: "chats" });+ usePaneRecapsStore.setState({ workspaceId: null, byName: {} });+ useWorkspacePanesStore.setState({ panes: [] });+});+afterEach(cleanup);++describe("pane header title", () => {+ it("shows the pane's short goal instead of its call-sign", () => {+ usePaneRecapsStore.setState({+ workspaceId: "w1",+ byName: { T3: { recap: "Release pipeline — green CI", source: "model" } as TerminalRecap },+ });+ render(<WorkspaceTerminalHeader {...BASE} />);+ const title = screen.getByTestId("pane-title-T3");+ expect(title.textContent).toBe("Release pipeline — green CI");+ expect(title.getAttribute("title")).toContain("T3");+ });++ it("keeps the call-sign while nothing names the work yet", () => {+ render(<WorkspaceTerminalHeader {...BASE} />);+ expect(screen.getByTestId("pane-title-T3").textContent).toBe("T3");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsxindex 26dbcb52b9..361079a855 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx@@ -2,6 +2,7 @@ import { useEffect, useId, useLayoutEffect, useRef, useState, type ComponentTypeimport { createPortal } from "react-dom";import { Check, Maximize2, Minimize2, MoreHorizontal, Plus, X } from "lucide-react";import { AgentMark } from "./AgentMark";+import { usePaneTitle } from "@/store/paneRecaps";import { PromptHistoryButton } from "./PromptHistoryButton";import { SplitAboveIcon, SplitBelowIcon, SplitLeftIcon, SplitRightIcon } from "./splitIcons";import { PANE_BRAND, PANE_CHROME, themeFor, type PaneEdgeState, type TerminalAppearance } from "./terminalThemes";@@ -50,6 +51,9 @@ export function WorkspaceTerminalHeader({onAdd, onClose, onRename, onOpenConversation, onOpenChat, onRestart,}: Props) {const brand = PANE_BRAND[appearance];+ // The pane's goal in a few words, in place of its call-sign; the call-sign+ // stays reachable in the tooltip, the accessible name and the rename field.+ const title = usePaneTitle(workspaceId, name);const chrome = PANE_CHROME[appearance];const theme = themeFor(appearance);const menuId = useId();@@ -142,7 +146,7 @@ export function WorkspaceTerminalHeader({style={{ background: status === "live" ? theme.green : status === "error" ? theme.red : status === "connecting" ? theme.yellow : brand.inkFaint }} /><AgentMark agent={agent} label={displayName} logoUrl={agentLogoUrl} variant="plain" size="sm"className="!text-[color:var(--pane-ink)] [&>.bg-foreground]:!bg-[color:var(--pane-ink)]" />- <span className="truncate">{name}</span>+ <span data-testid={`pane-title-${name}`} title={title ? `${title} (${name})` : name} className="truncate">{title || name}</span></button> : <form data-header-control="true" className="flex min-w-0 flex-1 items-center gap-1"onSubmit={(event) => { event.preventDefault(); void commitRename(); }}><input autoFocus aria-label={`Name for ${name}`} value={draft} maxLength={40} disabled={saving}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.test.tsxindex 56e86a54f0..dbf6beb004 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.test.tsx@@ -4,6 +4,8 @@ import { AgentsOverview } from "./AgentsOverview";import { useIdeChatStore } from "@/store/ideChat";import { useIdeProjectsStore } from "@/store/ideProjects";import { useIdeSidePanelStore } from "@/store/ideSidePanel";+import { usePaneRecapsStore } from "@/store/paneRecaps";+import type { TerminalRecap } from "@/lib/agenticIdeApi";import { resetWorkspacePanesPoll, useWorkspacePanesStore } from "@/store/workspacePanes";import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";@@ -41,6 +43,7 @@ function pane(name: string, workspaceId: string, overrides: Partial<WorkspacePanbeforeEach(() => {resetWorkspacePanesPoll();useIdeSidePanelStore.setState({ spotlight: null });+ usePaneRecapsStore.setState({ workspaceId: null, byName: {}, load: async () => {} });useWorkspacePanesStore.setState({panes: [pane("T1", "w1", { activity: "working" }),@@ -75,6 +78,17 @@ beforeEach(() => {afterEach(cleanup);describe("AgentsOverview", () => {+ it("titles a card with the model's short goal instead of the call-sign", () => {+ usePaneRecapsStore.setState({+ workspaceId: "w1",+ byName: { T2: { recap: "Login flow — flaky tests", source: "model" } as TerminalRecap },+ });+ render(<AgentsOverview />);+ const rows = screen.getAllByTestId("ide-workspace-agent-row");+ expect(rows[1].querySelector('[data-testid="ide-agent-title"]')?.textContent).toBe("Login flow — flaky tests");+ expect(rows[1].textContent).not.toContain("T2");+ });+it("lists only the active workspace agents with names and live dots", () => {render(<AgentsOverview />);const rows = screen.getAllByTestId("ide-workspace-agent-row");@@ -83,7 +97,6 @@ describe("AgentsOverview", () => {expect(rows[0].getAttribute("data-kind")).toBe("working");expect(rows[1].getAttribute("data-kind")).toBe("waiting");expect(rows[2].getAttribute("data-kind")).toBe("idle");- expect(rows[0].textContent).toContain("T1");expect(rows[0].textContent).toContain("Claude Code");expect(rows[0].querySelector('[data-testid="agent-mark-claude"]')).not.toBeNull();expect(rows[1].querySelector('[data-testid="agent-mark-codex"]')).not.toBeNull();@@ -158,7 +171,7 @@ describe("AgentsOverview", () => {render(<AgentsOverview />);const row = screen.getByTestId("ide-workspace-agent-row");expect(screen.getByTestId("ide-agent-state").textContent).toBe("Working · 3m");- expect(screen.getByTestId("ide-agent-task").textContent).toBe("Fix the login test");+ expect(screen.getByTestId("ide-agent-title").textContent).toBe("Fix the login test");expect(row.textContent).toMatch(/Last output \d+s ago/);});});diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.tsxindex 5b4f885494..175bcec775 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/AgentsOverview.tsx@@ -7,7 +7,7 @@ import { useIdeProjectsStore } from "@/store/ideProjects";import { useIdeSidePanelStore } from "@/store/ideSidePanel";import { useWorkspacePanes } from "@/store/workspacePanes";import { AgentMark } from "@/components/agentic/AgentMark";-import { sessionTitle } from "@/components/agentic/sessionTitle";+import { paneTitleFrom, usePaneRecapPoll, usePaneRecapsStore } from "@/store/paneRecaps";import {DOT_STYLE,SUMMARY_ORDER,@@ -56,6 +56,8 @@ export function AgentsOverview() {const spotlight = useIdeSidePanelStore((state) => state.spotlight);const setSpotlight = useIdeSidePanelStore((state) => state.setSpotlight);const panes = useWorkspacePanes();+ usePaneRecapPoll();+ const recaps = usePaneRecapsStore((state) => state);const mine = workspaceAgents(panes, activeWorkspaceId);const counts = new Map<AgentDotKind, number>();@@ -118,27 +120,28 @@ export function AgentsOverview() {spotlight !== null && spotlight.workspaceId === pane.workspace_id && spotlight.pane === pane.name;const since = compactSince(pane.activity_since, now);const lastOutput = compactSince(pane.last_output_at, now);- const title = sessionTitle(pane);- const hasTitle = title !== cli && title !== pane.name;+ const recap = recaps.workspaceId === pane.workspace_id ? recaps.byName[pane.name] : undefined;+ const title = paneTitleFrom(recap, pane);return (<li key={pane.history_id}><buttontype="button"onClick={() => pick(pane)}- aria-label={`${pane.name}, ${cli}, ${stateLabel}`}+ aria-label={`${title || pane.name}, ${cli}, ${stateLabel}`}+ title={title ? `${title} (${pane.name})` : pane.name}aria-current={selected ? "true" : undefined}data-testid="ide-workspace-agent-row"data-pane={pane.name}data-kind={kind}className={cn(- "group flex w-full flex-col gap-2.5 rounded-xl border p-3 text-left transition-[border-color,background-color,box-shadow] duration-150",+ "group flex w-full items-center rounded-xl border p-3 text-left transition-[border-color,background-color,box-shadow] duration-150","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",selected? "border-accent bg-accent/[0.06] ring-1 ring-accent/40": "border-border/60 bg-background/40 hover:border-border hover:bg-muted/50",)}>- <span className="flex w-full items-center gap-3">+ <span className="flex w-full items-start gap-3"><span className="relative shrink-0"><AgentMark agent={pane.agent} label={cli} size="md" /><span@@ -151,16 +154,18 @@ export function AgentsOverview() {<span className={cn("relative h-2 w-2 rounded-full", style.dot)} /></span></span>- <span className="flex min-w-0 flex-1 flex-col">- <span className="flex min-w-0 items-baseline gap-2">- <span className="shrink-0 text-sm font-semibold text-foreground">{pane.name}</span>- <span className="min-w-0 truncate text-xs text-muted-foreground">{cli}</span>+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">+ <span+ data-testid="ide-agent-title"+ className="line-clamp-2 text-sm font-semibold leading-snug text-foreground"+ >+ {title || cli}+ </span>+ <span className="truncate text-[11px] tabular-nums text-muted-foreground">+ {[title ? cli : "", lastOutput ? fill(t("ide_side_panel.agents.last_output"), { time: lastOutput }) : ""]+ .filter(Boolean)+ .join(" · ")}</span>- {lastOutput && (- <span className="text-[11px] tabular-nums text-muted-foreground">- {fill(t("ide_side_panel.agents.last_output"), { time: lastOutput })}- </span>- )}</span><spandata-testid="ide-agent-state"@@ -174,14 +179,6 @@ export function AgentsOverview() {{since && <span className="opacity-70"> · {since}</span>}</span></span>- {hasTitle && (- <span- data-testid="ide-agent-task"- className="line-clamp-2 w-full border-t border-border/50 pt-2 text-[13px] leading-snug text-foreground/85"- >- {title}- </span>- )}</button></li>);diff --git a/jarvis/ui/web/frontend/src/store/paneRecaps.test.ts b/jarvis/ui/web/frontend/src/store/paneRecaps.test.tsnew file mode 100644index 0000000000..3cf832c607--- /dev/null+++ b/jarvis/ui/web/frontend/src/store/paneRecaps.test.ts@@ -0,0 +1,23 @@+import { describe, expect, it } from "vitest";+import { paneTitleFrom } from "./paneRecaps";++const row = { recap: "", last_prompt: "", display_name: "Claude Code", name: "T1" };++describe("paneTitleFrom", () => {+ it("prefers a title the model or the user wrote", () => {+ expect(paneTitleFrom({ recap: "Release pipeline — green CI", source: "model" }, row)).toBe("Release pipeline — green CI");+ expect(paneTitleFrom({ recap: "Demo branch", source: "user" }, row)).toBe("Demo branch");+ });++ it("ignores the screen-derived line and falls back to the pane's topic", () => {+ const asked = { ...row, last_prompt: "Fix the failing login test" };+ expect(paneTitleFrom({ recap: "Claude Code — running since 17:22", source: "heuristic" }, asked)).toBe(+ "Fix the failing login test",+ );+ });++ it("answers empty for a pane nobody asked anything, so the call-sign shows", () => {+ expect(paneTitleFrom(undefined, row)).toBe("");+ expect(paneTitleFrom(undefined, undefined)).toBe("");+ });+});diff --git a/jarvis/ui/web/frontend/src/store/paneRecaps.ts b/jarvis/ui/web/frontend/src/store/paneRecaps.tsnew file mode 100644index 0000000000..938eb81748--- /dev/null+++ b/jarvis/ui/web/frontend/src/store/paneRecaps.ts@@ -0,0 +1,101 @@+import { useEffect } from "react";+import { create } from "zustand";++import { fetchTerminalRecaps, type TerminalRecap } from "@/lib/agenticIdeApi";+import { useEventStore } from "@/store/events";+import { useWorkspacePanesStore } from "@/store/workspacePanes";+import { sessionTitle } from "@/components/agentic/sessionTitle";++/**+ * Every pane's short title — a few words naming its goal — for the workspace+ * on screen.+ *+ * The titles come from `/recaps`: a model reads each pane and writes a 3–5+ * word navigation label (`recap_engine`). That poll is also the ONLY thing+ * that asks the backend to write those labels at all — the summarizer runs+ * because somebody is looking — so the grid headers and the side panel share+ * one reference-counted poll here rather than each running their own.+ *+ * It polls only while the Agentic IDE is the section on screen: the view stays+ * mounted when hidden, and a hidden workspace needs no fresh titles.+ */+const RECAP_POLL_MS = 8000;+/** Spread so several windows never fire on the same tick (AP-33). */+const RECAP_JITTER_MS = 1500;++interface PaneRecapsState {+ workspaceId: string | null;+ byName: Record<string, TerminalRecap>;+ load: () => Promise<void>;+}++export const usePaneRecapsStore = create<PaneRecapsState>((set) => ({+ workspaceId: null,+ byName: {},+ load: async () => {+ try {+ const answer = await fetchTerminalRecaps();+ const byName: Record<string, TerminalRecap> = {};+ for (const row of answer.terminals) byName[row.name] = row;+ set({ workspaceId: answer.workspace_id, byName });+ } catch {+ /* keep the last titles; the next tick tries again */+ }+ },+}));++let watchers = 0;+let timer: number | null = null;++function tick(): void {+ if (useEventStore.getState().activeSection === "agentic-ide") {+ void usePaneRecapsStore.getState().load();+ }+ timer = window.setTimeout(tick, RECAP_POLL_MS + Math.random() * RECAP_JITTER_MS);+}++/** Subscribe to the shared recap poll for as long as the caller is mounted. */+export function usePaneRecapPoll(): void {+ useEffect(() => {+ watchers += 1;+ if (timer === null) tick();+ return () => {+ watchers -= 1;+ if (watchers <= 0 && timer !== null) {+ window.clearTimeout(timer);+ timer = null;+ }+ };+ }, []);+}++/**+ * The words a pane is labelled with instead of its call-sign.+ *+ * A title the user pinned or the model wrote wins. Before one exists, the+ * pane's own topic (`sessionTitle`: its last prompt, the message that opened+ * the conversation) stands in; a pane that was never asked anything has no+ * topic, and "" tells the caller to fall back to the call-sign.+ */+export function paneTitleFrom(+ recap: Pick<TerminalRecap, "recap" | "source"> | undefined,+ row: Parameters<typeof sessionTitle>[0] | undefined,+): string {+ const written = (recap?.recap ?? "").trim();+ if (written && (recap?.source === "model" || recap?.source === "user")) return written;+ if (!row) return "";+ const topic = sessionTitle(row).trim();+ return topic && topic !== row.display_name && topic !== row.name ? topic : "";+}++/** One pane's title, live: the shared recap poll plus the pane list's topic. */+export function usePaneTitle(workspaceId: string | undefined, name: string): string {+ usePaneRecapPoll();+ const recap = usePaneRecapsStore((state) =>+ !workspaceId || state.workspaceId === workspaceId ? state.byName[name] : undefined,+ );+ const row = useWorkspacePanesStore((state) =>+ state.panes.find((pane) => pane.name === name && (!workspaceId || pane.workspace_id === workspaceId)),+ );+ return paneTitleFrom(recap, row);+}diff --git a/tests/unit/agentic_ide/test_recap_engine.py b/tests/unit/agentic_ide/test_recap_engine.pyindex 779df6ae0c..04e8bbfea4 100644--- a/tests/unit/agentic_ide/test_recap_engine.py+++ b/tests/unit/agentic_ide/test_recap_engine.py@@ -319,6 +319,29 @@ def test_scheduling_outside_an_event_loop_is_a_no_op() -> None:assert recap_engine.recap_for(_pane(lines=40), lines=[]).source == recap_engine.BY_RULES+def test_a_poll_from_a_worker_thread_still_reaches_the_model(monkeypatch) -> None:+ """``/recaps`` is a plain ``def`` served from the threadpool, with no loop+ of its own; the summary must still start on the app's loop. Before this,+ every poll returned early there and no pane was ever summarized."""+ import anyio.to_thread++ monkeypatch.setattr(recap_engine, "_enabled", lambda: True)++ async def answer(*_args: object, **_kwargs: object) -> recap_engine.SmartRecap:+ return recap_engine.SmartRecap("Login tests — three failing", "Three fail.")++ monkeypatch.setattr(recap_engine, "summarize_with_model", answer)+ term = _pane(lines=40)++ async def scenario() -> None:+ await anyio.to_thread.run_sync(lambda: recap_engine.refresh_soon(term, lines=_rows(40)))+ # The fake answers at once, so the task may already be done here.+ await asyncio.gather(*list(recap_engine._tasks)) # noqa: SLF001++ asyncio.run(scenario())+ assert recap_engine.recap_for(term, lines=[]).headline == "Login tests — three failing"++def test_scheduling_never_raises(monkeypatch) -> None:"""A recap must never be the thing that breaks a workspace read."""@@ -364,7 +387,7 @@ def test_the_headline_prompt_front_loads_the_first_two_words() -> None:system = recap_engine._SYSTEM # noqa: SLF001 - the contract under testassert "FIRST TWO WORDS" in system- assert "about 5 words" in system+ assert "3 to 5 words" in systemassert '"Code Review"' in system # named as a banned openerassert "Pane titles review — 6 findings" in system # ...and its repair