The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): "Open containing folder" is hidden for remote workspaces and reports a missing path
teknium1d58831c36b7a
diff --git a/apps/desktop/electron/fs-ipc.test.ts b/apps/desktop/electron/fs-ipc.test.tsnew file mode 100644index 00000000000..34b788096f2--- /dev/null+++ b/apps/desktop/electron/fs-ipc.test.ts@@ -0,0 +1,64 @@+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'++import { afterEach, describe, expect, it, vi } from 'vitest'++const electron = vi.hoisted(() => ({+ handlers: new Map<string, (...args: unknown[]) => unknown>(),+ showItemInFolder: vi.fn()+}))++vi.mock('electron', () => ({+ ipcMain: {+ handle: (channel: string, handler: (...args: unknown[]) => unknown) => electron.handlers.set(channel, handler)+ },+ shell: {+ showItemInFolder: electron.showItemInFolder,+ openPath: vi.fn(async () => '')+ }+}))++vi.mock('./desktop-plugin-install', () => ({ installDesktopPluginFromGit: vi.fn(), probePluginRepo: vi.fn() }))+vi.mock('./desktop-plugins-root', () => ({+ DESKTOP_PLUGINS_DIR: 'desktop-plugins',+ ensureDir: vi.fn(),+ migrateProfileScopedDesktopPlugins: vi.fn(),+ reconcileUnifiedDesktopHalves: vi.fn()+}))++import { registerFsIpc } from './fs-ipc'++const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-fs-ipc-'))++registerFsIpc({+ hermesHome: scratch,+ readActiveDesktopProfile: () => null,+ expandUserPath: value => value,+ resolveRequestedPathForIpc: value => value,+ directoryExists: value => fs.existsSync(value),+ resolveGitBinary: () => 'git'+})++const reveal = (target: string) => electron.handlers.get('hermes:fs:reveal')!({}, target)++afterEach(() => {+ electron.showItemInFolder.mockClear()+})++describe('hermes:fs:reveal', () => {+ it('reveals a path that exists on this computer', async () => {+ const file = path.join(scratch, 'workspace')+ fs.mkdirSync(file)++ await expect(reveal(file)).resolves.toBe(true)+ expect(electron.showItemInFolder).toHaveBeenCalledWith(file)+ })++ // A remote backend's workspace is not on this machine: showItemInFolder+ // would silently no-op, so the door must report the miss instead of success.+ it('reports false without touching the file manager when the path is missing', async () => {+ await expect(reveal(path.join(scratch, 'not-here'))).resolves.toBe(false)+ expect(electron.showItemInFolder).not.toHaveBeenCalled()+ })+})diff --git a/apps/desktop/electron/fs-ipc.ts b/apps/desktop/electron/fs-ipc.tsindex 8f57bf979ba..60dc7280fd2 100644--- a/apps/desktop/electron/fs-ipc.ts+++ b/apps/desktop/electron/fs-ipc.ts@@ -42,7 +42,10 @@ export function registerFsIpc({ipcMain.handle('hermes:fs:reveal', async (_event, targetPath) => {const target = String(targetPath || '').trim()- if (!target) {+ // `showItemInFolder` silently no-ops on a missing path, so a remote+ // backend's workspace (not on this computer) would report success for a+ // click that showed nothing. Report the miss so the renderer can toast.+ if (!target || !fs.existsSync(target)) {return false}diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsxindex f128f2d64ea..bb80493f47c 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx@@ -521,12 +521,19 @@ export function useStatusbarItems({onSelect: () => void copyFilePath(currentCwd),title: displayPath(currentCwd)},- {- id: 'reveal-workspace-finder',- label: fileMenu.revealFileManager,- onSelect: () => void revealFile(currentCwd),- title: displayPath(currentCwd)- },+ // 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'+ ? []+ : [+ {+ id: 'reveal-workspace-finder',+ label: fileMenu.revealFileManager,+ onSelect: () => void revealFile(currentCwd),+ title: displayPath(currentCwd)+ }+ ]),{id: 'reveal-workspace-sidebar',label: fileMenu.revealInSidebar,@@ -586,6 +593,7 @@ export function useStatusbarItems({agentsOpen,botsShowing,commandCenterOpen,+ connection?.mode,copy,currentCwd,freeTierCopy,diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 5bf31ad4f02..7c4ddec4df4 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -129,7 +129,8 @@ export const en: Translations = {renameLabel: 'New name',deleteTitle: name => `Delete ${name}?`,deleteBody: 'It will be moved to the Trash — you can restore it from there.',- pathCopied: 'Path copied'+ pathCopied: 'Path copied',+ revealMissing: 'That folder is not on this computer'},boot: {diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex bc8d835bf4b..d761f086991 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -184,6 +184,7 @@ export interface Translations {deleteTitle: (name: string) => stringdeleteBody: stringpathCopied: string+ revealMissing: string}boot: {diff --git a/apps/desktop/src/lib/desktop-fs.test.ts b/apps/desktop/src/lib/desktop-fs.test.tsindex 7422a3acfb1..7d0155d6c8a 100644--- a/apps/desktop/src/lib/desktop-fs.test.ts+++ b/apps/desktop/src/lib/desktop-fs.test.ts@@ -12,6 +12,7 @@ import {readDesktopFileDataUrl,readDesktopFileDataUrlLocalFirst,readDesktopFileText,+ revealDesktopPath,selectDesktopPaths,setDesktopFsRemotePicker} from './desktop-fs'@@ -21,6 +22,7 @@ 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?')) {@@ -58,6 +60,7 @@ function stubBridge() {readDir,readFileDataUrl,readFileText,+ revealPath,selectPaths}})@@ -97,6 +100,16 @@ 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/lib/desktop-fs.ts b/apps/desktop/src/lib/desktop-fs.tsindex 16bc27f70e9..02d71aef871 100644--- a/apps/desktop/src/lib/desktop-fs.ts+++ b/apps/desktop/src/lib/desktop-fs.ts@@ -5,6 +5,7 @@ import type {HermesReadFileTextResult,HermesSelectPathsOptions} from '@/global'+import { translateNow } from '@/i18n'import { $connection } from '@/store/session'export interface DesktopFsRemotePicker {@@ -159,8 +160,14 @@ export async function desktopDefaultCwd(): Promise<{ branch: string; cwd: string}// Reveal a path in the OS file manager (Finder / Explorer / Files). Local only.+// The bridge answers `false` when the path is not on this computer (a remote+// backend's workspace) — surface it instead of a silent no-op.export async function revealDesktopPath(path: string): Promise<void> {- await bridge().revealPath?.(path)+ const revealed = await bridge().revealPath?.(path)++ if (revealed === false) {+ throw new Error(translateNow('fileMenu.revealMissing'))+ }}// Rename a file/folder in place; returns the new absolute path. Local only.