The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): send assume_fresh only on a --fresh-install launch
alt-glitch49baad7c6e24
diff --git a/apps/desktop/src/store/onboarding-run.test.ts b/apps/desktop/src/store/onboarding-run.test.tsindex 2ab1261cbad..e52aa45ff2f 100644--- a/apps/desktop/src/store/onboarding-run.test.ts+++ b/apps/desktop/src/store/onboarding-run.test.ts@@ -243,11 +243,11 @@ describe('onboarding run', () => {})it('asks for a fresh-install run only on a --fresh-install launch, and never on a rerun', async () => {- const sent: (boolean | undefined)[] = []+ const sent: boolean[] = []const request = async <T,>(method: string, params?: OnboardingStartParams): Promise<T> => {if (method === 'onboarding.start') {- sent.push(params?.assume_fresh)+ sent.push(params !== undefined && 'assume_fresh' in params)}// SAFETY: the fake answers onboarding.start with its contract result shape.@@ -268,6 +268,7 @@ describe('onboarding run', () => {Object.defineProperty(window, 'hermesDesktop', { configurable: true, value: undefined })}+ // Only the fresh-install launch carries the field at all.expect(sent).toEqual([false, true, false])})diff --git a/apps/desktop/src/store/onboarding-run.ts b/apps/desktop/src/store/onboarding-run.tsindex 9c3c2c39ebf..6ad02ad8682 100644--- a/apps/desktop/src/store/onboarding-run.ts+++ b/apps/desktop/src/store/onboarding-run.ts@@ -11,7 +11,9 @@import type {OnboardingEndedPayload,OnboardingRunStateResult,- OnboardingStartResult+ OnboardingStartParams,+ OnboardingStartResult,+ OnboardingStateParams} from '@hermes/shared'import { atom, computed } from 'nanostores'@@ -87,7 +89,8 @@ $onboardingOnScreen.subscribe(onScreen => {* computer. */const factsSource = (): 'local' | 'remote' => ($connection.get()?.mode === 'local' ? 'local' : 'remote')-/** The unpackaged app's `--fresh-install` launch: the backend treats this machine as a first install. */+/** The unpackaged app's `--fresh-install` launch: the backend treats this machine as a first install.+ * Only then is `assume_fresh` sent; packaged launches and Settings reruns never carry the field. */const assumeFreshInstall = (): boolean => window.hermesDesktop?.assumeFreshInstall === true/** The first-run intro around a start (`components/onboarding/first-run/kickoff.ts`). */@@ -138,18 +141,19 @@ export async function startOnboarding(await ensureProfile(ONBOARDING_PROFILE)const connectionId = activeGatewayConnectionId()+ const params: OnboardingStartParams = {+ facts_source: factsSource(),+ fresh_launch: freshLaunch,+ locale: getRuntimeI18nLocale(),+ rerun+ }++ if (!rerun && assumeFreshInstall()) {+ params.assume_fresh = true+ }+// The request stays alive past the way out: its answer names the run the skip ends.- const started = await request<OnboardingStartResult>(- 'onboarding.start',- {- facts_source: factsSource(),- fresh_launch: freshLaunch,- locale: getRuntimeI18nLocale(),- rerun,- assume_fresh: !rerun && assumeFreshInstall()- },- intro ? NO_DEADLINE : undefined- )+ const started = await request<OnboardingStartResult>('onboarding.start', params, intro ? NO_DEADLINE : undefined)if (skipped) {await request('onboarding.skip', { session_id: started.session_id })@@ -224,12 +228,14 @@ export function decideOnboarding(async function readAndStart(request: OnboardingRequest, resume: OnboardingResume, options?: StartOptions): Promise<void> {try {+ const params: OnboardingStateParams = {}++ if (assumeFreshInstall()) {+ params.assume_fresh = true+ }+// One deadline for the due check: past it the app is released and a late answer opens nothing.- const state = await request<OnboardingRunStateResult>(- 'onboarding.state',- { assume_fresh: assumeFreshInstall() },- ONBOARDING_DECIDE_DEADLINE_MS- )+ const state = await request<OnboardingRunStateResult>('onboarding.state', params, ONBOARDING_DECIDE_DEADLINE_MS)if (state.run && state.eligible) {await startOnboarding(request, resume, { ...options, freshLaunch: true })