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(ide): thread title bar shows the CLI's title and the pane's git badges (#1125)

Ruben Lütke473928195934
diff --git a/dodaios/ui/web/agentic_ide_git_routes.py b/dodaios/ui/web/agentic_ide_git_routes.py
index eb30554bc6..277e8f6e24 100644
--- a/dodaios/ui/web/agentic_ide_git_routes.py
+++ b/dodaios/ui/web/agentic_ide_git_routes.py
@@ -43,6 +43,7 @@ from __future__ import annotations
from dataclasses import asdict
from pathlib import Path
+from typing import Any
from fastapi import APIRouter, HTTPException, Query, Request
from pydantic import BaseModel, Field
@@ -273,6 +274,72 @@ def pane_done_gate(workspace_id: str = Query(..., min_length=1)) -> dict:
return {"panes": done_gate_status.board(records)}
+#: The one entry a thread's answers are keyed by, in place of a pane's name.
+THREAD_KEY = "thread"
+
+
+def _thread_folder_and_agent(request: Request, session_id: str) -> tuple[Any, str, str] | None:
+ """An IDE thread's session, its folder and its CLI agent; None when it has no local folder."""
+ from dodaios.agent_chat.catalog import provider_row
+ from dodaios.ui.web.agent_chat_routes import _service
+
+ session = _service(request).store.get_session(session_id)
+ if session is None or session.surface != "agent":
+ raise HTTPException(status_code=404, detail="Thread not found.")
+ folder = allowed_thread_folder(session.cwd) if session.cwd else None
+ if folder is None:
+ return None
+ row = provider_row(session.provider)
+ return session, str(folder), row.agent if row is not None else ""
+
+
[email protected]("/thread-status", summary="GitHub branch, pull request and CI status of a thread")
+def thread_github_status(
+ request: Request,
+ session_id: str = Query(..., min_length=1),
+ wait: float = Query(
+ 0, ge=0, le=5, description="Seconds to wait for a read already running to finish"
+ ),
+ instant: bool = Query(
+ False, description="Answer from the last read at once; the caller asks again"
+ ),
+) -> dict:
+ """What ``/session-status`` says about a pane, for an IDE thread.
+
+ The thread's coding CLI session names the branches it worked on, the same
+ way a pane's does; the answer has one entry, under ``thread``.
+ """
+ if not instant:
+ wait = _LEGACY_WAIT_S
+ found = _thread_folder_and_agent(request, session_id)
+ if found is None:
+ return {"panes": {THREAD_KEY: None}}
+ session, folder, agent = found
+ record = PaneBranchRecord(
+ pane=THREAD_KEY,
+ history_id=session.session_id,
+ folder=folder,
+ agent=agent,
+ session_id=session.vendor_session or "",
+ home=account_home(agent, session.account_id),
+ started_at=(session.created_ms or 0) / 1000,
+ )
+ return github_status.board(f"thread:{session.session_id}", [record], wait=wait)
+
+
[email protected]("/thread-done-gate", summary="The agent done gate's last verdict for a thread")
+def thread_done_gate(request: Request, session_id: str = Query(..., min_length=1)) -> dict:
+ """What ``/done-gate`` says about a pane, for an IDE thread, under ``thread``."""
+ found = _thread_folder_and_agent(request, session_id)
+ if found is None:
+ return {"panes": {THREAD_KEY: None}}
+ session, folder, _agent = found
+ record = done_gate_status.PaneGateRecord(
+ pane=THREAD_KEY, folder=folder, session_id=session.vendor_session or ""
+ )
+ return {"panes": done_gate_status.board([record])}
+
+
# The editors a branch's checkout is offered in, when installed.
_BRANCH_EDITORS = ("code", "cursor")
diff --git a/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.test.tsx b/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.test.tsx
index 372eca56f1..3bbf597023 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.test.tsx
+++ b/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.test.tsx
@@ -10,7 +10,18 @@ vi.mock("../PaneChangesDialog", () => ({
open ? <div data-testid="thread-changes" data-folder={folder}>{title}</div> : null,
}));
+const badges = vi.hoisted(() => ({ github: { status: null as unknown, pending: false }, gate: null as unknown }));
+vi.mock("../useSessionGitHub", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../useSessionGitHub")>()),
+ useThreadGitHub: () => badges.github,
+}));
+vi.mock("../usePaneDoneGate", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../usePaneDoneGate")>()),
+ usePaneDoneGate: () => badges.gate,
+}));
+
import { ThreadHeader } from "./ThreadHeader";
+import { useThreadChatStore } from "./threadModel";
const SESSION = {
session_id: "s1",
@@ -25,6 +36,9 @@ const SESSION = {
describe("ThreadHeader", () => {
beforeEach(() => {
useNavSidebarStore.setState({ collapsed: false });
+ useThreadChatStore.setState({ sessions: [] });
+ badges.github = { status: null, pending: false };
+ badges.gate = null;
});
afterEach(cleanup);
@@ -67,4 +81,25 @@ describe("ThreadHeader", () => {
render(<ThreadHeader session={{ ...SESSION, running: true } as AgentChatSession} projectId="p1" folder="/repo" workspaceId="w1" />);
expect((screen.getByTestId("thread-header-close") as HTMLButtonElement).disabled).toBe(true);
});
+
+ it("names the thread the way the sidebar does: the coding CLI's own title", () => {
+ useThreadChatStore.setState({ sessions: [{ ...SESSION, cli_title: "Thread header polish" } as AgentChatSession] });
+ render(<ThreadHeader session={{ ...SESSION, title: "Hello, I would like you to ..." } as AgentChatSession} projectId="p1" folder="/repo" workspaceId="w1" />);
+ expect(screen.getByTestId("thread-header-title").textContent).toBe("Thread header polish");
+ });
+
+ it("shows the branch's GitHub state and the done gate's verdict like a pane", () => {
+ badges.github = {
+ status: {
+ repo: "acme/app", branch: "feat/x", url: "https://github.com/acme/app/pull/7", published: true, owned: true,
+ available: true, reason: "", fetched_at: Date.now() / 1000, state: "open", number: 7,
+ ci: { state: "success" }, ci_stale: false,
+ },
+ pending: false,
+ };
+ badges.gate = { verdict: "WAIT", reason: "CI is running", next: "", pr: 7, branch: "feat/x", at: "", matched: "session" };
+ render(<ThreadHeader session={SESSION} projectId="p1" folder="/repo" workspaceId="w1" />);
+ expect(screen.getByTestId("session-github-status").getAttribute("href")).toBe("https://github.com/acme/app/pull/7");
+ expect(screen.getByTestId("pane-done-gate-Fix the login").getAttribute("data-verdict")).toBe("WAIT");
+ });
});
diff --git a/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsx b/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsx
index d8e6f1fb08..06ddf5293e 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsx
+++ b/dodaios/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsx
@@ -8,6 +8,11 @@ import { useEventStore } from "@/store/events";
import { useIdeSidePanelStore } from "@/store/ideSidePanel";
import { useIdeThreadsStore } from "@/store/ideThreads";
import { useNavSidebarStore } from "@/store/navSidebar";
+import { useThemeValue } from "@/hooks/useTheme";
+import { DoneGateLabel } from "../PaneDoneGateBadge";
+import { GitHubStatusBadge } from "../SessionGitHubBadge";
+import { usePaneDoneGate } from "../usePaneDoneGate";
+import { THREAD_ENTRY, useThreadGitHub } from "../useSessionGitHub";
import { PaneChangesDialog } from "../PaneChangesDialog";
import { prefetchPaneChanges } from "../paneChangesApi";
import { ThreadMenuItem, ThreadMenuSeparator, ThreadPopover } from "./ThreadPopover";
@@ -52,18 +57,24 @@ export function ThreadHeader({ session, projectId, folder, workspaceId }: {
const t = useT();
const pushToast = useEventStore((state) => state.pushToast);
const catalog = useThreadChatStore((state) => state.catalog);
+ // The thread list carries the name the coding CLI gave the conversation
+ // (or the topic title); the open session alone may still hold the first message.
+ const listed = useThreadChatStore((state) => state.sessions.find((row) => row.session_id === session.session_id));
+ const appearance = useThemeValue();
+ const github = useThreadGitHub(session.session_id);
+ const gate = usePaneDoneGate(`thread:${session.session_id}`, THREAD_ENTRY);
const navCollapsed = useNavSidebarStore((state) => state.collapsed);
const [menuOpen, setMenuOpen] = useState(false);
const [renaming, setRenaming] = useState<string | null>(null);
const [changesOpen, setChangesOpen] = useState(false);
const moreRef = useRef<HTMLButtonElement | null>(null);
- const title = threadTitle(session);
+ const title = threadTitle(listed ?? session);
const mark = useMemo(() => {
const provider = catalog?.providers.find((row) => row.id === session.provider);
return provider?.agent ? { agent: provider.agent, label: provider.label } : null;
}, [catalog, session.provider]);
// Archiving a thread mid-turn or mid-approval would hide work that needs the person.
- const busy = Boolean(session.running) || Boolean(session.pending_approvals?.length);
+ const busy = Boolean((listed ?? session).running) || Boolean((listed ?? session).pending_approvals?.length);
const target = { workspaceId: workspaceId ?? "", pane: "", folder };
const rename = async (wanted: string) => {
@@ -103,6 +114,8 @@ export function ThreadHeader({ session, projectId, folder, workspaceId }: {
className="min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-0.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring" />
<button type="submit" aria-label={t("ide_threads.save_name")} className="rounded p-1 text-muted-foreground hover:text-foreground"><Check className="h-4 w-4" /></button>
</form>}
+ <DoneGateLabel gate={gate} appearance={appearance} name={title} />
+ <GitHubStatusBadge status={github.status} pending={github.pending} appearance={appearance} />
<div className="flex shrink-0 items-center gap-0.5">
<Action label={t("ide_threads.header.review_changes")} onClick={reviewChanges} disabled={!folder}
testId="thread-header-review-changes" onPointerEnter={prefetchReview}>
diff --git a/dodaios/ui/web/frontend/src/components/agentic/usePaneDoneGate.ts b/dodaios/ui/web/frontend/src/components/agentic/usePaneDoneGate.ts
index c5e4044abd..c473490a98 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/usePaneDoneGate.ts
+++ b/dodaios/ui/web/frontend/src/components/agentic/usePaneDoneGate.ts
@@ -70,8 +70,11 @@ function start(workspaceId: string): Entry {
controller = new AbortController();
const timeout = setTimeout(() => controller?.abort(), 15_000);
try {
- const query = new URLSearchParams({ workspace_id: workspaceId });
- const response = await fetch(`/api/agentic-ide/git/done-gate?${query}`, { signal: controller.signal });
+ // A thread's verdict is kept under `thread:<session id>`.
+ const thread = workspaceId.startsWith("thread:") ? workspaceId.slice("thread:".length) : "";
+ const query = new URLSearchParams(thread ? { session_id: thread } : { workspace_id: workspaceId });
+ const route = thread ? "thread-done-gate" : "done-gate";
+ const response = await fetch(`/api/agentic-ide/git/${route}?${query}`, { signal: controller.signal });
if (response.ok) {
const data = await response.json() as { panes?: unknown };
const panes = clean(data.panes);
diff --git a/dodaios/ui/web/frontend/src/components/agentic/useSessionGitHub.ts b/dodaios/ui/web/frontend/src/components/agentic/useSessionGitHub.ts
index 928e26bb1b..50e609a5b5 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/useSessionGitHub.ts
+++ b/dodaios/ui/web/frontend/src/components/agentic/useSessionGitHub.ts
@@ -78,6 +78,12 @@ const old = (readAt: number | null) => readAt === null || Date.now() - readAt >
const outdated = (status: SessionGitHubStatus | null) =>
status !== null && Date.now() - status.fetched_at * 1000 > FRESH_MS;
+/** A thread's answers are kept under `thread:<session id>`, beside the workspaces'. */
+const THREAD_PREFIX = "thread:";
+/** The single entry a thread's answer has, in place of a pane's name. */
+export const THREAD_ENTRY = "thread";
+const threadOf = (key: string) => (key.startsWith(THREAD_PREFIX) ? key.slice(THREAD_PREFIX.length) : "");
+
function start(workspaceId: string): Entry {
// What this window saw last is shown at once; once it is old it spins until
// the backend has confirmed or replaced it.
@@ -121,9 +127,11 @@ function start(workspaceId: string): Entry {
const timeout = setTimeout(() => controller?.abort(), 30_000);
try {
// `instant`: answer from the last read at once; this header asks again.
- const query = new URLSearchParams({ workspace_id: workspaceId, instant: "1" });
+ const thread = threadOf(workspaceId);
+ const query = new URLSearchParams(thread ? { session_id: thread, instant: "1" } : { workspace_id: workspaceId, instant: "1" });
if (followUps) query.set("wait", String(WAIT_S));
- const response = await fetch(`/api/agentic-ide/git/session-status?${query}`, { signal: controller.signal });
+ const route = thread ? "thread-status" : "session-status";
+ const response = await fetch(`/api/agentic-ide/git/${route}?${query}`, { signal: controller.signal });
if (!response.ok) throw new Error("GitHub status could not be refreshed.");
const data = await response.json() as {
panes: Panes; refreshing?: boolean; age?: number | null; waiting?: string[]; failed?: boolean;
@@ -238,3 +246,8 @@ export function useSessionGitHub(workspaceId?: string, pane?: string): SessionGi
export function resetSessionGitHubForTests() {
remembered.clear();
}
+
+/** The GitHub state of the branches an IDE thread's coding agent worked on. */
+export function useThreadGitHub(sessionId?: string): PaneGitHub {
+ return useSessionGitHubPane(sessionId ? `${THREAD_PREFIX}${sessionId}` : undefined, THREAD_ENTRY);
+}
diff --git a/tests/unit/agentic_ide/test_thread_mode.py b/tests/unit/agentic_ide/test_thread_mode.py
index 60e0a73339..d2c5636dd5 100644
--- a/tests/unit/agentic_ide/test_thread_mode.py
+++ b/tests/unit/agentic_ide/test_thread_mode.py
@@ -240,6 +240,82 @@ def test_the_folder_routes_read_only_connected_projects(repo: Path, tmp_path: Pa
assert diff.status_code == 403
+# ------------------------------------------------------------ title bar badges
+
+
+def test_a_thread_s_github_and_done_gate_status_read_its_cli_session(
+ repo: Path, tmp_path: Path, monkeypatch
+) -> None:
+ from dodaios.agentic_ide import done_gate_status, github_status
+
+ monkeypatch.setattr(thread_folders, "_known_roots", lambda: [repo.resolve()])
+ seen: dict[str, object] = {}
+
+ def board(key, records, *, wait=0):
+ seen["key"], seen["records"] = key, records
+ return {"panes": {"thread": None}, "refreshing": False}
+
+ def gates(records):
+ seen["gates"] = records
+ return {"thread": None}
+
+ monkeypatch.setattr(github_status, "board", board)
+ monkeypatch.setattr(done_gate_status, "board", gates)
+ app, service = _chat_app(tmp_path)
+ app.include_router(git_router)
+ session = service.store.create_session(
+ provider="claude-api",
+ model="",
+ effort="",
+ cwd=str(repo),
+ permission_mode="default",
+ surface="agent",
+ )
+ vendor = "6f1c2d1e-0000-4000-8000-000000000002"
+ service.store.update_session(session.session_id, vendor_session=vendor)
+ with TestClient(app) as client:
+ status = client.get(
+ "/api/agentic-ide/git/thread-status",
+ params={"session_id": session.session_id, "instant": "1"},
+ )
+ assert status.status_code == 200 and status.json()["panes"] == {"thread": None}
+ assert seen["key"] == f"thread:{session.session_id}"
+ (record,) = seen["records"]
+ assert (record.pane, record.agent, record.session_id) == ("thread", "claude", vendor)
+ assert Path(record.folder) == repo.resolve()
+
+ gate = client.get(
+ "/api/agentic-ide/git/thread-done-gate", params={"session_id": session.session_id}
+ )
+ assert gate.json() == {"panes": {"thread": None}}
+ (gate_record,) = seen["gates"]
+ assert gate_record.session_id == vendor
+
+ missing = client.get("/api/agentic-ide/git/thread-status", params={"session_id": "nope"})
+ assert missing.status_code == 404
+
+
+def test_a_thread_outside_a_connected_project_has_no_status(
+ repo: Path, tmp_path: Path, monkeypatch
+) -> None:
+ monkeypatch.setattr(thread_folders, "_known_roots", lambda: [])
+ app, service = _chat_app(tmp_path)
+ app.include_router(git_router)
+ session = service.store.create_session(
+ provider="claude-api",
+ model="",
+ effort="",
+ cwd=str(repo),
+ permission_mode="default",
+ surface="agent",
+ )
+ with TestClient(app) as client:
+ status = client.get(
+ "/api/agentic-ide/git/thread-status", params={"session_id": session.session_id}
+ )
+ assert status.json() == {"panes": {"thread": None}}
+
+
# ------------------------------------------------------------ terminal drawer