HERMES-GIELIE/static
nesquena-hermes 081e600b33 fix: context-window indicator broken on older sessions (#1436)
Fix two-layer bug where `/api/session` returned `context_length=0` for
sessions that pre-date #1318, then the frontend silently fell back to
cumulative `input_tokens` and the 128K JS default, producing nonsense
indicators like "100" capped from "890% used (context exceeded), 1.2M
/ 131.1k tokens used".

Empirical impact: 23 of 75 sessions on dev server rendered >100% before
this fix. #1356 fixed the same symptom on the live SSE path but missed
the GET /api/session load path that older sessions go through.

Two-layer fix:
  1. Backend (api/routes.py:1295-1313) — resolve context_length via
     agent.model_metadata.get_model_context_length() when the persisted
     value is 0. Mirrors api/streaming.py:2333-2342.
  2. Frontend (static/ui.js:1269) — drop the cumulative `input_tokens`
     fallback. When last_prompt_tokens is missing, render "·" + "tokens
     used" (existing !hasPromptTok branch) instead of computing a
     percentage from the cumulative total.

10 regression tests in tests/test_issue1436_context_indicator_load_path.py
covering both layers + the empty-model edge case (avoids the 256K
default-for-unknown-model trap that get_model_context_length('') returns).

Verified live: claude-opus-4-7 session with input_tokens=5,226,479 now
renders "·" + "5.3M tokens used" instead of "100" + "3987% used".

Reported by @AvidFuturist.
Closes #1436.
2026-05-02 01:43:00 +00:00
..
vendor chore: vendor streaming-markdown@0.2.15, remove CDN dependency 2026-04-24 01:05:20 +00:00
boot.js fix: new-chat guard ignores in-flight streams (#1432) + profile form auto-capitalizes typed values (#1423) 2026-05-02 00:52:41 +00:00
commands.js fix: anchor active sessions per browser tab 2026-05-01 19:52:05 +08:00
favicon-32.png fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
favicon.ico fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
favicon.svg fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
i18n.js Merge PR #1402 from bergeouss: P2 improvements — cron history, toolsets per session, Codex OAuth 2026-05-01 18:20:05 +00:00
icons.js fix: register 5 missing Lucide icons (TTS speaker + queue chevron + insights cards) (#1413) 2026-05-01 17:57:34 +00:00
index.html Make composer-footer toolsets chip responsive instead of always-hidden 2026-05-02 00:04:12 +00:00
login.js fix(login): retry connectivity probe every 3s, auto-reload when server recovers 2026-05-01 19:54:47 +00:00
manifest.json feat: add PWA support (manifest, service worker, install prompt) (#920) 2026-04-23 15:14:21 -07:00
messages.js Merge PR #1390 from starship-s: preserve session provider context 2026-05-01 16:58:48 +00:00
onboarding.js feat: P2 improvements — cron history, toolsets per session, Codex OAuth 2026-05-01 12:42:21 +00:00
panels.js fix: new-chat guard ignores in-flight streams (#1432) + profile form auto-capitalizes typed values (#1423) 2026-05-02 00:52:41 +00:00
sessions.js Merge PR #1405 from bergeouss: P3 features (insights, rollback, voice mode, subagent tree, redact toggle) 2026-05-01 16:58:49 +00:00
style.css Apply Opus pre-release fixes: dropdown resize guard + display:block 2026-05-02 00:21:15 +00:00
sw.js fix(ui+pwa): avoid stale Mermaid render errors and bust cached static asset URLs on every release 2026-04-30 16:18:01 +00:00
terminal.js fix: anchor active sessions per browser tab 2026-05-01 19:52:05 +08:00
ui.js fix: context-window indicator broken on older sessions (#1436) 2026-05-02 01:43:00 +00:00
workspace.js fix: anchor active sessions per browser tab 2026-05-01 19:52:05 +08:00