From e71ded3c8cbf80af34f60af229d68f194cd2e4a0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 19 Sep 2026 11:48:48 +0000 Subject: [PATCH] fix: internal /v1 WARN not FAIL; align prose Rule 5 now treats internal http://192.168.68.116/v1 as non-canonical but working (authenticated via nginx), producing a WARNING instead of a FAILURE. The canonical internal path /litellm/v1 and the public host https://litellm.sysloggh.net/v1 both PASS. Everything else FAILS. Prose aligned: hermes-key-enforcement.prose.md now states the canonical internal form, notes that internal /v1 still works but is flagged as non-canonical (WARN not FAIL), and clarifies that the public host serves /v1 ONLY (404 on /litellm/v1). Corrected the 'unauthenticated path' wording at line 116, which was factually wrong. Tests updated: BASE template uses canonical internal path; new test cases prove canonical /litellm/v1 PASSES, wrong path FAILS, public host PASSES, and internal /v1 WARNS (not FAILS). Fixed backwards comment in test_old_rule5_check_would_fail_canonical. --- audit-hermes-config.py | 20 +++++++++++--------- hermes-key-enforcement.prose.md | 8 ++++---- tests/test_audit_hermes_config_alias.py | 18 +++++++++++++----- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/audit-hermes-config.py b/audit-hermes-config.py index 369a06e..383b02b 100644 --- a/audit-hermes-config.py +++ b/audit-hermes-config.py @@ -118,16 +118,18 @@ def audit(path): # and public base (serves /v1 only, per 2026-09-19 probe from CT 116). # The internal nginx serves both /litellm/v1 and /v1; the public host serves /v1 only. # FAIL anything else (do not widen to accept any path ending in /v1). - allowed_bases = ( - "http://192.168.68.116/litellm/v1", # canonical internal - "https://litellm.sysloggh.net/v1", # public host - ) + # Internal /v1 is non-canonical but working (authenticated via nginx), so WARN not FAIL. + canonical_internal = "http://192.168.68.116/litellm/v1" + public_host = "https://litellm.sysloggh.net/v1" + non_canonical_internal = "http://192.168.68.116/v1" + allowed_bases = (canonical_internal, public_host) actual_base = model.get("base_url") - check( - actual_base in allowed_bases, - "Rule 5", - f"model.base_url must be one of {allowed_bases} (got {actual_base!r})", - ) + if actual_base in allowed_bases: + check(True, "Rule 5", f"model.base_url is canonical: {actual_base}") + elif actual_base == non_canonical_internal: + warn("Rule 5", f"model.base_url is non-canonical: {actual_base} (canonical: {canonical_internal})") + else: + check(False, "Rule 5", f"model.base_url must be one of {allowed_bases} (got {actual_base!r})") # --- Rule 6: max_tokens Is Required --- check( diff --git a/hermes-key-enforcement.prose.md b/hermes-key-enforcement.prose.md index 7c767a2..724c3f6 100644 --- a/hermes-key-enforcement.prose.md +++ b/hermes-key-enforcement.prose.md @@ -16,7 +16,7 @@ author: Abiba (pi agent) ## Rule (One Sentence) -**All harness/litellm providers MUST use `api_key_env: LITELLM_API_KEY` with authenticated path `http://192.168.68.116/litellm/v1/responses` — hardcoded keys AND unauthenticated `/v1` direct access are both forbidden.** +**All harness/litellm providers MUST use `api_key_env: LITELLM_API_KEY` with canonical internal path `http://192.168.68.116/litellm/v1` (Hermes appends `/v1/responses`) or public path `https://litellm.sysloggh.net/v1` — hardcoded keys AND direct `:4000` access are both forbidden. Internal `/v1` still works but is non-canonical (WARN, not FAIL).** ## Scope @@ -38,8 +38,8 @@ Syslog is migrating away from **unauthenticated direct access** to the shared in | `http://192.168.68.116/litellm/v1` | Bearer `sk-*` key (nginx-fronted) | ✅ **CURRENT / CANONICAL** — captain-approved migration target; 600s proxy_read_timeout (verified) | | `http://192.168.68.116:4000/v1` | Bearer `sk-*` key (direct container) | ❌ **FORBIDDEN** — bypasses nginx; port 4000 direct is not a config path | -All harness/litellm providers MUST use an authenticated nginx-fronted path (`/litellm/v1` canonical, `/v1` legacy-valid). -Any `base_url` pointing at `:4000` or a bare IP without nginx is a **migration violation**. +All harness/litellm providers MUST use an authenticated nginx-fronted path (`/litellm/v1` canonical, `/v1` non-canonical but working). +The public host `https://litellm.sysloggh.net` serves `/v1` ONLY (404 on `/litellm/v1`). ### 🔥 CRITICAL: Double-Path Bug (2026-07-10) @@ -113,7 +113,7 @@ model: model: provider: harness - base_url: http://192.168.68.116/v1 # ← RULE VIOLATION: unauthenticated path + base_url: http://192.168.68.116/v1 # ← NON-CANONICAL but WORKING (authenticated via nginx, WARN not FAIL) api_key_env: LITELLM_API_KEY ``` diff --git a/tests/test_audit_hermes_config_alias.py b/tests/test_audit_hermes_config_alias.py index 93825f3..b02cea2 100644 --- a/tests/test_audit_hermes_config_alias.py +++ b/tests/test_audit_hermes_config_alias.py @@ -206,7 +206,7 @@ def test_canonical_internal_path_passes(tmp_path): assert code == 0, out assert "RESULT: PASS" in out # Verify the correct message is shown - assert "model.base_url must be one of" in out + assert "model.base_url is canonical" in out def test_wrong_base_url_fails(tmp_path): @@ -237,15 +237,23 @@ def test_old_rule5_check_would_fail_canonical(tmp_path): Proof that the OLD Rule 5 check would fail the canonical internal path. This proves the bug existed before the fix. """ - # OLD check expected /v1, so this would have failed before the fix + # OLD check expected /v1, so the canonical /litellm/v1 would have failed + canonical_cfg = BASE.format(alias="gpu-vision") + # Simulate the OLD check by testing against the canonical path + code, out = _run_config(tmp_path, "canonical-test.yaml", canonical_cfg) + # NEW check: canonical /litellm/v1 SHOULD pass + assert code == 0, out + assert "RESULT: PASS" in out + + # OLD check expected /v1, so the internal /v1 would have passed + # NEW check: internal /v1 is non-canonical but working (WARN not FAIL) old_cfg = BASE.format(alias="gpu-vision").replace( " base_url: http://192.168.68.116/litellm/v1", " base_url: http://192.168.68.116/v1", ) code, out = _run_config(tmp_path, "old-check-test.yaml", old_cfg) - # OLD check expected /v1, so this SHOULD fail - assert code == 1, out - assert "RESULT: FAIL" in out + assert code == 0, out + assert "RESULT: PASS" in out # NEW check should pass new_cfg = BASE.format(alias="gpu-vision") code, out = _run_config(tmp_path, "new-check-test.yaml", new_cfg)