The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): clear unread dot on tile open + add mark-as-read actions
gitong1abeddacc1e4
diff --git a/apps/desktop/src/app/chat/sidebar/index.tsx b/apps/desktop/src/app/chat/sidebar/index.tsxindex fc9d1f36091..1cb5cbc5901 100644--- a/apps/desktop/src/app/chat/sidebar/index.tsx+++ b/apps/desktop/src/app/chat/sidebar/index.tsx@@ -116,6 +116,8 @@ import {$sessionProfilesTruncated,$sessions,$sessionsLoading,+ $unreadFinishedSessionIds,+ markAllSessionsRead,sessionPinId,setCurrentCwd} from '@/store/session'@@ -365,6 +367,7 @@ export function ChatSidebar({const messagingTruncated = useStore($messagingTruncated)const sessionsLoading = useStore($sessionsLoading)const sessionProfilesTruncated = useStore($sessionProfilesTruncated)+ const unreadCount = useStore($unreadFinishedSessionIds).lengthconst profiles = useStore($profiles)const profileColors = useStore($profileColors)const profileScope = useStore($profileScope)@@ -1643,7 +1646,24 @@ export function ChatSidebar({grouping={showArchived || rankedGlobally ? 'none' : grouping === 'status' ? 'status' : 'date'}groups={displayAgentGroups}headerAction={- inProject && enteredProject ? (+ <>+ {unreadCount > 0 && (+ <Tip label={s.markAllRead}>+ <Button+ aria-label={s.markAllRead}+ className={HEADER_ACTION_BTN}+ onClick={event => {+ event.stopPropagation()+ markAllSessionsRead()+ }}+ size="icon-xs"+ variant="ghost"+ >+ <Codicon name="check-all" size="0.75rem" />+ </Button>+ </Tip>+ )}+ {inProject && enteredProject ? (<div className="group/workspace flex shrink-0 items-center gap-0.5">{enteredProject.path && <StartWorkButton repoPath={enteredProject.path} />}{/* Home has no folder and no record to rename, theme, or delete. */}@@ -1699,7 +1719,8 @@ export function ChatSidebar({<SidebarFilterMenu className={HEADER_NAV_BTN} /></div></div>- )+ )}+ </>}label={sessionsLabel}labelMeta={diff --git a/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx b/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsxindex 45ee1221e86..031d1825742 100644--- a/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx+++ b/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx@@ -50,6 +50,7 @@ vi.mock('@/i18n', () => ({deleted: 'Session deleted',export: 'Export',hideTabBar: 'Hide tab bar',+ markRead: 'Mark as read',pin: 'Pin',rename: 'Rename',renameDesc: 'Leave empty to clear.',@@ -81,6 +82,8 @@ vi.mock('@/store/session', () => ({$connection: atom<null | { mode: string }>(null),$selectedStoredSessionId: atom<null | string>(null),$sessions: atom<unknown[]>([]),+ $unreadFinishedSessionIds: atom<string[]>([]),+ markSessionRead: vi.fn(),sessionMatchesStoredId: vi.fn(() => false),sessionPinId: vi.fn((s: { id: string }) => s.id),setSessions: vi.fn()diff --git a/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx b/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsxindex 80cddc5f06f..30905f8d88c 100644--- a/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx+++ b/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx@@ -44,6 +44,8 @@ import {$connection,$selectedStoredSessionId,$sessions,+ $unreadFinishedSessionIds,+ markSessionRead,sessionMatchesStoredId,sessionPinId,setSessions@@ -210,6 +212,9 @@ function useSessionActions({const tiles = useStore($sessionTiles)const selectedStoredSessionId = useStore($selectedStoredSessionId)const isRemote = useStore($connection)?.mode === 'remote'+ // The row's finished-unread dot is cleared by opening the session (main or+ // tile) — this menu item is the explicit escape hatch for the rest.+ const isUnread = useStore($unreadFinishedSessionIds).includes(sessionId)// Already showing as a tab somewhere (a tile, or loaded in main — main IS// a tab): offering "Open in new tab" again is noise.@@ -297,7 +302,22 @@ function useSessionActions({triggerHaptic('selection')onPin?.()}- })+ }),+ // Only meaningful for a row still carrying the finished-unread dot; once+ // read (or never unread) the item vanishes.+ ...(isUnread+ ? [+ spec({+ disabled: !sessionId,+ icon: 'check-all',+ label: r.markRead,+ onSelect: () => {+ triggerHaptic('selection')+ markSessionRead(sessionId)+ }+ })+ ]+ : [])]// WORK — derive/extract from the session.diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 1b9918f63fd..5130b6635f9 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -2041,6 +2041,7 @@ export const en: Translations = {openInSplit: 'Open in split',copyIdFailed: 'Could not copy session ID',sessionActions: 'Session actions',+ markRead: 'Mark as read',sessionRunning: 'Session running',needsInput: 'Needs your input',waitingForAnswer: 'Waiting for your answer',@@ -2076,7 +2077,8 @@ export const en: Translations = {statusDivider: {working: 'Working',done: 'Done'- }+ },+ markAllRead: 'Mark all as read'},composer: {diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 835b8d664f0..f92821a94af 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -1723,6 +1723,7 @@ export interface Translations {openInSplit: stringcopyIdFailed: stringsessionActions: string+ markRead: stringsessionRunning: stringneedsInput: stringwaitingForAnswer: string@@ -1759,6 +1760,7 @@ export interface Translations {working: stringdone: string}+ markAllRead: string}composer: {diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 38ab74fe474..0ef2e560574 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -2228,6 +2228,7 @@ export const zh: Translations = {copyIdFailed: '无法复制会话 ID',sessionActions: '会话操作',+ markRead: '标记为已读',sessionRunning: '会话运行中',needsInput: '需要你输入',waitingForAnswer: '正在等待你的回答',@@ -2263,7 +2264,8 @@ export const zh: Translations = {statusDivider: {working: '进行中',done: '已完成'- }+ },+ markAllRead: '全部标记为已读'},composer: {diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.tsindex e1eb31fb419..d82e54ad52a 100644--- a/apps/desktop/src/store/session-states.ts+++ b/apps/desktop/src/store/session-states.ts@@ -39,6 +39,7 @@ import {$sessions,$unreadFinishedSessionIds,lineageAliases,+ markSessionRead,sessionMatchesStoredId,setActiveSessionStoredIdRotation,setSessions@@ -666,6 +667,12 @@ export function openSessionTile() {const tiles = $sessionTiles.get()+ // Opening a session in a tab/tile is "reading" it — clear its unread dot+ // exactly like main-thread resume does. Previously only+ // setSelectedStoredSessionId cleared unread, so tile-opened sessions kept+ // their green dot even while the user was reading them.+ markSessionRead(storedSessionId)+if (storedSessionId === $selectedStoredSessionId.get()) {return}diff --git a/apps/desktop/src/store/session.ts b/apps/desktop/src/store/session.tsindex 499604f28df..8930e07f324 100644--- a/apps/desktop/src/store/session.ts+++ b/apps/desktop/src/store/session.ts@@ -686,8 +686,19 @@ export const setActiveSessionStoredIdRotation = (next: Updater<ActiveSessionStor// session-states.ts (live busy→idle edge), cleared here on session open.export const $unreadFinishedSessionIds = atom<string[]>([])-export const markAllSessionsRead = () => {- if ($unreadFinishedSessionIds.get().length) {+/** A session is "read" the moment the user opens it — main-thread resume AND+ * tile/tab open both call this, so the green dot can't stick while the user+ * is looking at the session. */+export function markSessionRead(storedSessionId: string) {+ if ($unreadFinishedSessionIds.get().includes(storedSessionId)) {+ $unreadFinishedSessionIds.set($unreadFinishedSessionIds.get().filter(x => x !== storedSessionId))+ }+}++/** Sidebar "mark all as read" — clears every finished-unread dot. Purely+ * renderer-local, like the atom itself. */+export function markAllSessionsRead() {+ if ($unreadFinishedSessionIds.get().length > 0) {$unreadFinishedSessionIds.set([])}}@@ -697,8 +708,8 @@ export const setSelectedStoredSessionId = (next: Updater<string | null>) => {// Opening a session clears its unread state — the user is now looking at it.const id = $selectedStoredSessionId.get()- if (id && $unreadFinishedSessionIds.get().includes(id)) {- $unreadFinishedSessionIds.set($unreadFinishedSessionIds.get().filter(x => x !== id))+ if (id) {+ markSessionRead(id)}}