hermes - 💡(How to fix) Fix Context window auto-probe accumulates for providers without context_length metadata (DeepSeek V4)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

DeepSeek API /v1/models does not return context_length metadata:

{"id": "deepseek-v4-pro", ...}  // no context_length field

When get_model_context_length() cannot find a value via API probing, the result appears to accumulate rather than being cached at session start. Each turn triggers a re-probe, and the value compounds.

Fix Action

Fix / Workaround

Fix (Workaround)

Setting provider-level context_length stops the accumulation:

Code Example

deepseek-v4-pro · 35% · 2m
deepseek-v4-pro · 35% · 4m
deepseek-v4-pro · 35% · 6m
deepseek-v4-pro · 35% · 8m
deepseek-v4-pro · 35% · 10m

---

{"id": "deepseek-v4-pro", ...}  // no context_length field

---

hermes config set providers.deepseek.context_length 1048576
RAW_BUFFERClick to expand / collapse

Environment

  • Hermes v0.13.0 (upgraded from pre-0.13 via git merge upstream/main 2026-05-08)
  • Provider: DeepSeek (api.deepseek.com)
  • Model: deepseek-v4-pro
  • No global model.context_length set

Symptoms

When no explicit context_length is configured for DeepSeek, the CLI status bar displays a climbing context window value across turns:

deepseek-v4-pro · 35% · 2m
deepseek-v4-pro · 35% · 4m
deepseek-v4-pro · 35% · 6m
deepseek-v4-pro · 35% · 8m
deepseek-v4-pro · 35% · 10m

The fill percentage (35%) remains static while the displayed context window grows with every API call. After 5+ turns it can exceed 10M.

Root Cause

DeepSeek API /v1/models does not return context_length metadata:

{"id": "deepseek-v4-pro", ...}  // no context_length field

When get_model_context_length() cannot find a value via API probing, the result appears to accumulate rather than being cached at session start. Each turn triggers a re-probe, and the value compounds.

Fix (Workaround)

Setting provider-level context_length stops the accumulation:

hermes config set providers.deepseek.context_length 1048576

This bypasses the auto-probe chain entirely, matching the existing pattern used for custom providers (e.g., llama.cpp endpoints that also lack context_length in /v1/models).

Expected Behavior

The context window should be resolved once at session init and cached. The hardcoded fallback in model_metadata.py (deepseek-v4-pro: 1_000_000) should be used when API probing returns no value.

Impact

  • Status bar shows false/misleading context window sizes
  • If the inflated value exceeds real limits, compression may trigger too late or not at all
  • Likely affects other providers without context_length in /v1/models (xAI Grok was mentioned in code comments as having the same issue)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING