mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-24 18:50:15 +00:00
15b7b7ae12
PR #1900 patches the two get_model_context_length() fallback callsites in api/streaming.py to pass config_context_length, provider, and custom_providers — but a third callsite of the same shape lives at api/routes.py:2849, in the /api/session/get path that resolves context_length for older sessions (pre-#1318) that have context_length=0 persisted. Same bug shape: only `(model, base_url)` were forwarded, so the resolver fell through to the 256K DEFAULT_FALLBACK_CONTEXT even when the user had `model.context_length: 1048576` set in config.yaml. Visible symptom: the very first paint of a reloaded old session shows the wrong window in the chat-toolbar indicator until a turn fires (which would then trigger the streaming.py fallbacks fixed in this PR and overwrite with the correct value). Fix mirrors streaming.py: pass `config_context_length=`, `provider=effective_provider or ""`, and `custom_providers=` from the per-profile config (`get_config()`), with a TypeError fallback that retries the legacy 2-arg form for older hermes-agent builds whose get_model_context_length signature pre-dates the new kwargs. Adds `test_routes_session_load_fallback_passes_config_overrides` to lock the call shape — verified to fail pre-fix with the same "missing config_context_length=" error the streaming.py tests catch. Defense-in-depth completion of #1896 — closes the third leg of the same bug shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>