Skip to content

The agent that grows with you

fix(desktop): reveal is hidden per focused workspace and the Projects menu toasts a missing path

teknium1d147a3794b8c
diff --git a/apps/desktop/src/app/chat/sidebar/projects/project-menu.tsx b/apps/desktop/src/app/chat/sidebar/projects/project-menu.tsx
index 8e8677b9ca7..1046f4ae893 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/project-menu.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/project-menu.tsx
@@ -20,6 +20,7 @@ import {
} from '@/components/ui/dropdown-menu'
import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover'
import { useI18n } from '@/i18n'
+import { isDesktopFsRemoteMode } from '@/lib/desktop-fs'
import { cn } from '@/lib/utils'
import { $panesFlipped, dismissAutoProject } from '@/store/layout'
import {
@@ -95,14 +96,20 @@ function useProjectActions({
}
]
+ // The OS file manager needs the local filesystem; a remote backend's
+ // project is not on this computer (the file trees hide reveal the same way).
const pathItems: ActionItemSpec[] = [
- {
- disabled: !project.path,
- icon: 'folder-opened',
- key: 'reveal',
- label: p.reveal,
- onSelect: () => void revealPath(project.path)
- },
+ ...(isDesktopFsRemoteMode()
+ ? []
+ : [
+ {
+ disabled: !project.path,
+ icon: 'folder-opened',
+ key: 'reveal',
+ label: p.reveal,
+ onSelect: () => void revealPath(project.path)
+ } satisfies ActionItemSpec
+ ]),
{
disabled: !project.path,
icon: 'copy',
diff --git a/apps/desktop/src/app/chat/sidebar/projects/workspace-header.tsx b/apps/desktop/src/app/chat/sidebar/projects/workspace-header.tsx
index db4f4822c14..6ec08d4155a 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/workspace-header.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/workspace-header.tsx
@@ -5,6 +5,7 @@ import { Codicon } from '@/components/ui/codicon'
import { DisclosureCaret } from '@/components/ui/disclosure-caret'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
+import { isDesktopFsRemoteMode } from '@/lib/desktop-fs'
import { cn } from '@/lib/utils'
import { openWorktreeDialog } from '@/store/coding-status'
import { copyPath, revealPath } from '@/store/projects'
@@ -96,15 +97,20 @@ function useWorkspaceItems({ path, onRemove }: { path: null | string; onRemove:
const { t } = useI18n()
const p = t.sidebar.projects
+ // The OS file manager needs the local filesystem; a remote backend's
+ // worktree is not on this computer (the file trees hide reveal the same way).
+ const localFs = !isDesktopFsRemoteMode()
+
return (kit: MenuKit) => (
<>
- {renderActionItem(kit, {
- disabled: !path,
- icon: 'folder-opened',
- key: 'reveal',
- label: p.reveal,
- onSelect: () => void revealPath(path)
- })}
+ {localFs &&
+ renderActionItem(kit, {
+ disabled: !path,
+ icon: 'folder-opened',
+ key: 'reveal',
+ label: p.reveal,
+ onSelect: () => void revealPath(path)
+ })}
{renderActionItem(kit, {
disabled: !path,
icon: 'copy',
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx
new file mode 100644
index 00000000000..6ff80a9b8fa
--- /dev/null
+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx
@@ -0,0 +1,90 @@
+import { renderHook } from '@testing-library/react'
+import type { WritableAtom } from 'nanostores'
+import type { ReactNode } from 'react'
+import { MemoryRouter } from 'react-router'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+import { $connection, $currentCwd, $selectedStoredSessionId, $sessions } from '@/store/session'
+import { $focusedTreePaneId as $focusedTreePaneIdMock } from '@/store/session-focus'
+import { $sessionTiles } from '@/store/session-states'
+
+import { useStatusbarItems } from './use-statusbar-items'
+
+// The mock above replaces the computed store with a writable atom.
+const $focusedTreePaneId = $focusedTreePaneIdMock as unknown as WritableAtom<null | string>
+
+// The focused pane is derived from the layout tree; a settable atom stands in
+// so a test can focus a tile without building a pane tree.
+vi.mock('@/store/session-focus', async () => {
+ const { atom } = await import('nanostores')
+
+ return { $focusedTreePaneId: atom<null | string>(null) }
+})
+
+const wrapper = ({ children }: { children: ReactNode }) => <MemoryRouter>{children}</MemoryRouter>
+
+function workspaceMenuIds(): string[] {
+ const { result } = renderHook(
+ () =>
+ useStatusbarItems({
+ agentsOpen: false,
+ chatOpen: true,
+ commandCenterOpen: false,
+ extraLeftItems: [],
+ extraRightItems: [],
+ freshDraftReady: false,
+ gatewayState: 'ready',
+ inferenceStatus: null,
+ openAgents: () => {},
+ openCommandCenterSection: () => {},
+ requestGateway: async () => undefined as never,
+ statusSnapshot: null,
+ toggleCommandCenter: () => {}
+ }),
+ { wrapper }
+ )
+
+ const workspace = result.current.leftStatusbarItems.find(item => item.id === 'workspace-cwd')
+
+ return (workspace?.menuItems ?? []).map(item => item.id)
+}
+
+afterEach(() => {
+ $connection.set(null)
+ $currentCwd.set('')
+ $sessionTiles.set([])
+ $focusedTreePaneId.set(null)
+ $selectedStoredSessionId.set(null)
+ $sessions.set([])
+})
+
+describe('statusbar workspace menu — "Open containing folder"', () => {
+ it('offers reveal for a local workspace and hides it when the connection is remote', () => {
+ $currentCwd.set('/home/me/project')
+ $connection.set({ mode: 'local' } as never)
+ expect(workspaceMenuIds()).toContain('reveal-workspace-finder')
+
+ $connection.set({ mode: 'remote' } as never)
+ expect(workspaceMenuIds()).not.toContain('reveal-workspace-finder')
+ })
+
+ // The reporter's topology (#115167): the window's primary is local but the
+ // focused tile is a Connections-tagged session on a remote gateway. The gate
+ // follows the FOCUSED session's owner, not the window's primary.
+ it('hides reveal for a focused remote tile inside a local-primary window', () => {
+ $connection.set({ mode: 'local' } as never)
+ $selectedStoredSessionId.set('primary-local')
+ $sessionTiles.set([
+ {
+ ownerRoute: { connectionId: 'conn-remote', mode: 'remote', profile: 'default' },
+ storedSessionId: 'tile-remote'
+ }
+ ])
+ $focusedTreePaneId.set('session-tile:tile-remote')
+ // A focused tile never inherits the primary's cwd; its stored row carries it.
+ $sessions.set([{ cwd: '/srv/bot/workspace', id: 'tile-remote' }] as never)
+
+ expect(workspaceMenuIds()).toContain('copy-workspace-path')
+ expect(workspaceMenuIds()).not.toContain('reveal-workspace-finder')
+ })
+})
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
index bb80493f47c..c7d941cdb02 100644
--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
@@ -55,7 +55,13 @@ import {
idsShareLineage,
sessionMatchesStoredId
} from '@/store/session'
-import { $focusedRuntimeId, $focusedSessionState, $focusedStoredSessionId } from '@/store/session-states'
+import {
+ $focusedRuntimeId,
+ $focusedSessionState,
+ $focusedStoredSessionId,
+ $sessionTiles,
+ isSessionRemote
+} from '@/store/session-states'
import { $statusbarHiddenIds } from '@/store/statusbar-prefs'
import { $subagentsBySession, activeSubagentCount, failedSubagentCount } from '@/store/subagents'
import { $gatewayRestarting } from '@/store/system-actions'
@@ -162,6 +168,11 @@ export function useStatusbarItems({
// clicking into a tile makes the statusbar describe THAT session.
const focusedStoredSessionId = useStore($focusedStoredSessionId)
const focusedRuntimeId = useStore($focusedRuntimeId)
+ // Whether the FOCUSED session's workspace lives on another machine: a
+ // Connections-tagged tile on a remote gateway inside a local-primary window
+ // (and vice versa) is decided by the tile's owner route, falling back to the
+ // ambient connection only when no owner is known (#115167).
+ const focusedWorkspaceRemote = useStoreSelector($sessionTiles, () => isSessionRemote(focusedStoredSessionId))
// `$focusedSessionState` is a projection of `$sessionStates`, which is
// republished on EVERY message delta — tens of times a second during a turn.
// Only the fields read here are selected, so an unchanged readout bails out
@@ -524,7 +535,7 @@ export function useStatusbarItems({
// The OS file manager needs the local filesystem; a remote
// backend's workspace is not on this computer (the sidebar
// trees already hide reveal the same way).
- ...(connection?.mode === 'remote'
+ ...(focusedWorkspaceRemote
? []
: [
{
@@ -593,9 +604,9 @@ export function useStatusbarItems({
agentsOpen,
botsShowing,
commandCenterOpen,
- connection?.mode,
copy,
currentCwd,
+ focusedWorkspaceRemote,
freeTierCopy,
fileMenu.copyPath,
fileMenu.revealFileManager,
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index d9e6bc5f106..823fa39d9df 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -111,7 +111,8 @@ export const ar = defineLocale({
renameLabel: 'الاسم الجديد',
deleteTitle: name => `حذف ${name}؟`,
deleteBody: 'سيتم نقله إلى سلة المهملات — يمكنك استعادته من هناك.',
- pathCopied: 'تم نسخ المسار'
+ pathCopied: 'تم نسخ المسار',
+ revealMissing: 'هذا المجلد ليس على هذا الحاسوب'
},
boot: {
ready: 'Hermes Desktop جاهز',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 5f08bc4f2ea..16b5e7f9faf 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -95,7 +95,8 @@ export const ja = defineLocale({
renameLabel: '新しい名前',
deleteTitle: name => `${name} を削除しますか?`,
deleteBody: 'ゴミ箱に移動します。そこから復元できます。',
- pathCopied: 'パスをコピーしました'
+ pathCopied: 'パスをコピーしました',
+ revealMissing: 'そのフォルダーはこのコンピューターにありません'
},
boot: {
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index f3a71c18a6d..05ed73aff88 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -116,7 +116,8 @@ export const ru = defineLocale({
renameLabel: 'Новое имя',
deleteTitle: name => `Удалить ${name}?`,
deleteBody: 'Элемент будет перемещён в корзину — его можно восстановить оттуда.',
- pathCopied: 'Путь скопирован'
+ pathCopied: 'Путь скопирован',
+ revealMissing: 'Этой папки нет на этом компьютере'
},
boot: {
ready: 'Hermes Desktop готов',
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index d80035cba6c..9ae0f403d5f 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -95,7 +95,8 @@ export const zhHant = defineLocale({
renameLabel: '新名稱',
deleteTitle: name => `刪除 ${name}?`,
deleteBody: '將移至垃圾桶,你可以從那裡還原。',
- pathCopied: '已複製路徑'
+ pathCopied: '已複製路徑',
+ revealMissing: '該資料夾不在這台電腦上'
},
boot: {
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 2e296bc78ea..2482729c976 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -123,7 +123,8 @@ export const zh = defineLocale({
renameLabel: '新名称',
deleteTitle: name => `删除 ${name}?`,
deleteBody: '将移至废纸篓,你可以从那里恢复。',
- pathCopied: '已复制路径'
+ pathCopied: '已复制路径',
+ revealMissing: '该文件夹不在这台电脑上'
},
boot: {
diff --git a/apps/desktop/src/lib/desktop-fs.test.ts b/apps/desktop/src/lib/desktop-fs.test.ts
index 7d0155d6c8a..7422a3acfb1 100644
--- a/apps/desktop/src/lib/desktop-fs.test.ts
+++ b/apps/desktop/src/lib/desktop-fs.test.ts
@@ -12,7 +12,6 @@ import {
readDesktopFileDataUrl,
readDesktopFileDataUrlLocalFirst,
readDesktopFileText,
- revealDesktopPath,
selectDesktopPaths,
setDesktopFsRemotePicker
} from './desktop-fs'
@@ -22,7 +21,6 @@ const readFileText = vi.fn(async () => ({ path: '/local/file.txt', text: 'local'
const readFileDataUrl = vi.fn(async () => 'data:text/plain;base64,bG9jYWw=')
const gitRoot = vi.fn(async () => '/local')
const selectPaths = vi.fn(async () => ['/local'])
-const revealPath = vi.fn(async () => true)
const api = vi.fn(async ({ path }: { path: string }) => {
if (path.startsWith('/api/fs/list?')) {
@@ -60,7 +58,6 @@ function stubBridge() {
readDir,
readFileDataUrl,
readFileText,
- revealPath,
selectPaths
}
})
@@ -100,16 +97,6 @@ describe('desktop filesystem facade', () => {
expect(api).not.toHaveBeenCalled()
})
- // The Electron door answers false for a path that is not on this computer
- // (a remote backend's workspace); the facade must fail so the menu can toast
- // instead of reporting success for a click that showed nothing.
- it('rejects reveal when the bridge reports the path is missing', async () => {
- await expect(revealDesktopPath('/local')).resolves.toBeUndefined()
-
- revealPath.mockResolvedValueOnce(false)
- await expect(revealDesktopPath('/remote/workspace')).rejects.toThrow(/not on this computer/)
- })
-
it('routes filesystem reads through authenticated backend REST in remote mode', async () => {
$connection.set({ mode: 'remote' } as never)
diff --git a/apps/desktop/src/store/projects.ts b/apps/desktop/src/store/projects.ts
index 13d4ee93f69..62fda9a46d1 100644
--- a/apps/desktop/src/store/projects.ts
+++ b/apps/desktop/src/store/projects.ts
@@ -15,6 +15,7 @@ import { desktopGit } from '@/lib/desktop-git'
import { isMissingRestEndpoint, isMissingRpcMethod } from '@/lib/gateway-rpc'
import { isUnderPath } from '@/lib/path-compare'
import { persistentAtom } from '@/lib/persisted'
+import { revealFile } from '@/store/file-actions'
import { $gateway, activeGateway, ensureActiveGatewayOpen } from '@/store/gateway'
import { $sidebarShowAllSessions, setSidebarAgentsGrouped } from '@/store/layout'
import { notify } from '@/store/notifications'
@@ -1392,9 +1393,11 @@ export async function removeWorktreePath(
}
// Reveal a project/worktree path in the OS file manager (git-GUI standard).
+// Routes through `revealFile` so a path that is not on this computer toasts
+// instead of silently showing nothing.
export async function revealPath(path: null | string): Promise<void> {
if (path) {
- await window.hermesDesktop?.revealPath?.(path)
+ await revealFile(path)
}
}