From 1c9ffb177c378bba24ef208ba8f551722961c655 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 9 May 2026 13:37:19 -0700 Subject: [PATCH] fix(model-metadata): align hy3-preview static fallback + delete change-detector test (#22805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two co-located fixes: 1. agent/model_metadata.py: bump hy3-preview static fallback from 256000 to 262144 (256 * 1024) to match OpenRouter live metadata so cache and offline both agree (issue #22268). 2. tests/hermes_cli/test_tencent_tokenhub_provider.py: replace the exact-value change-detector (assert ctx == 256000) with an invariant assertion (registered + >= 4096). Per AGENTS.md 'Don't write change-detector tests': pinning the upstream-controlled context length is exactly the test class the rule forbids — it breaks every time the provider bumps the published value, with zero behavioral coverage gained. Salvage of #22574 with a redirect on the test approach. The contributor's diff bumped the integer and added a SECOND change-detector pinning DEFAULT_CONTEXT_LENGTHS[hy3-preview] == 262144, which would re-break on the next published bump. We instead delete the change-detector entirely and assert the relationship. Closes #22268. --- agent/model_metadata.py | 6 ++++-- tests/hermes_cli/test_tencent_tokenhub_provider.py | 14 +++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/agent/model_metadata.py b/agent/model_metadata.py index 4df8a607779..ec75f7cfd90 100644 --- a/agent/model_metadata.py +++ b/agent/model_metadata.py @@ -210,8 +210,10 @@ DEFAULT_CONTEXT_LENGTHS = { "grok": 131072, # catch-all (grok-beta, unknown grok-*) # Kimi "kimi": 262144, - # Tencent — Hy3 Preview (Hunyuan) with 256K context window - "hy3-preview": 256000, + # Tencent — Hy3 Preview (Hunyuan) with 256K context window. + # OpenRouter live metadata reports 262144 (256 × 1024); align the + # static fallback so cache and offline both agree (issue #22268). + "hy3-preview": 262144, # Nemotron — NVIDIA's open-weights series (128K context across all sizes) "nemotron": 131072, # Arcee diff --git a/tests/hermes_cli/test_tencent_tokenhub_provider.py b/tests/hermes_cli/test_tencent_tokenhub_provider.py index 62cecaeb0c3..eac3b760013 100644 --- a/tests/hermes_cli/test_tencent_tokenhub_provider.py +++ b/tests/hermes_cli/test_tencent_tokenhub_provider.py @@ -304,12 +304,20 @@ class TestTencentTokenhubURLMapping: class TestTencentTokenhubContextLength: - """hy3-preview context length is registered.""" + """hy3-preview has a context-length entry registered. - def test_hy3_preview_context_length(self): + Asserting the relationship (registered + ≥ 4096) instead of a + specific value, per AGENTS.md "Don't write change-detector tests". + The previous version of this class pinned an exact integer that + broke whenever Tencent / OpenRouter bumped the published context + window (#22268). + """ + + def test_hy3_preview_has_registered_context_length(self): from agent.model_metadata import get_model_context_length ctx = get_model_context_length("hy3-preview") - assert ctx == 256000 + assert isinstance(ctx, int) + assert ctx >= 4096, f"hy3-preview context length looks unset/wrong: {ctx}" # =============================================================================