The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: document recovery limits and verify consented gateway launches
Tekniumddc1b0a1b750
diff --git a/tests/hermes_cli/test_gateway_startup_consent.py b/tests/hermes_cli/test_gateway_startup_consent.pynew file mode 100644index 00000000000..65b4ebcaa81--- /dev/null+++ b/tests/hermes_cli/test_gateway_startup_consent.py@@ -0,0 +1,25 @@+"""A consented launch reaches the canonical transport with its scoped options."""+import os+import sys++import pytest+++def test_gateway_launch_honors_interactive_consent_without_policy_environment_mutation(monkeypatch):+ from hermes_cli import main+ from tests.hermes_cli.test_cli_startup_model_cost_guard import _chat_args+ import hermes_cli.gateway_chat as transport+ captured = []+ monkeypatch.setattr('hermes_cli.config.load_config', lambda: {+ 'model': {'provider': 'openai-codex', 'default': 'gpt-5.5'}})+ monkeypatch.setattr(sys.stdin, 'isatty', lambda: True)+ monkeypatch.setattr(transport, 'launch_from_args', lambda args: captured.append(vars(args).copy()) or 0)+ before = dict(os.environ)+ for answer, admitted in [('no', False), ('yes', True)]:+ monkeypatch.setattr('builtins.input', lambda prompt: answer)+ with pytest.raises(SystemExit) as result:+ main.cmd_chat(_chat_args(model='openai/gpt-5.5-pro', ignore_rules=True, max_turns=3))+ assert result.value.code == (0 if admitted else 1)+ assert bool(captured) == admitted+ assert captured[0]['ignore_rules'] is True and captured[0]['max_turns'] == 3+ assert dict(os.environ) == beforediff --git a/website/docs/developer-guide/gateway-internals.md b/website/docs/developer-guide/gateway-internals.mdindex 62d79f8eb58..1c6c8f1d444 100644--- a/website/docs/developer-guide/gateway-internals.md+++ b/website/docs/developer-guide/gateway-internals.md@@ -137,6 +137,27 @@ probes in `tests/gateway/test_native_http_auth.py`, alongside gated OAuth/cookieactual non-loopback-peer controls. This does not establish native Desktop UI parityor platform-specific Windows/macOS bootstrap validation.+## Frozen local launch credentials++Local `session.create` receipts retain the launch policy, not plaintext API keys.+Inline credentials in the profile config are borrowed from that existing private+source after restart: the canonical profile home, credential path, value fingerprint,+and frozen policy identity must match. Provider endpoints and request settings still+come from the frozen policy, not the current config. Missing or changed credentials+fail closed rather than selecting a different key. No second secret store is created.+Credential-bearing headers, environment maps, and terminal projections are redacted+from durable policy JSON and hydrated privately through the same source checks.++Retrying a creation request returns its original session and policy without binding+current replacement credentials. An ad-hoc `--api-key` remains authority-lifetime-only;+restart revokes that key, not config-based sessions. Older receipts that contain only+an instance-bound credential reference cannot securely recover a lost value and remain+fail-closed. Their history is still readable; create a new session to adopt current+credentials. Credential fingerprints are private metadata, never public API responses.++CLI cost/data-training consent runs before gateway discovery and session creation,+including top-level one-shot launches. It does not become a process-wide option.+## Key Files| File | Purpose |