Skip to content

The agent that grows with you

fix(desktop): a failed Skip setup keeps the run and says so

alt-glitch8932c5cbe7ca
diff --git a/apps/desktop/src/components/onboarding/skip-setup.tsx b/apps/desktop/src/components/onboarding/skip-setup.tsx
index 01e6a7cca58..d1487ace835 100644
--- a/apps/desktop/src/components/onboarding/skip-setup.tsx
+++ b/apps/desktop/src/components/onboarding/skip-setup.tsx
@@ -4,10 +4,11 @@ import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'
import { skipIntro } from '@/components/onboarding/first-run/intro'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
+import { notifyError } from '@/store/notifications'
import { $onboardingSession, skipOnboarding } from '@/store/onboarding-run'
-/** Skip setup, shown in the composer of the onboarding chat only. Like main's: the intro ends on the
- * previous layout at normal size and the tutorial tips stop, then the backend ends the run. */
+/** Skip setup, shown in the composer of the onboarding chat only. Once the backend has ended the run,
+ * like main's: the intro ends on the previous layout at normal size and the tutorial tips stop. */
export function OnboardingSkip({ sessionId }: { sessionId: null | string }) {
const session = useStore($onboardingSession)
@@ -27,10 +28,11 @@ function SkipButton({ runtimeId }: { runtimeId: string }) {
<Tip label={t.firstRun.skipTip}>
<button
className="ml-auto text-[11px] text-(--ui-text-quaternary) transition-colors hover:text-(--ui-text-secondary)"
- onClick={() => {
- skipIntro()
- void skipOnboarding(requestGateway, runtimeId)
- }}
+ onClick={() =>
+ void skipOnboarding(requestGateway, runtimeId).then(skipIntro, error =>
+ notifyError(error, t.firstRun.skipFailed)
+ )
+ }
type="button"
>
{t.firstRun.skip}
diff --git a/apps/desktop/src/i18n/ar_first_run.ts b/apps/desktop/src/i18n/ar_first_run.ts
index 08bea3419ba..5a113905980 100644
--- a/apps/desktop/src/i18n/ar_first_run.ts
+++ b/apps/desktop/src/i18n/ar_first_run.ts
@@ -21,6 +21,7 @@ export const arFirstRun: FirstRunCopy = {
skippedAll: 'تم تخطي الإعداد',
skip: 'تخطي الإعداد',
skipTip: 'إنهاء الإعداد الموجَّه. يمكنك متابعة المحادثة هنا.',
+ skipFailed: 'تعذّر تخطي الإعداد',
localModel: {
title: 'يمكن لهذا الكمبيوتر تشغيل نموذج محليًا',
text: (model, size) => `${model} (${size}) يناسب أجهزتك. يعمل مجانًا، وتبقى محادثاتك على هذا الكمبيوتر.`,
diff --git a/apps/desktop/src/i18n/de_first_run.ts b/apps/desktop/src/i18n/de_first_run.ts
index 325a2c7babd..5349ce3184b 100644
--- a/apps/desktop/src/i18n/de_first_run.ts
+++ b/apps/desktop/src/i18n/de_first_run.ts
@@ -21,6 +21,7 @@ export const deFirstRun: FirstRunCopy = {
skippedAll: 'Einrichtung übersprungen',
skip: 'Einrichtung überspringen',
skipTip: 'Beendet die geführte Einrichtung. Du kannst hier weiterchatten.',
+ skipFailed: 'Einrichtung konnte nicht übersprungen werden',
localModel: {
title: 'Dieser Computer kann ein Modell lokal ausführen',
text: (model, size) =>
diff --git a/apps/desktop/src/i18n/en_first_run.ts b/apps/desktop/src/i18n/en_first_run.ts
index ca69445943b..39d5c23108d 100644
--- a/apps/desktop/src/i18n/en_first_run.ts
+++ b/apps/desktop/src/i18n/en_first_run.ts
@@ -21,6 +21,7 @@ export const enFirstRun: FirstRunCopy = {
skippedAll: 'Setup skipped',
skip: 'Skip setup',
skipTip: 'End the guided setup. You can keep chatting here.',
+ skipFailed: 'Could not skip setup',
localModel: {
title: 'This computer can run a model locally',
text: (model, size) => `${model} (${size}) fits your hardware. It runs free, and your chats stay on this computer.`,
diff --git a/apps/desktop/src/i18n/es_first_run.ts b/apps/desktop/src/i18n/es_first_run.ts
index 6975e8f2ac7..16da3bd4843 100644
--- a/apps/desktop/src/i18n/es_first_run.ts
+++ b/apps/desktop/src/i18n/es_first_run.ts
@@ -21,6 +21,7 @@ export const esFirstRun: FirstRunCopy = {
skippedAll: 'Configuración omitida',
skip: 'Omitir configuración',
skipTip: 'Termina la configuración guiada. Puedes seguir chateando aquí.',
+ skipFailed: 'No se pudo omitir la configuración',
localModel: {
title: 'Este ordenador puede ejecutar un modelo localmente',
text: (model, size) =>
diff --git a/apps/desktop/src/i18n/fr_first_run.ts b/apps/desktop/src/i18n/fr_first_run.ts
index d06d84e7ef9..2fdfd7bb001 100644
--- a/apps/desktop/src/i18n/fr_first_run.ts
+++ b/apps/desktop/src/i18n/fr_first_run.ts
@@ -21,6 +21,7 @@ export const frFirstRun: FirstRunCopy = {
skippedAll: 'Configuration ignorée',
skip: 'Ignorer la configuration',
skipTip: 'Termine la configuration guidée. Vous pouvez continuer à discuter ici.',
+ skipFailed: 'Impossible d’ignorer la configuration',
localModel: {
title: 'Cet ordinateur peut exécuter un modèle en local',
text: (model, size) =>
diff --git a/apps/desktop/src/i18n/ja_first_run.ts b/apps/desktop/src/i18n/ja_first_run.ts
index 6833218ef19..051751f53f8 100644
--- a/apps/desktop/src/i18n/ja_first_run.ts
+++ b/apps/desktop/src/i18n/ja_first_run.ts
@@ -21,6 +21,7 @@ export const jaFirstRun: FirstRunCopy = {
skippedAll: 'セットアップをスキップしました',
skip: 'セットアップをスキップ',
skipTip: 'ガイド付きセットアップを終了します。このままチャットを続けられます。',
+ skipFailed: 'セットアップをスキップできませんでした',
localModel: {
title: 'このコンピューターはモデルをローカルで実行できます',
text: (model, size) =>
diff --git a/apps/desktop/src/i18n/ru_first_run.ts b/apps/desktop/src/i18n/ru_first_run.ts
index ec4fe565fe3..5946263b476 100644
--- a/apps/desktop/src/i18n/ru_first_run.ts
+++ b/apps/desktop/src/i18n/ru_first_run.ts
@@ -21,6 +21,7 @@ export const ruFirstRun: FirstRunCopy = {
skippedAll: 'Настройка пропущена',
skip: 'Пропустить настройку',
skipTip: 'Завершить пошаговую настройку. Можно продолжить общение здесь.',
+ skipFailed: 'Не удалось пропустить настройку',
localModel: {
title: 'Этот компьютер может запускать модель локально',
text: (model, size) =>
diff --git a/apps/desktop/src/i18n/types_first_run.ts b/apps/desktop/src/i18n/types_first_run.ts
index b61d23d0b69..36b8211b377 100644
--- a/apps/desktop/src/i18n/types_first_run.ts
+++ b/apps/desktop/src/i18n/types_first_run.ts
@@ -24,6 +24,7 @@ export interface FirstRunCopy {
skippedAll: string
skip: string
skipTip: string
+ skipFailed: string
localModel: {
title: string
text: (model: string, size: string) => string
diff --git a/apps/desktop/src/i18n/zh-hant_first_run.ts b/apps/desktop/src/i18n/zh-hant_first_run.ts
index ce786902036..e91105342ed 100644
--- a/apps/desktop/src/i18n/zh-hant_first_run.ts
+++ b/apps/desktop/src/i18n/zh-hant_first_run.ts
@@ -21,6 +21,7 @@ export const zhHantFirstRun: FirstRunCopy = {
skippedAll: '已略過設定',
skip: '略過設定',
skipTip: '結束引導設定。你可以繼續在這裡對話。',
+ skipFailed: '無法略過設定',
localModel: {
title: '這部電腦可以在本機執行模型',
text: (model, size) => `${model}(${size})適合你的硬體。它免費執行,你的對話會留在這部電腦上。`,
diff --git a/apps/desktop/src/i18n/zh_first_run.ts b/apps/desktop/src/i18n/zh_first_run.ts
index c9b9da9599d..2a6c6a41e56 100644
--- a/apps/desktop/src/i18n/zh_first_run.ts
+++ b/apps/desktop/src/i18n/zh_first_run.ts
@@ -21,6 +21,7 @@ export const zhFirstRun: FirstRunCopy = {
skippedAll: '已跳过设置',
skip: '跳过设置',
skipTip: '结束引导设置。你可以继续在这里对话。',
+ skipFailed: '无法跳过设置',
localModel: {
title: '这台电脑可以在本地运行模型',
text: (model, size) => `${model}(${size})适合你的硬件。它免费运行,你的对话会留在这台电脑上。`,
diff --git a/apps/desktop/src/store/onboarding-run.test.ts b/apps/desktop/src/store/onboarding-run.test.ts
index cfc41fbd388..ff120a1e35f 100644
--- a/apps/desktop/src/store/onboarding-run.test.ts
+++ b/apps/desktop/src/store/onboarding-run.test.ts
@@ -7,6 +7,7 @@ import {
$onboardingSettleFrom,
decideOnboarding,
noteSetupBeatResult,
+ skipOnboarding,
startOnboarding
} from './onboarding-run'
import { $connection, $selectedStoredSessionId } from './session'
@@ -78,4 +79,15 @@ describe('onboarding run', () => {
expect($onboardingSurfaceClear.get()).toBe(true)
expect($onboardingSettleFrom.get()).not.toBeNull()
})
+
+ it('keeps the run when the backend refuses the skip', async () => {
+ const { request } = backend({ eligible: true, run: true })
+ await startOnboarding(request, resume, { ensureProfile })
+
+ const refuse = async (): Promise<never> => Promise.reject(new Error('skip refused'))
+
+ await expect(skipOnboarding(refuse, 'rt-1')).rejects.toThrow('skip refused')
+ expect($onboardingPhase.get()).toBe('shown')
+ expect($onboardingEnded.get()).toBeNull()
+ })
})
diff --git a/apps/desktop/src/store/onboarding-run.ts b/apps/desktop/src/store/onboarding-run.ts
index 0259c5fd3ea..aadddb5f18b 100644
--- a/apps/desktop/src/store/onboarding-run.ts
+++ b/apps/desktop/src/store/onboarding-run.ts
@@ -194,14 +194,10 @@ export function endOnboarding(outcome: 'done' | 'skipped'): void {
$onboardingSettleFrom.set($onboardingSettleFrom.get() ?? Date.now())
}
-/** Skip setup: the backend ends the run and closes the card that waits. */
+/** Skip setup: the backend ends the run and closes the card that waits. A failed skip leaves the run
+ * going, so Skip setup stays on offer; the caller reports the error. */
export async function skipOnboarding(request: OnboardingRequest, runtimeId: string): Promise<void> {
- try {
- await request('onboarding.skip', { session_id: runtimeId })
- } catch (error) {
- console.warn('[onboarding] skip failed', error)
- }
-
+ await request('onboarding.skip', { session_id: runtimeId })
endOnboarding('skipped')
}
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index 1417c268468..2dbbba4e5ea 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -1544,6 +1544,7 @@
"firstRun.rerun.failed",
"firstRun.rerun.title",
"firstRun.skip",
+ "firstRun.skipFailed",
"firstRun.skipTip",
"firstRun.skippedAll",
"firstRun.useName",