Skip to content

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

TypeScript

fix(desktop-app): keep the onboarding preview cold on every launch

Andy Pavia7822e00ef75c
diff --git a/desktop-app/src/__tests__/config.onboardingPreview.test.ts b/desktop-app/src/__tests__/config.onboardingPreview.test.ts
index 99afa949f..11660122f 100644
--- a/desktop-app/src/__tests__/config.onboardingPreview.test.ts
+++ b/desktop-app/src/__tests__/config.onboardingPreview.test.ts
@@ -1,4 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import fs from 'node:fs'
+import path from 'node:path'
vi.mock('electron', () => ({
app: {
@@ -122,6 +124,29 @@ describe('EVENFIRE_ONBOARDING_PREVIEW', () => {
}
})
+ it('starts cold again after a previous preview selected an environment', async () => {
+ // Regression: selecting Localhost (or saving) inside the preview wrote
+ // activeProfileId into the preview's own directory, so the NEXT launch
+ // came up configured and went to sign-in. The switch showed onboarding
+ // once and then quietly stopped working.
+ const previewDir = path.join(
+ '/tmp/evenfire-test-userdata',
+ 'runtime-configs-onboarding-preview'
+ )
+ fs.mkdirSync(previewDir, { recursive: true })
+ fs.writeFileSync(
+ path.join(previewDir, 'index.json'),
+ JSON.stringify({ version: 1, activeProfileId: '__localhost__', profiles: [] })
+ )
+
+ process.env.EVENFIRE_ONBOARDING_PREVIEW = 'true'
+
+ const state = await loadState()
+
+ expect(state.configured).toBe(false)
+ expect(state.activeOptionId).not.toBe('__localhost__')
+ })
+
it('does not let an explicit config path hand the preview an environment', async () => {
process.env.EVENFIRE_ONBOARDING_PREVIEW = 'true'
process.env.CLERUM_DESKTOP_CONFIG_PATH = '/tmp/evenfire-explicit/runtime-config.json'
diff --git a/desktop-app/src/config.ts b/desktop-app/src/config.ts
index 9678fc815..c19dd2d39 100644
--- a/desktop-app/src/config.ts
+++ b/desktop-app/src/config.ts
@@ -336,6 +336,14 @@ function loadStoredProfilesSync(): {
profiles: StoredRuntimeProfile[]
activeProfileId: string | null
} {
+ // The onboarding preview starts cold on EVERY launch. Selecting Localhost or
+ // saving an environment writes to the preview directory, which would leave
+ // the next launch configured — the switch would show onboarding once and
+ // then silently stop, which is exactly the confusion it exists to prevent.
+ // Reads are dropped rather than the directory deleted: writes still work, so
+ // the wizard can be completed and used for the rest of the session.
+ if (ONBOARDING_PREVIEW) return { profiles: [], activeProfileId: null }
+
const explicitPath = explicitRuntimeConfigPath()
if (explicitPath) {
const configFromFile = readRuntimeConfigFileSync(explicitPath)