The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): preserve keyless plugin row identity
fangliquanflq03a9c69dc6f6
diff --git a/apps/desktop/src/app/settings/plugins-settings.test.tsx b/apps/desktop/src/app/settings/plugins-settings.test.tsxindex f23551c555a..547633fdbcc 100644--- a/apps/desktop/src/app/settings/plugins-settings.test.tsx+++ b/apps/desktop/src/app/settings/plugins-settings.test.tsx@@ -40,6 +40,7 @@ beforeEach(() => {afterEach(() => {cleanup()+ vi.restoreAllMocks()})describe('PluginsSettings', () => {@@ -68,6 +69,27 @@ describe('PluginsSettings', () => {)})+ it('keeps duplicate-named legacy rows distinct after a name-addressed toggle', async () => {+ const sibling = {+ ...legacyRow,+ description: 'A second plugin category with the same legacy name'+ }+ const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined)++ $agentPlugins.set([legacyRow, sibling])+ requestGateway.mockResolvedValue({ ok: true, plugin: { ...legacyRow, status: 'enabled' } })++ render(<PluginsSettings />)+ fireEvent.click(screen.getAllByRole('switch', { name: 'Enable Legacy plugin' })[0])++ await waitFor(() =>+ expect(screen.getAllByRole('switch', { name: 'Disable Legacy plugin' })).toHaveLength(2)+ )++ expect(screen.getByText(sibling.description)).toBeTruthy()+ expect(consoleError.mock.calls.flat().join(' ')).not.toContain('same key')+ })+it('keeps using the canonical key when the backend provides one', async () => {const keyedRow = { ...legacyRow, key: 'image_gen/legacy' }diff --git a/apps/desktop/src/app/settings/plugins-settings.tsx b/apps/desktop/src/app/settings/plugins-settings.tsxindex b66c7f19a7a..cfc4700d1b3 100644--- a/apps/desktop/src/app/settings/plugins-settings.tsx+++ b/apps/desktop/src/app/settings/plugins-settings.tsx@@ -45,6 +45,9 @@ const isDesktopRelevant = (row: AgentPluginRow) => {return !key || !HIDDEN_KEY_PREFIXES.some(prefix => key.startsWith(prefix))}+const agentPluginRowKey = (row: AgentPluginRow) =>+ row.key ?? [row.name, row.source, row.version, row.description].join('\0')+function reveal(file: string) {void window.hermesDesktop?.revealPath?.(file)?.catch(() => undefined)}@@ -240,7 +243,7 @@ function AgentPluginsSection() {) : (<div>{sorted.map(row => (- <AgentPluginRowView key={row.key || row.name} row={row} />+ <AgentPluginRowView key={agentPluginRowKey(row)} row={row} />))}</div>)}diff --git a/apps/desktop/src/store/agent-plugins.ts b/apps/desktop/src/store/agent-plugins.tsindex 7e927cbd898..aaf9218fbc7 100644--- a/apps/desktop/src/store/agent-plugins.ts+++ b/apps/desktop/src/store/agent-plugins.ts@@ -96,10 +96,14 @@ export async function toggleAgentPlugin(const refreshed = result.pluginif (refreshed) {+ const currentRows = $agentPlugins.get()+$agentPlugins.set(- $agentPlugins- .get()- .map(current => ((current.key ?? current.name) === address ? { ...current, ...refreshed } : current))+ row.key+ ? currentRows.map(current => (current.key === row.key ? { ...current, ...refreshed } : current))+ : currentRows.map(current =>+ current.name === row.name ? { ...current, status: refreshed.status } : current+ ))} else {await loadAgentPlugins(request)