Skip to content

The agent that grows with you

fix(desktop): opening the onboarding intro acks the free-tier ready screen

alt-glitche0345ebb5614
diff --git a/apps/desktop/src/store/onboarding-run.test.ts b/apps/desktop/src/store/onboarding-run.test.ts
index 7656e34a4fc..a02f0b9d894 100644
--- a/apps/desktop/src/store/onboarding-run.test.ts
+++ b/apps/desktop/src/store/onboarding-run.test.ts
@@ -115,6 +115,16 @@ describe('onboarding run', () => {
expect($newChatProfile.get()).toBe('work')
})
+ it('acks the free-tier notice when the onboarding intro opens', async () => {
+ const { calls, request } = backend({ eligible: true, run: true })
+ const intro = { failed: vi.fn(), opened: vi.fn(), started: vi.fn(), starting: vi.fn() }
+
+ await startOnboarding(request, resume, { ensureProfile, intro })
+
+ expect(intro.opened).toHaveBeenCalled()
+ expect(calls).toContain('free_tier.ack_notice')
+ })
+
it('keeps the run when the backend refuses the skip', async () => {
const { request } = backend({ eligible: true, run: true })
await startOnboarding(request, resume, { ensureProfile })
diff --git a/apps/desktop/src/store/onboarding-run.ts b/apps/desktop/src/store/onboarding-run.ts
index 7fd8cae2eeb..48f2cf18609 100644
--- a/apps/desktop/src/store/onboarding-run.ts
+++ b/apps/desktop/src/store/onboarding-run.ts
@@ -14,7 +14,9 @@ import { atom, computed } from 'nanostores'
import { getRuntimeI18nLocale } from '@/i18n/runtime'
import type { GatewayRequester } from '@/lib/yolo-session'
+import { ackFreeTierNotice } from './free-tier'
import { activeGatewayConnectionId } from './gateway'
+import { clearFreeTierIntro } from './onboarding'
import { $onboardingPhase } from './onboarding-phase'
import { markOnboardingDecided, setOnboardingSurfaceActive } from './onboarding-presence'
import { $activeGatewayProfile, ensureGatewayAgent, ensureGatewayProfile, newSessionInProfile } from './profile'
@@ -155,7 +157,11 @@ export async function startOnboarding(
// The chat is on screen before the run names it, so the presence never sees a gap.
await resume(started.stored_session_id, true)
$onboardingSession.set({ runtimeId: started.session_id, storedId: started.stored_session_id })
- intro?.opened(started)
+
+ if (intro) {
+ intro.opened(started)
+ ackFreeTierIntro(request)
+ }
return true
} catch (error) {
@@ -173,6 +179,16 @@ export async function startOnboarding(
}
}
+// The onboarding intro is the free-tier introduction, as on main: the ready screen must not follow it.
+function ackFreeTierIntro(request: OnboardingRequest): void {
+ clearFreeTierIntro()
+ void ackFreeTierNotice(request).then(acked => {
+ if (acked) {
+ clearFreeTierIntro()
+ }
+ })
+}
+
// Like main's failed kickoff: the window goes back to where it was before the switch.
async function returnToLaunchProfile(ensureProfile: (profile: string) => Promise<void>): Promise<void> {
if (!launch) {
diff --git a/apps/desktop/src/store/onboarding.ts b/apps/desktop/src/store/onboarding.ts
index 43e149b87f7..b32cf7ae043 100644
--- a/apps/desktop/src/store/onboarding.ts
+++ b/apps/desktop/src/store/onboarding.ts
@@ -858,9 +858,9 @@ async function applyFreeTierIntro(ctx: OnboardingContext, runtime: RuntimeReadin
setFreeTierRoute(runtime.freeTier)
await refreshFreeTierStatus(ctx.requestGateway)
- // Onboarding's Start IS the introduction and acks the notice; a
- // Skip leaves it owed. Read the status when the overlay is free, not now,
- // so an ack made meanwhile is honoured.
+ // The onboarding intro is the introduction: opening it acks the notice
+ // (store/onboarding-run.ts). Read the status when the overlay is free, not
+ // now, so that ack is honoured.
afterOnboardingSurfaceClear(() => {
if (freeTierReadyPending($freeTierStatus.get(), runtime.freeTier ?? null)) {
patch({ freeTierReady: true })