The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): saveAgentPluginSettings leaves another profile's list alone
Teknium15ab47a6b926
diff --git a/apps/desktop/src/store/agent-plugins.test.ts b/apps/desktop/src/store/agent-plugins.test.tsindex 3c9162f35c4..3e3e4069394 100644--- a/apps/desktop/src/store/agent-plugins.test.ts+++ b/apps/desktop/src/store/agent-plugins.test.ts@@ -2,6 +2,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'import {$agentPlugins,+ $agentPluginsProfile,type AgentPluginRow,installAgentPlugin,isDesktopRelevantPlugin,@@ -12,7 +13,10 @@ import {const row = (partial: Partial<AgentPluginRow>): AgentPluginRow =>({ name: partial.key ?? 'x', status: 'enabled', ...partial }) as AgentPluginRow-afterEach(() => vi.useRealTimers())+afterEach(() => {+ vi.useRealTimers()+ $agentPluginsProfile.set(undefined)+})describe('installAgentPlugin', () => {it('waits for a slow successful install instead of reporting the generic 30s timeout', async () => {@@ -86,6 +90,7 @@ describe('isDesktopRelevantPlugin (#98861)', () => {describe('saveAgentPluginSettings (#46600, #87934)', () => {it('writes values through plugins.manage settings and secrets ONLY through the credential writer', async () => {$agentPlugins.set([row({ key: 'demo', source: 'user' })])+ $agentPluginsProfile.set('workbot')const refreshed = row({ key: 'demo', settings_schema: [], source: 'user' })const request = vi.fn(async () => ({ ok: true, plugin: refreshed }))const writeSecret = vi.fn(async () => ({ ok: true }))@@ -112,4 +117,28 @@ describe('saveAgentPluginSettings (#46600, #87934)', () => {expect(JSON.stringify(request.mock.calls)).not.toContain('sk-1')expect($agentPlugins.get()[0].settings_schema).toEqual([])})++ // The list is shared across profiles: a save that lands after the list moved+ // to another profile must neither patch that list nor refetch over it.+ it('leaves a list loaded for another profile alone', async () => {+ const other = row({ key: 'demo', source: 'user' })++ $agentPlugins.set([other])+ $agentPluginsProfile.set('other')+ const request = vi.fn(async () => ({ ok: true, plugin: row({ key: 'demo', settings_schema: [], source: 'user' }) }))++ const ok = await saveAgentPluginSettings(request as never, {+ failMessage: 'fail',+ key: 'demo',+ profile: 'workbot',+ secrets: {},+ values: { retries: 2 },+ writeSecret: vi.fn(async () => ({ ok: true }))+ })++ expect(ok).toBe(true)+ expect(request).toHaveBeenCalledTimes(1)+ expect($agentPlugins.get()).toEqual([other])+ expect($agentPluginsProfile.get()).toBe('other')+ })})