Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop): preserve saved profiles outside explicit dev runs

Josuédbd13222b45e
diff --git a/desktop-app/src/__tests__/config.runtimeConfig.test.ts b/desktop-app/src/__tests__/config.runtimeConfig.test.ts
index 69dabdf1e..c7b835971 100644
--- a/desktop-app/src/__tests__/config.runtimeConfig.test.ts
+++ b/desktop-app/src/__tests__/config.runtimeConfig.test.ts
@@ -282,4 +282,56 @@ describe('desktop runtime config', () => {
rpcProxyBaseUrl: 'http://127.0.0.1:8094',
})
})
+
+ it('keeps a saved remote profile when an unpackaged run lacks the renderer dev flag', async () => {
+ tempUserDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'evenfire-user-data-'))
+ const runtimeConfigDir = path.join(tempUserDataDir, 'runtime-configs')
+ await fsp.mkdir(runtimeConfigDir, { recursive: true })
+ await fsp.writeFile(
+ path.join(runtimeConfigDir, 'index.json'),
+ JSON.stringify({
+ version: 1,
+ activeProfileId: 'remote',
+ profiles: [
+ {
+ id: 'remote',
+ appName: 'Remote',
+ fileName: 'runtime-config-remote.json',
+ createdAt: '2026-01-01T00:00:00.000Z',
+ updatedAt: '2026-01-01T00:00:00.000Z',
+ },
+ ],
+ })
+ )
+ await fsp.writeFile(
+ path.join(runtimeConfigDir, 'runtime-config-remote.json'),
+ JSON.stringify({
+ externalRestApiBaseUrl: 'https://api.remote.example.com',
+ rpcProxyBaseUrl: 'https://rpc.remote.example.com',
+ appName: 'Remote',
+ })
+ )
+ delete process.env.CLERUM_DESKTOP_CONFIG_PATH
+ delete process.env.EVENFIRE_RENDERER_URL
+ process.env.EXTERNAL_REST_API_BASE_URL = 'http://127.0.0.1:8091'
+ process.env.RPC_PROXY_BASE_URL = 'http://127.0.0.1:8094'
+
+ vi.doMock('electron', () => ({
+ app: {
+ getPath: vi.fn((name: string) =>
+ name === 'userData' ? tempUserDataDir : path.dirname(tempUserDataDir || os.tmpdir())
+ ),
+ isPackaged: false,
+ isReady: vi.fn(() => true),
+ setName: vi.fn(),
+ setPath: vi.fn(),
+ },
+ }))
+
+ const { config, getDesktopRuntimeConfigState } = await import('../config.js')
+
+ expect(config.externalRestApiBaseUrl).toBe('https://api.remote.example.com')
+ expect(config.rpcProxyBaseUrl).toBe('https://rpc.remote.example.com')
+ expect(getDesktopRuntimeConfigState().activeOptionId).toBe('remote')
+ })
})
diff --git a/desktop-app/src/config.ts b/desktop-app/src/config.ts
index b3c072fc1..15e5e658b 100644
--- a/desktop-app/src/config.ts
+++ b/desktop-app/src/config.ts
@@ -498,7 +498,10 @@ const envRuntimeConfigured = Boolean(
const envMatchesLocalhostOption = runtimeEndpointsMatch(envRuntimeConfig, localhostRuntimeConfig)
function shouldPreferLocalhostByDefault(): boolean {
- return canUseEnvRuntimeConfig && envRuntimeConfigured && envMatchesLocalhostOption
+ const explicitDevelopmentLaunch = app?.isPackaged
+ ? desktopDevPackageRuntimeConfigEnabled
+ : Boolean(process.env.EVENFIRE_RENDERER_URL?.trim())
+ return explicitDevelopmentLaunch && envRuntimeConfigured && envMatchesLocalhostOption
}
const loadedProfilesState = loadStoredProfilesSync()
let storedProfiles = loadedProfilesState.profiles