HERMES-GIELIE/static
nesquena-hermes 7f16a41a31
fix: normalize stale session models after provider switch — v0.50.99 (#751)
## Summary

Rebased-on-behalf of @likawa3b (originally PR #748 — stale base).

Sessions can outlive provider changes. When an old session still points to a model from a previous provider (e.g. `gemini-3.1-pro-preview` after switching the agent to OpenAI Codex), starting a chat hits the wrong backend and fails silently.

This PR adds a lightweight normalization pass:
- `_normalize_provider_id()` maps common prefixes to canonical provider IDs
- `_resolve_compatible_session_model()` checks the session model's provider against `active_provider` and returns the default model if they differ
- `_normalize_session_model_in_place()` is called at GET `/api/session` — corrects and persists stale models once
- Chat start also normalizes via `_resolve_compatible_session_model()` and returns `effective_model` in the response
- `messages.js` applies `effective_model` back to the UI/localStorage/dropdown if set

Closes #748

## Tests

1498 passed (2 pre-existing ordering failures unrelated to this PR; 5 new tests added in `test_provider_mismatch.py`).

**Original author:** @likawa3b
2026-04-19 23:22:26 -07:00
..
boot.js fix: robust mic toggle + Tailscale MediaRecorder fallback — v0.50.94 (PR #715) 2026-04-19 06:28:14 +00:00
commands.js feat: slash command parity + skill autocomplete — v0.50.91 (PR #711) 2026-04-19 05:37:44 +00: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 feat: add full Russian (ru-RU) localization — v0.50.95 (PR #713) 2026-04-19 06:47:24 +00:00
icons.js feat: composer-centric UI refresh + Hermes Control Center (v0.50.0, closes #242) 2026-04-12 11:55:40 -07:00
index.html fix(ui): constrain slash autocomplete width to composer — v0.50.98 (closes #633) (#750) 2026-04-19 23:17:00 -07:00
login.js feat: support subpath mount via reverse proxy — v0.50.67 (PR #588 by @vcavichini) 2026-04-16 11:20:08 -07:00
messages.js fix: normalize stale session models after provider switch — v0.50.99 (#751) 2026-04-19 23:22:26 -07:00
onboarding.js feat: MCP toolsets in WebUI + onboarding fix for non-standard providers — v0.50.63 2026-04-15 23:39:07 -07:00
panels.js feat: add full Russian (ru-RU) localization — v0.50.95 (PR #713) 2026-04-19 06:47:24 +00:00
sessions.js feat: add full Russian (ru-RU) localization — v0.50.95 (PR #713) 2026-04-19 06:47:24 +00:00
style.css fix(ui): constrain slash autocomplete width to composer — v0.50.98 (closes #633) (#750) 2026-04-19 23:17:00 -07:00
ui.js fix(ui): restrict edit to latest user message (#747) 2026-04-19 23:11:49 -07:00
workspace.js feat: support subpath mount via reverse proxy — v0.50.67 (PR #588 by @vcavichini) 2026-04-16 11:20:08 -07:00