Summary
In the desktop (Electron) app, AI provider API keys entered in the dashboard do not persist. After closing the session / restarting the app, the providers are erased (no keys). The same symptom occurs when keys are set via the CLI-served web app and the desktop app is then launched — providers added in one surface vanish in the other.
Root cause
The desktop runtime does not wire authStorage into the dashboard server.
packages/desktop/src/local-runtime.ts (createDashboardServerDefault, ~L68) and packages/desktop/src/local-server.ts (~L77) call createServer(store, { engine, engineManager, centralCore, onProjectFirstAccessed }) with no authStorage. There are zero references to authStorage/AuthStorage/createFusionAuthStorage anywhere in packages/desktop/src.
createServer() derives several defaults from the engine (onMerge, automationStore, missionAutopilot, missionExecutionLoop, heartbeatMonitor) but not authStorage.
- The CLI
dashboard command, by contrast, constructs createFusionAuthStorage() (packages/engine/src/auth-storage.ts:310, which persists to ~/.fusion/agent/auth.json), wraps it with model-registry + API-key providers, and passes authStorage into createServer (packages/cli/src/commands/dashboard.ts:1485, 1631, 1907, 2204).
Downstream, the /auth/api-key route calls getAuthStorage() which throws Authentication is not configured when authStorage is absent (packages/dashboard/src/routes/register-auth-routes.ts:32). As a result, API keys entered via the desktop UI either fail outright or are never persisted, so they vanish on restart. Because the CLI-served app persists to ~/.fusion/agent/auth.json while the desktop can't read/write it, switching surfaces makes providers appear "erased."
This is strongly connected to the broader "providers silently disappear" behavior, and is the same class of desktop-wiring gap as #1937 (plugin subsystem).
Steps to reproduce
- Launch the desktop app (Fusion 0.56.1, Windows).
- Go to Authentication/Providers, enter an API key for a provider (e.g. Anthropic / OpenAI), and save.
- Close the app and reopen, OR set keys via
fn dashboard (CLI) and then launch the desktop.
- Observe: the providers/keys are gone.
Expected
The desktop runtime constructs and passes authStorage (mirroring cli/src/commands/dashboard.ts) so provider keys persist to ~/.fusion/agent/auth.json and are shared consistently between the desktop and CLI/web surfaces.
Suggested fix
In local-runtime.ts / local-server.ts, construct createFusionAuthStorage(), wrap it with the model-registry + API-key-provider layer (as in dashboard.ts:1485-1488), and pass it into createServer(store, { …, authStorage }). Additionally, consider having createServer derive/default authStorage from the engine (as it does for other subsystems) so this gap is harder to reintroduce.
Related
Environment
- OS: Windows
- Fusion version: 0.56.1
- Install type: desktop (Electron)
Summary
In the desktop (Electron) app, AI provider API keys entered in the dashboard do not persist. After closing the session / restarting the app, the providers are erased (no keys). The same symptom occurs when keys are set via the CLI-served web app and the desktop app is then launched — providers added in one surface vanish in the other.
Root cause
The desktop runtime does not wire
authStorageinto the dashboard server.packages/desktop/src/local-runtime.ts(createDashboardServerDefault, ~L68) andpackages/desktop/src/local-server.ts(~L77) callcreateServer(store, { engine, engineManager, centralCore, onProjectFirstAccessed })with noauthStorage. There are zero references toauthStorage/AuthStorage/createFusionAuthStorageanywhere inpackages/desktop/src.createServer()derives several defaults from the engine (onMerge,automationStore,missionAutopilot,missionExecutionLoop,heartbeatMonitor) but notauthStorage.dashboardcommand, by contrast, constructscreateFusionAuthStorage()(packages/engine/src/auth-storage.ts:310, which persists to~/.fusion/agent/auth.json), wraps it with model-registry + API-key providers, and passesauthStorageintocreateServer(packages/cli/src/commands/dashboard.ts:1485, 1631, 1907, 2204).Downstream, the
/auth/api-keyroute callsgetAuthStorage()which throwsAuthentication is not configuredwhenauthStorageis absent (packages/dashboard/src/routes/register-auth-routes.ts:32). As a result, API keys entered via the desktop UI either fail outright or are never persisted, so they vanish on restart. Because the CLI-served app persists to~/.fusion/agent/auth.jsonwhile the desktop can't read/write it, switching surfaces makes providers appear "erased."This is strongly connected to the broader "providers silently disappear" behavior, and is the same class of desktop-wiring gap as #1937 (plugin subsystem).
Steps to reproduce
fn dashboard(CLI) and then launch the desktop.Expected
The desktop runtime constructs and passes
authStorage(mirroringcli/src/commands/dashboard.ts) so provider keys persist to~/.fusion/agent/auth.jsonand are shared consistently between the desktop and CLI/web surfaces.Suggested fix
In
local-runtime.ts/local-server.ts, constructcreateFusionAuthStorage(), wrap it with the model-registry + API-key-provider layer (as indashboard.ts:1485-1488), and pass it intocreateServer(store, { …, authStorage }). Additionally, consider havingcreateServerderive/defaultauthStoragefrom the engine (as it does for other subsystems) so this gap is harder to reintroduce.Related
Environment