The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): the local-model card stops re-reading eligibility in a loop
alt-glitch2bdad022c630
diff --git a/apps/desktop/src/app/chat/composer/local-setup-card.test.tsx b/apps/desktop/src/app/chat/composer/local-setup-card.test.tsxnew file mode 100644index 00000000000..8b6512e2dd4--- /dev/null+++ b/apps/desktop/src/app/chat/composer/local-setup-card.test.tsx@@ -0,0 +1,23 @@+import { render } from '@testing-library/react'+import { beforeEach, describe, expect, it, vi } from 'vitest'++vi.mock('@/app/chat/session-view', () => ({ useSessionView: () => ({ kind: 'primary' }) }))+vi.mock('./scope', () => ({ useComposerScope: () => ({ target: 'main' }) }))++describe('LocalSetupCard', () => {+ beforeEach(() => {+ vi.resetModules()+ // A relaunch: the card was shown last run, and the backend connection is not there yet.+ localStorage.setItem('hermes.desktop.offers.local-setup.v1', JSON.stringify({ state: 'shown' }))+ })++ it('settles on one answer while there is no connection instead of re-reading in a loop', async () => {+ const { $localModelsEnabled } = await import('@/store/local-models-flag')+ const { $localSetupEligibility } = await import('@/store/local-setup-offer')+ const { LocalSetupCard } = await import('./local-setup-card')+ $localModelsEnabled.set(true)++ expect(() => render(<LocalSetupCard busy={false} guidedChat={false} />)).not.toThrow()+ expect($localSetupEligibility.get()?.reason).toBe('connection not established yet')+ })+})diff --git a/apps/desktop/src/app/chat/composer/local-setup-card.tsx b/apps/desktop/src/app/chat/composer/local-setup-card.tsxindex b494ef8a463..eba2a5955f1 100644--- a/apps/desktop/src/app/chat/composer/local-setup-card.tsx+++ b/apps/desktop/src/app/chat/composer/local-setup-card.tsx@@ -39,9 +39,10 @@ export function LocalSetupCard({ busy, guidedChat }: LocalSetupCardProps) {const { t } = useI18n()const copy = t.composer.localSetup- // No answer yet (relaunch, or the backend just changed) or a failed one: ask again.+ // No answer yet (relaunch, or the backend just changed): ask. A failed answer stays until the backend changes,+ // which clears it, so a backend that is down is not asked again on every failure.useEffect(() => {- if (offer.state === 'shown' && (!eligibility || eligibility.transient)) {+ if (offer.state === 'shown' && !eligibility) {void readLocalSetupEligibility()}}, [offer.state, eligibility])diff --git a/tests/hermes_cli/test_setup_profile_answers.py b/tests/hermes_cli/test_setup_profile_answers.pynew file mode 100644index 00000000000..0e2c646cded--- /dev/null+++ b/tests/hermes_cli/test_setup_profile_answers.py@@ -0,0 +1,33 @@+"""Setup keeps what is already there: a re-sent /initiate-setup keeps the picks, and a Reset run from the setup+chat itself still gets the launch profile's skills."""++from agent import initiate_setup_prompt+from hermes_cli import profiles, setup_profile+++def test_resent_setup_prompt_keeps_the_recorded_picks(tmp_path, monkeypatch):+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ monkeypatch.setattr(setup_profile, "read_state", lambda: {})+ monkeypatch.setattr("hermes_cli.anon_auth.free_tier_route", lambda: None)+ setup_profile.record_cards("s1", {"pick_ids": ["github"], "picks": {"plugins": ["blender"]}})++ initiate_setup_prompt.build_initiate_setup_prompt("desktop", [], "default", session_id="s1")++ cards = setup_profile.read_cards("s1")+ assert cards["pick_ids"] == ["github"]+ assert cards["picks"] == {"plugins": ["blender"]}+ assert "fork" in cards+++def test_reset_run_from_the_setup_profile_copies_the_launch_profiles_skills(tmp_path, monkeypatch):+ launch, setup = tmp_path / "launch", tmp_path / "hermes-setup"+ for home in (launch, setup):+ (home / "skills" / "notes").mkdir(parents=True)+ (home / "skills" / "notes" / "SKILL.md").write_text("notes", encoding="utf-8")+ (setup / profiles.SETUP_PROFILE_MARKER).write_text("{}", encoding="utf-8")+ monkeypatch.setenv("HERMES_HOME", str(setup))+ monkeypatch.setattr(setup_profile, "find_setup_profile", lambda: ("hermes-setup", setup))++ setup_profile.reset_setup_profile(launch)++ assert (setup / "skills" / "notes" / "SKILL.md").read_text(encoding="utf-8") == "notes"