Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): keep one status mark in the tab strip (#6740)

Louis Beaumontec7594a45255
diff --git a/.github/pr-assets/chat-tab-status-dot/after-dark.png b/.github/pr-assets/chat-tab-status-dot/after-dark.png
new file mode 100644
index 000000000..79d9d164a
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-dark.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after-error.png b/.github/pr-assets/chat-tab-status-dot/after-error.png
new file mode 100644
index 000000000..0610994b2
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-error.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after-split.png b/.github/pr-assets/chat-tab-status-dot/after-split.png
new file mode 100644
index 000000000..ad44fc0fd
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-split.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after-status-wins.png b/.github/pr-assets/chat-tab-status-dot/after-status-wins.png
new file mode 100644
index 000000000..47a89c0b2
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-status-wins.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after-unread.png b/.github/pr-assets/chat-tab-status-dot/after-unread.png
new file mode 100644
index 000000000..a57ff593a
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-unread.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after-working.png b/.github/pr-assets/chat-tab-status-dot/after-working.png
new file mode 100644
index 000000000..4bda43770
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-working.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after-worktree.png b/.github/pr-assets/chat-tab-status-dot/after-worktree.png
new file mode 100644
index 000000000..b38f84af5
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after-worktree.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/after.png b/.github/pr-assets/chat-tab-status-dot/after.png
new file mode 100644
index 000000000..5a81bcfa4
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/after.png differ
diff --git a/.github/pr-assets/chat-tab-status-dot/before.png b/.github/pr-assets/chat-tab-status-dot/before.png
new file mode 100644
index 000000000..c617b362d
Binary files /dev/null and b/.github/pr-assets/chat-tab-status-dot/before.png differ
diff --git a/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.test.tsx b/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.test.tsx
index 74258ab8e..10529792d 100644
--- a/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.test.tsx
@@ -303,4 +303,92 @@ describe("ChatTabStrip", () => {
"isolated fix · worktree · screenpipe",
);
});
+
+ it("hides the unread dot on the active tab and keeps it on background tabs", () => {
+ const actions = useChatStore.getState().actions;
+ actions.upsert(
+ record({
+ id: "chat-a",
+ title: "front",
+ lastContentAt: 20,
+ lastViewedAt: 1,
+ }),
+ );
+ actions.upsert(
+ record({
+ id: "chat-b",
+ title: "background",
+ lastContentAt: 20,
+ lastViewedAt: 1,
+ }),
+ );
+ actions.openChat("chat-a");
+ actions.openChat("chat-b");
+
+ render(
+ <ChatTabStrip
+ activeId="chat-a"
+ onActivate={vi.fn()}
+ onNewChat={vi.fn()}
+ />,
+ );
+
+ expect(useChatStore.getState().sessions["chat-a"].unread).toBe(true);
+ expect(useChatStore.getState().sessions["chat-b"].unread).toBe(true);
+ expect(screen.queryByLabelText("unread")).toBeInTheDocument();
+ expect(
+ screen.getByRole("tab", { name: "front" }).querySelector("[aria-label='unread']"),
+ ).toBeNull();
+ expect(
+ screen.getByRole("tab", { name: "background" }).querySelector("[aria-label='unread']"),
+ ).not.toBeNull();
+ });
+
+ it("shows the working dot instead of the worktree icon while a worktree chat runs", () => {
+ const actions = useChatStore.getState().actions;
+ actions.upsert(
+ record({
+ id: "chat-a",
+ title: "isolated fix",
+ status: "streaming",
+ codingWorkspace: {
+ repoName: "screenpipe",
+ branch: "screenpipe/chat-chat-a",
+ worktreePath: "/worktrees/chat-a",
+ },
+ }),
+ );
+ actions.openChat("chat-a");
+
+ render(
+ <ChatTabStrip
+ activeId="chat-a"
+ onActivate={vi.fn()}
+ onNewChat={vi.fn()}
+ />,
+ );
+
+ expect(screen.getByLabelText("working")).toBeInTheDocument();
+ expect(screen.queryByTestId("chat-tab-worktree-chat-a")).not.toBeInTheDocument();
+ });
+
+ it("keeps the working dot on a split tab instead of replacing it with the split icon", () => {
+ const actions = useChatStore.getState().actions;
+ actions.upsert(record({ id: "chat-a", title: "primary" }));
+ actions.upsert(record({ id: "chat-b", title: "secondary", status: "thinking" }));
+ actions.openChat("chat-a");
+ actions.openChat("chat-b");
+ actions.setSplitChat("chat-b");
+
+ render(
+ <ChatTabStrip
+ activeId="chat-a"
+ onActivate={vi.fn()}
+ onNewChat={vi.fn()}
+ />,
+ );
+
+ expect(screen.getByLabelText("working")).toBeInTheDocument();
+ expect(screen.queryByLabelText("split pane")).not.toBeInTheDocument();
+ });
});
diff --git a/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.tsx b/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.tsx
index 009cf6e70..d0631216b 100644
--- a/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/chat-tab-strip.tsx
@@ -40,20 +40,75 @@ function visibleTabTitle(session: SessionRecord): string {
return title;
}
-function tabStatus(session: SessionRecord): {
- className: string;
- label: string;
-} | null {
- if (session.status === "error") {
- return { className: "text-destructive", label: "error" };
- }
+type TabGlyph =
+ | { kind: "error"; label: "error" }
+ | { kind: "working"; label: "working" }
+ | { kind: "unread"; label: "unread" }
+ | { kind: "worktree"; label: string }
+ | { kind: "split"; label: "split pane" };
+
+/** One left-slot mark. Status wins over worktree/split so the dot stays
+ * readable instead of stacking a branch icon on top of a 6px circle. */
+function tabGlyph(
+ session: SessionRecord,
+ active: boolean,
+ split: boolean,
+): TabGlyph | null {
+ if (session.status === "error") return { kind: "error", label: "error" };
if (["streaming", "thinking", "tool"].includes(session.status)) {
- return { className: "bg-primary animate-pulse", label: "working" };
+ return { kind: "working", label: "working" };
}
- if (session.unread) return { className: "bg-primary", label: "unread" };
+ if (session.unread && !active) return { kind: "unread", label: "unread" };
+ if (session.codingWorkspace) {
+ return {
+ kind: "worktree",
+ label: `worktree · ${session.codingWorkspace.repoName}`,
+ };
+ }
+ if (split) return { kind: "split", label: "split pane" };
return null;
}
+function TabGlyphMark({
+ glyph,
+ sessionId,
+}: {
+ glyph: TabGlyph;
+ sessionId: string;
+}) {
+ if (glyph.kind === "error") {
+ return (
+ <AlertCircle
+ aria-label={glyph.label}
+ className="h-3 w-3 text-destructive"
+ />
+ );
+ }
+ if (glyph.kind === "working" || glyph.kind === "unread") {
+ return (
+ <span
+ aria-label={glyph.label}
+ className={cn(
+ "h-1.5 w-1.5 rounded-full",
+ glyph.kind === "working"
+ ? "bg-foreground animate-pulse"
+ : "bg-foreground",
+ )}
+ />
+ );
+ }
+ if (glyph.kind === "worktree") {
+ return (
+ <GitBranch
+ aria-hidden
+ className="h-3 w-3"
+ data-testid={`chat-tab-worktree-${sessionId}`}
+ />
+ );
+ }
+ return <Columns2 aria-label={glyph.label} className="h-3 w-3" />;
+}
+
export function ChatTabStrip({
activeId,
onActivate,
@@ -171,7 +226,7 @@ export function ChatTabStrip({
const active = session.id === activeId;
const split = session.id === splitChatId;
const title = visibleTabTitle(session);
- const status = tabStatus(session);
+ const glyph = tabGlyph(session, active, split);
const codingWorkspace = session.codingWorkspace;
const temporary = isEphemeralSideConversation(session);
const hasTabsToRight = index < tabs.length - 1;
@@ -228,33 +283,10 @@ export function ChatTabStrip({
}
}}
>
- {codingWorkspace ? (
- <GitBranch
- aria-hidden
- className="h-3 w-3 shrink-0"
- data-testid={`chat-tab-worktree-${session.id}`}
- />
- ) : null}
- {split ? (
- <Columns2
- aria-label="split pane"
- className="h-3 w-3 shrink-0"
- />
- ) : status ? (
- status.label === "error" ? (
- <AlertCircle
- aria-label={status.label}
- className={cn("h-3 w-3 shrink-0", status.className)}
- />
- ) : (
- <span
- aria-label={status.label}
- className={cn(
- "h-1.5 w-1.5 shrink-0 rounded-full",
- status.className,
- )}
- />
- )
+ {glyph ? (
+ <span className="flex h-3 w-3 shrink-0 items-center justify-center">
+ <TabGlyphMark glyph={glyph} sessionId={session.id} />
+ </span>
) : null}
<span
data-testid={active ? "chat-title" : undefined}