Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(chat): keep the workspace crumb on an empty chat

v_wyxgwang4517794ca251
diff --git a/apps/desktop/src/components/ConversationTopbar.tsx b/apps/desktop/src/components/ConversationTopbar.tsx
index 6e1f99ee2..f8b217d89 100644
--- a/apps/desktop/src/components/ConversationTopbar.tsx
+++ b/apps/desktop/src/components/ConversationTopbar.tsx
@@ -57,6 +57,7 @@ export function ConversationTopbar({
const { t } = useTranslation();
const activeSessionId = useAppStore((s) => s.activeSessionId);
const sessions = useAppStore((s) => s.sessions);
+ const workspace = useAppStore((s) => s.workspace);
const projectMeta = useAppStore((s) => s.projectMeta);
const renameSession = useAppStore((s) => s.renameSession);
const showToast = useAppStore((s) => s.showToast);
@@ -205,7 +206,8 @@ export function ConversationTopbar({
* the app happens to show: a task can be opened from a project other than
* the active one. A remote session carries its display-only label; a local
* one resolves its project path through the sidebar's naming preferences,
- * and a draft-like session with no project keeps the plain title.
+ * and a temporary session keeps the plain title. Before the first prompt
+ * there is no session yet, so the active workspace names the draft.
*/
const sessionProjectPath = remoteSession ? null : activeSession?.projectPath;
const projectKey = sessionProjectPath
@@ -215,7 +217,9 @@ export function ConversationTopbar({
? activeSession?.remoteWorkspaceLabel?.trim() || null
: projectKey
? projectMeta[projectKey]?.name?.trim() || projectName(sessionProjectPath)
- : null;
+ : activeSession
+ ? null
+ : projectName(workspace?.path, workspace?.name);
const breadcrumbTitle = project
? `${project} · ${fullTaskTitle}`
: fullTaskTitle;
diff --git a/apps/desktop/test/topbar-title-rendering.test.mjs b/apps/desktop/test/topbar-title-rendering.test.mjs
index b48a83df7..81aa15928 100644
--- a/apps/desktop/test/topbar-title-rendering.test.mjs
+++ b/apps/desktop/test/topbar-title-rendering.test.mjs
@@ -123,6 +123,21 @@ test("a session without a project keeps only the title", async () => {
});
});
+test("an empty chat names the active workspace and stays read-only", async () => {
+ await withTopbar(async ({ render }) => {
+ const html = render({
+ activeSessionId: null,
+ sessions: [],
+ workspace: { path: "/workspace", name: "Workspace" },
+ });
+
+ assert.ok(html.includes('class="ct-project-name">Workspace</span>'));
+ assert.match(html, /<h1 class="ct-title">New task<\/h1>/);
+ assert.ok(html.includes('title="Workspace · New task"'));
+ assert.ok(!html.includes("ct-title-trigger"), "there is no session to rename yet");
+ });
+});
+
test("a remote session shows its remote workspace label and keeps the title read-only", async () => {
await withTopbar(async ({ render }) => {
const html = render({
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index a984f8258..d63e7a563 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -274,9 +274,11 @@ and Settings keep the frameless drag band. It owns the project breadcrumb, the
task title, and window actions only. The crumb resolves from the active
session's project — a remote session's workspace label, a local session's
project path and naming preference — and is omitted for a temporary chat with
-no project. The title follows the crumb after a `/` separator. Its full text
-remains in the native tooltip as `Project · Task title`. The Composer owns the
-Agent/Plan/Goal control and the combined model × reasoning selection (§11).
+no project. Before the first prompt there is no session yet, so the active
+workspace names the draft. The title follows the crumb after a `/` separator.
+Its full text remains in the native tooltip as `Project · Task title`. The
+Composer owns the Agent/Plan/Goal control and the combined model × reasoning
+selection (§11).
The local task title is a rename trigger. Activating it swaps the heading for a
boxless inline editor seeded with the stored title; Enter or blur commits the
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 8de54673f..181feb397 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -213,7 +213,8 @@ chrome 搜索入口;展开的侧边栏标题不再重复该控件。键盘快
对话顶部栏仅针对聊天路线呈现;定时任务、插件和设置保留无框拖带。
它仅拥有项目面包屑、任务标题和窗口操作。面包屑来自活动会话的项目:
远程会话使用远程工作区标签,本地会话使用项目路径与命名偏好,没有项目的
-临时对话省略面包屑。标题以 `/` 分隔符跟在面包屑之后;完整文本保留在
+临时对话省略面包屑。首次提示之前还没有会话,因此由活动工作区命名草稿。
+标题以 `/` 分隔符跟在面包屑之后;完整文本保留在
`项目 · 任务标题` 的本机工具提示中。Composer 拥有 Agent/Plan/Goal 控件以及
组合的模型 × 推理选择(§11)。