Skip to content

The agent that grows with you

fix(webapp): offer another model when the Local models pane is absent

Tekniumd17e4a34a430
diff --git a/apps/desktop/src/store/onboarding-local-runtime.test.ts b/apps/desktop/src/store/onboarding-local-runtime.test.ts
index dd1953f39c7..fb3b6811144 100644
--- a/apps/desktop/src/store/onboarding-local-runtime.test.ts
+++ b/apps/desktop/src/store/onboarding-local-runtime.test.ts
@@ -1,5 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { $localModelsEnabled } from '@/store/local-models-flag'
import * as notifications from '@/store/notifications'
import { markOnboardingDecided } from '@/store/onboarding-presence'
@@ -52,10 +53,12 @@ describe('refreshOnboarding with the local model server down', () => {
afterEach(() => {
window.localStorage.clear()
$desktopOnboarding.set(coldState())
+ $localModelsEnabled.set(false)
vi.restoreAllMocks()
})
it('keeps the app open and names the server, never provider sign-in', async () => {
+ $localModelsEnabled.set(true)
const notify = vi.spyOn(notifications, 'notify')
const ready = await refreshOnboarding({
@@ -76,6 +79,19 @@ describe('refreshOnboarding with the local model server down', () => {
)
})
+ it('offers another model where there is no Local models pane (the Webapp)', async () => {
+ const notify = vi.spyOn(notifications, 'notify')
+
+ await refreshOnboarding({
+ requestGateway: localModelGateway({ error: SERVER_OFF, error_code: 'local_runtime_unavailable', ok: false })
+ })
+
+ expect($desktopOnboarding.get().configured).toBe(true)
+ const shown = notify.mock.calls.at(-1)?.[0]
+ expect(shown?.action?.label).toBe('Choose another model')
+ expect(shown?.message).toContain('Hermes desktop app')
+ })
+
it('still opens onboarding for an uncoded failure (a missing credential)', async () => {
await refreshOnboarding({
requestGateway: localModelGateway({ error: 'No usable credentials found for openrouter.', ok: false })
diff --git a/apps/desktop/src/store/onboarding.ts b/apps/desktop/src/store/onboarding.ts
index fe3804c9ad3..d1cf214d236 100644
--- a/apps/desktop/src/store/onboarding.ts
+++ b/apps/desktop/src/store/onboarding.ts
@@ -30,11 +30,13 @@ import {
} from '@/store/free-tier'
import { followHandoff, handoffStillMoving } from '@/store/free-tier-sign-in'
import { $gatewayBootGeneration } from '@/store/live-sync'
+import { $localModelsEnabled } from '@/store/local-models-flag'
import { setMainModelAssignment } from '@/store/model-assignment'
import { dismissNotification, notify, notifyError } from '@/store/notifications'
import { afterOnboardingSurfaceClear, onboardingSurfaceOpen } from '@/store/onboarding-presence'
import { captureOnboardingScope, type OnboardingScope } from '@/store/onboarding-scope'
import { requestRoute } from '@/store/recovery-requests'
+import { setModelPickerOpen } from '@/store/session'
import type { AppHandoffStatus, OAuthPollResponse, OAuthProvider, OAuthStartResponse } from '@/types/hermes'
type PkceStart = Extract<OAuthStartResponse, { flow: 'pkce' }>
@@ -315,14 +317,23 @@ function isLocalRuntimeDown(runtime: RuntimeReadinessResult, state: DesktopOnboa
return runtime.source === 'runtime_check' && runtime.errorCode === LOCAL_RUNTIME_UNAVAILABLE && !state.requested
}
+// The Webapp has no Local models pane (the flag is Electron-only), so there the way forward it can
+// offer is another model, and the sentence must not send the user to a pane they cannot open.
+const WEBAPP_LOCAL_RUNTIME_DOWN =
+ "The local model server isn't serving. Start it from the Hermes desktop app (Settings → Providers → Local models), or choose another model."
+
function keepConfiguredWithLocalRuntimeDown(reason: string) {
+ const pane = $localModelsEnabled.get()
+
writeCachedConfigured(true)
patch({ configured: true, reason })
notify({
- action: { label: 'Open Local models', onClick: () => requestRoute(LOCAL_MODELS_ROUTE) },
+ action: pane
+ ? { label: 'Open Local models', onClick: () => requestRoute(LOCAL_MODELS_ROUTE) }
+ : { label: 'Choose another model', onClick: () => setModelPickerOpen(true) },
id: 'local-runtime-unavailable',
kind: 'warning',
- message: reason,
+ message: pane ? reason : WEBAPP_LOCAL_RUNTIME_DOWN,
title: 'Local model unavailable'
})
}