The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(free-tier): once claimed, the welcome trial runs every surface
alt-glitch6c5d3c97828f
diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.pyindex f553383a563..131c983e468 100644--- a/hermes_cli/anon_auth.py+++ b/hermes_cli/anon_auth.py@@ -5,9 +5,9 @@ trial (``hermes_cli.welcome_trial``), and on the first hosted connector action fNous identity (``tools.connectors.gateway.config.ensure_guest_identity``, gated by ``guest_allowed``).Either mints an anonymous Nous account (``POST /api/anonymous/create``); its ``anon_`` credential islater exchanged for short-lived JWTs (``POST /api/anonymous/token``). The result is persisted as the-singleton ``providers.nous``. Only a guest stamped with the trial claim carries inference, and only on-the backend the desktop spawned on this machine (:func:`free_inference_active`); every other guest-serves connectors and managed tools. In the resolver ladder (``resolve_provider``) a guest that+singleton ``providers.nous``. Only a guest stamped with the trial claim carries inference+(:func:`free_inference_active`), on every surface of the install once the desktop claimed it: chats,+cron, side agents, workers, the CLI. Every other guest serves connectors and managed tools. In the resolver ladder (``resolve_provider``) a guest thatcarries inference sits directly above the implicit AWS Bedrock chain (NS-829): any explicit provider(env key, ``model.provider``, OpenRouter pool, a logged-in ``active_provider``) beats it, and theladder never creates one.@@ -208,11 +208,11 @@ def on_local_desktop_backend() -> bool:def free_inference_active(state: Any = None) -> bool:- """The welcome trial carries inference here: a guest that claimed it (or was grandfathered),- guests still allowed, and this is the desktop's local backend. *state* defaults to the profile's."""+ """The welcome trial carries inference: a guest that claimed it (or was grandfathered) and guests+ still allowed. Only the claim is the local Desktop's (``welcome_trial``); once claimed, every+ surface of the install runs on it. *state* defaults to the profile's."""state = current_nous_state() if state is None else state- return (is_guest_state(state) and state.get(WELCOME_CLAIM_FLAG) is True and guest_allowed()- and on_local_desktop_backend())+ return is_guest_state(state) and state.get(WELCOME_CLAIM_FLAG) is True and guest_allowed()def has_free_tier_account() -> bool:diff --git a/tests/agent/test_credential_pool_connectors_guest.py b/tests/agent/test_credential_pool_connectors_guest.pyindex c54fcf7a3dc..939cfef82ae 100644--- a/tests/agent/test_credential_pool_connectors_guest.py+++ b/tests/agent/test_credential_pool_connectors_guest.py@@ -9,7 +9,7 @@ from hermes_cli import anon_authfrom tests.hermes_cli.anon_portal import claimed_trial, install_portal-def test_guest_pool_row_is_dropped_outside_the_desktop_backend(monkeypatch, tmp_path):+def test_a_claimed_guest_pool_row_serves_every_surface(monkeypatch, tmp_path):from agent.credential_pool import load_poolfrom hermes_cli.auth_nous import resolve_nous_runtime_credentials@@ -18,7 +18,6 @@ def test_guest_pool_row_is_dropped_outside_the_desktop_backend(monkeypatch, tmp_resolve_nous_runtime_credentials() # the claimed guest now carries an inference tokenassert any(e.source == "device_code" for e in load_pool("nous").entries())- monkeypatch.delenv("HERMES_DESKTOP")+ monkeypatch.delenv("HERMES_DESKTOP") # cron, the CLI, a side agent: not the Desktop- assert not any(e.source == "device_code" for e in load_pool("nous").entries())- assert anon_auth.has_guest()+ assert any(e.source == "device_code" for e in load_pool("nous").entries())diff --git a/tests/gateway/test_local_desktop_identity.py b/tests/gateway/test_local_desktop_identity.pyindex 89ee372e6e7..57572de03aa 100644--- a/tests/gateway/test_local_desktop_identity.py+++ b/tests/gateway/test_local_desktop_identity.py@@ -160,9 +160,10 @@ async def test_a_trial_users_desktop_chat_runs_on_the_free_model(tmp_path, monkereceipt = local_receipt(conn.authority.db, created["result"]["stored_session_id"])assert receipt["policy"]["model"] == anon_auth.GUEST_MODEL- conn.transport.desktop_local = False # the trial is the local Desktop's only- refused = await _request(conn, 3, "session.create", {"source": "gui", "request_id": "b"})- assert "error" in refused, refused+ conn.transport.desktop_local = False # only the claim is the Desktop's; every chat runs on it+ other = await _request(conn, 3, "session.create", {"source": "gui", "request_id": "b"})+ assert "result" in other, other+ assert local_receipt(conn.authority.db, other["result"]["stored_session_id"])["policy"]["model"] == anon_auth.GUEST_MODELfinally:await conn.connection.close()diff --git a/tests/hermes_cli/test_anon_auth_core.py b/tests/hermes_cli/test_anon_auth_core.pyindex 9ecb9016e6e..ce3b9cbe0f4 100644--- a/tests/hermes_cli/test_anon_auth_core.py+++ b/tests/hermes_cli/test_anon_auth_core.py@@ -88,13 +88,11 @@ class TestIdentityLifecycle:with pytest.raises(anon_auth.AuthError):resolve_provider("auto")- def test_a_claimed_trial_carries_inference_only_on_the_local_desktop_backend(self, portal, monkeypatch):+ def test_a_claimed_trial_carries_inference_on_every_surface(self, portal, monkeypatch):claimed_trial(monkeypatch)- assert resolve_provider("auto") == "nous"monkeypatch.delenv("HERMES_DASHBOARD_SESSION_TOKEN") # a CLI shell beside the desktop- assert anon_auth.free_inference_active() is False- with pytest.raises(anon_auth.AuthError):- resolve_provider("auto")+ assert anon_auth.free_inference_active() is True+ assert resolve_provider("auto") == "nous"class TestExplicitProvision:diff --git a/tests/hermes_cli/test_anon_surfaces.py b/tests/hermes_cli/test_anon_surfaces.pyindex de87f789674..fe25177ebcc 100644--- a/tests/hermes_cli/test_anon_surfaces.py+++ b/tests/hermes_cli/test_anon_surfaces.py@@ -212,12 +212,12 @@ def test_the_paid_tool_notice_switches_wording_inside_a_chat():) == nous_account.FREE_TIER_NEEDS_ACCOUNT-def test_a_claimed_guest_off_the_desktop_backend_is_not_the_free_tier(isolated_store, monkeypatch, capsys):- """On the CLI surface the trial carries no inference: the guest reads as not signed in."""+def test_a_claimed_guest_reads_as_the_free_tier_on_the_cli_too(isolated_store, monkeypatch, capsys):+ """Once the Desktop claimed the trial, the CLI runs on it as well."""monkeypatch.delenv("HERMES_DESKTOP", raising=False)monkeypatch.delenv("HERMES_DASHBOARD_SESSION_TOKEN", raising=False)_write_auth(_guest_state())auth_commands.auth_status_command(SimpleNamespace(provider="nous"))text = capsys.readouterr().out- assert "free tier" not in text.lower() and anon_auth.GUEST_MODEL not in text+ assert "free tier" in text.lower()diff --git a/tests/hermes_cli/test_provider_precedence.py b/tests/hermes_cli/test_provider_precedence.pyindex 7356dc83948..323a204f384 100644--- a/tests/hermes_cli/test_provider_precedence.py+++ b/tests/hermes_cli/test_provider_precedence.py@@ -126,14 +126,11 @@ class TestFreeTierBeatsImplicitHostCredentials:_config(monkeypatch, {"provider": config_provider, "default": "some-model"})assert resolve_provider("auto") == expected- def test_on_the_cli_surface_a_claimed_guest_never_resolves_to_nous(self, portal, monkeypatch):+ def test_on_the_cli_surface_a_claimed_guest_still_beats_host_credentials(self, portal, monkeypatch):_claimed_trial_with_aws(monkeypatch)monkeypatch.delenv("HERMES_DESKTOP", raising=False)monkeypatch.delenv("HERMES_DASHBOARD_SESSION_TOKEN", raising=False)- assert resolve_provider("auto") == "bedrock"- monkeypatch.setattr("agent.bedrock_adapter.has_aws_credentials", lambda *_a, **_kw: False)- with pytest.raises(AuthError):- resolve_provider("auto")+ assert resolve_provider("auto") == "nous"def test_skip_free_tier_answers_what_else_would_carry_inference(self, portal, monkeypatch):"""With the free tier hidden, a claimed trial is not an answer and the ladder falls throughdiff --git a/tests/hermes_cli/test_welcome_trial.py b/tests/hermes_cli/test_welcome_trial.pyindex 02d23fcf4e8..de394eee8e0 100644--- a/tests/hermes_cli/test_welcome_trial.py+++ b/tests/hermes_cli/test_welcome_trial.py@@ -68,12 +68,12 @@ def test_a_connector_guest_neither_claims_nor_carries_inference(portal, monkeypaassert [r["body"]["purpose"] for r in portal.token_requests] == ["connectors"]-def test_a_claimed_guest_carries_inference_only_on_the_local_desktop_backend(portal, monkeypatch):+def test_a_claimed_trial_carries_inference_outside_the_desktop_too(portal, monkeypatch):state = claimed_trial(monkeypatch)monkeypatch.delenv("HERMES_DASHBOARD_SESSION_TOKEN") # the same home, read by a CLI process- assert not anon_auth.free_inference_active()- assert anon_auth.guest_without_free_tier(state)+ assert anon_auth.free_inference_active()+ assert not anon_auth.guest_without_free_tier(state)def _chat(db_path, model: str) -> None: