The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a hardware read a connection switch overtook offers nothing
alt-glitchea0d877d91f7
diff --git a/apps/desktop/src/store/local-setup-offer.test.ts b/apps/desktop/src/store/local-setup-offer.test.tsindex 1f0518ea326..c1f0e8cad57 100644--- a/apps/desktop/src/store/local-setup-offer.test.ts+++ b/apps/desktop/src/store/local-setup-offer.test.ts@@ -15,15 +15,26 @@ vi.mock('@/hermes', async importOriginal => ({const row = (id: string, recommended: boolean): LocalCatalogModel =>({ fits: true, id, recommended }) as unknown as LocalCatalogModel-async function eligibilityFor(models: LocalCatalogModel[]) {- backend.status.mockResolvedValue({ models: [], runtime_installed: false } as unknown as LocalModelsStatus)- backend.catalog.mockResolvedValue({ models })+const NO_RUNTIME = { models: [], runtime_installed: false } as unknown as LocalModelsStatus++const connection = (mode: 'local' | 'remote', baseUrl = 'http://127.0.0.1:9') =>+ ({ baseUrl, isFullscreen: false, mode }) as HermesConnection++async function connectLocal() {const { $localModelsEnabled } = await import('./local-models-flag')const { $connection } = await import('./session')const { refreshLocalSetupEligibility } = await import('./local-setup-offer')$localModelsEnabled.set(true)- $connection.set({ baseUrl: 'http://127.0.0.1:9', isFullscreen: false, mode: 'local' } as HermesConnection)+ $connection.set(connection('local'))++ return { $connection, refreshLocalSetupEligibility }+}++async function eligibilityFor(models: LocalCatalogModel[]) {+ backend.status.mockResolvedValue(NO_RUNTIME)+ backend.catalog.mockResolvedValue({ models })+ const { refreshLocalSetupEligibility } = await connectLocal()return refreshLocalSetupEligibility()}@@ -47,4 +58,17 @@ describe('local-setup offer eligibility', () => {expect(result.fit).toBeNull()})++ it("answers nothing from a read a connection change overtook, never the old machine's fit", async () => {+ let finish = (_status: LocalModelsStatus) => {}+ backend.status.mockReturnValue(new Promise<LocalModelsStatus>(resolve => (finish = resolve)))+ backend.catalog.mockResolvedValue({ models: [row('qwen3.6-35b-a3b', true)] })+ const { $connection, refreshLocalSetupEligibility } = await connectLocal()++ const read = refreshLocalSetupEligibility()+ $connection.set(connection('remote', 'https://homelab.example'))+ finish(NO_RUNTIME)++ expect((await read).fit).toBeNull()+ })})diff --git a/apps/desktop/src/store/local-setup-offer.ts b/apps/desktop/src/store/local-setup-offer.tsindex 64f15ed92a9..1b449af5f9c 100644--- a/apps/desktop/src/store/local-setup-offer.ts+++ b/apps/desktop/src/store/local-setup-offer.ts@@ -101,8 +101,9 @@ export function refreshLocalSetupEligibility(): Promise<Eligibility> {transient: true})).then(result => {+ // The connection changed while reading: the answer describes a machine this window has left.if (generation !== eligibilityGeneration) {- return result+ return { checkedAt: Date.now(), fit: null, reason: 'connection changed while reading', transient: true }}eligibilityRead = null