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.

feat(agentic-ide): name threads by their topic when the CLI does not

rubenluetke10-beep394df617e4a5
diff --git a/jarvis/ui/web/agent_chat_routes.py b/jarvis/ui/web/agent_chat_routes.py
index 04fe171244..cd25756408 100644
--- a/jarvis/ui/web/agent_chat_routes.py
+++ b/jarvis/ui/web/agent_chat_routes.py
@@ -789,7 +789,7 @@ def list_sessions(
d["pending_approvals"] = svc.pending_approvals(s.session_id)
d["cli_title"] = _cli_title(svc, s)
out.append(d)
- _title_jarvis_chats(request, svc, out)
+ _title_chats(request, svc, out)
return {"sessions": out}
@@ -816,12 +816,14 @@ def _cli_title(svc: Any, session: Any) -> str:
return title
-def _title_jarvis_chats(request: Request, svc: Any, rows: list[dict[str, Any]]) -> None:
- """Give the Jarvis chats a topic title instead of their first words.
+def _title_chats(request: Request, svc: Any, rows: list[dict[str, Any]]) -> None:
+ """Give the Jarvis chats and the IDE's threads a topic title, not their first words.
- Only the ``jarvis`` surface — the front page's own history — is retitled;
- an agent's chat keeps the title its first message gave it. A title the user
- typed is recognised by the titler and kept.
+ The ``jarvis`` surface — the front page's own history — and the ``agent``
+ surface — the IDE's threads — are retitled. A thread whose coding CLI named
+ the conversation itself keeps that name (``cli_title``); Claude Code in
+ print mode never writes one, so most threads are named here. A title the
+ user typed is recognised by the titler and kept.
"""
from jarvis.agent_chat.store import _title_from
from jarvis.sessions import chat_titles
@@ -829,7 +831,8 @@ def _title_jarvis_chats(request: Request, svc: Any, rows: list[dict[str, Any]])
now = int(time.time() * 1000)
requests: list[chat_titles.TitleRequest] = []
for row in rows:
- if row.get("surface") != "jarvis":
+ surface = row.get("surface")
+ if not (surface == "jarvis" or (surface == "agent" and not row.get("cli_title"))):
continue
sid = str(row["session_id"])
@@ -867,7 +870,9 @@ def _title_jarvis_chats(request: Request, svc: Any, rows: list[dict[str, Any]])
return
for row in rows:
key = (chat_titles.KIND_TYPED, str(row["session_id"]))
- if key in titles:
+ # A Jarvis chat with no topic shows as what it is ("Voice chat · 09:42");
+ # a thread keeps its first message rather than an empty row.
+ if key in titles and (titles[key] or row.get("surface") == "jarvis"):
row["title"] = titles[key]
diff --git a/tests/unit/agentic_ide/test_thread_mode.py b/tests/unit/agentic_ide/test_thread_mode.py
index 106e047f67..dadfa16a1f 100644
--- a/tests/unit/agentic_ide/test_thread_mode.py
+++ b/tests/unit/agentic_ide/test_thread_mode.py
@@ -136,6 +136,32 @@ def test_the_thread_list_offers_the_cli_title_until_the_person_renames(
assert row["cli_title"] == ""
+def test_a_thread_the_cli_did_not_name_gets_a_topic_title(tmp_path, monkeypatch) -> None:
+ from jarvis.sessions import chat_titles
+
+ class _Titler:
+ def titles_for(self, requests):
+ return {(r.kind, r.conv_id): "Thread mode titles" for r in requests}
+
+ monkeypatch.setattr(chat_titles, "titler_for_state", lambda state: _Titler())
+ monkeypatch.setattr(cli_title, "session_title", lambda *args, **kwargs: "")
+ app, service = _chat_app(tmp_path)
+ session = service.store.create_session(
+ provider="claude-api",
+ model="",
+ effort="",
+ cwd=str(tmp_path),
+ permission_mode="default",
+ surface="agent",
+ )
+ service.store.append_event(
+ session.session_id, make_event("user_message", {"text": "Hallo, ich möchte Titel"})
+ )
+ with TestClient(app) as client:
+ row = client.get("/api/agent-chat/sessions?surface=agent").json()["sessions"][0]
+ assert row["title"] == "Thread mode titles"
+
+
def test_the_front_page_list_is_left_alone(tmp_path, monkeypatch) -> None:
monkeypatch.setattr(cli_title, "session_title", lambda *args, **kwargs: "never")
app, service = _chat_app(tmp_path)
@@ -147,7 +173,7 @@ def test_the_front_page_list_is_left_alone(tmp_path, monkeypatch) -> None:
permission_mode="",
surface="jarvis",
)
- monkeypatch.setattr("jarvis.ui.web.agent_chat_routes._title_jarvis_chats", lambda *args: None)
+ monkeypatch.setattr("jarvis.ui.web.agent_chat_routes._title_chats", lambda *args: None)
with TestClient(app) as client:
row = client.get("/api/agent-chat/sessions?surface=jarvis").json()["sessions"][0]
assert "cli_title" not in row