The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(free-tier): the guest token seam mints inference only for the welcome trial
alt-glitch849470881a8f
diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.pyindex 405d26701c8..d323140285b 100644--- a/hermes_cli/anon_auth.py+++ b/hermes_cli/anon_auth.py@@ -714,6 +714,10 @@ def refresh_guest_state(state: dict[str, Any], client: httpx.Client, *, purpose:Raises :class:`AnonCredentialDead` when NAS no longer knows the credential; the caller ownsre-minting (:func:`ensure_portal_identity` after :func:`clear_dead_guest`)."""+ if purpose == "inference" and not free_inference_active(state):+ # The one place a guest's inference token is minted: only the welcome trial on the desktop's+ # local backend carries one. Not terminal: the guest stays for connectors.+ raise AuthError("Hermes is not logged into Nous Portal.", provider="nous", code="nous_auth_missing")anon_token = state.get("anon_token")if not isinstance(anon_token, str) or not anon_token:raise AnonCredentialDead(ANON_FAILURE_COPY[ANON_CREDENTIAL_DEAD], code=ANON_CREDENTIAL_DEAD)diff --git a/tests/hermes_cli/test_welcome_trial.py b/tests/hermes_cli/test_welcome_trial.pyindex a2239a87365..1ea50386cb8 100644--- a/tests/hermes_cli/test_welcome_trial.py+++ b/tests/hermes_cli/test_welcome_trial.py@@ -194,3 +194,33 @@ def test_a_leftover_guest_pool_row_is_not_reported_as_a_nous_login(portal, monke# Provider setup would otherwise tag Nous Portal "Connected" for a credential that runs nothing.assert get_nous_auth_status_local()["logged_in"] is False++[email protected]("desktop", [True, False], ids=["local_desktop_backend", "elsewhere"])+def test_a_connector_guest_pinned_to_nous_gets_no_inference_token(portal, monkeypatch, desktop):+ from hermes_cli.auth_constants import AuthError+ from hermes_cli.runtime_provider import resolve_runtime_provider+ from hermes_constants import get_hermes_home++ if desktop:+ as_local_desktop_backend(monkeypatch)+ anon_auth.ensure_portal_identity(explicit=True) # a connector action's guest, never claimed+ (get_hermes_home() / "config.yaml").write_text("model:\n provider: nous\n default: nous/welcome\n",+ encoding="utf-8")+ with contextlib.suppress(AuthError):+ resolve_runtime_provider(requested="nous")++ assert [r["body"].get("purpose") for r in portal.token_requests if r["body"].get("purpose") != "connectors"] == []+++def test_the_token_seam_refuses_an_inference_token_to_a_guest_without_the_trial(portal, monkeypatch):+ import httpx++ from hermes_cli.auth_constants import AuthError++ as_local_desktop_backend(monkeypatch)+ state = dict(anon_auth.ensure_portal_identity(explicit=True)) # a connector guest+ with httpx.Client() as client, pytest.raises(AuthError):+ anon_auth.refresh_guest_state(state, client, purpose="inference")++ assert not [r for r in portal.token_requests if r["body"].get("purpose") != "connectors"]