Fix browser chat provider fallback on fresh sessions#3087
Conversation
|
Read the diff against Logic verified
const sessionProvider=(S&&S.session&&S.session.model_provider)||null;
if(sessionProvider) return sessionProvider;
const model=String(modelId||'').trim();
if(!model) return null;
const explicitProvider=typeof _providerFromModelValue==='function'
? _providerFromModelValue(model)
: '';
if(explicitProvider) return explicitProvider;Order: session model_provider (authoritative) → encoded The "same outgoing model" guard at line 911 is the key correctness fix — without it, a fresh session reading the dropdown could grab the provider of whatever was previously selected (e.g. user opened the dropdown to browse Gemini, clicked back to a session that has One concern: leading-zero
|
5ec136a
|
Shipped in v0.51.156 / Release EB (stage-batch38, commit 5ec136a). Thanks for the contribution! |
# Conflicts: # CHANGELOG.md
2-PR Tier B cleanup: - nesquena#3084 harden WebUI request/session/runtime edges (auth.py thread-safety + body validation + frontend storage guards + sw.js vendor precache + i18n key fills + workspace_git test default-branch) - nesquena#3087 model_provider fallback only when same model — fixes fresh-session model_provider=null bug
Thinking Path
grok-4.3withmodel_provider=null, letting backend resolution drift to the wrong default provider.S.session.modelauthoritative, and only derive a provider fallback when it belongs to the exact model being sent.What Changed
static/ui.js::_modelProviderForSend(modelId).S.session.model_providerwhen present.static/messages.jsso browser chat start and queued follow-up payloads all use the same model/provider resolution.tests/test_chat_start_provider_fallback.py.Why It Matters
Verification
Ran from the isolated worktree with
/Users/georgeandraws/hermes-webui/.venv/bin/python:python -m pytest tests/test_chat_start_provider_fallback.py -q✅5 passedpython -m pytest tests/test_new_chat_default_model_frontend.py::test_new_chat_does_not_send_stale_dropdown_model_when_session_has_default_model tests/test_regressions.py::test_send_uses_session_model_as_authoritative_source tests/test_chat_start_provider_fallback.py -q✅7 passednode -c static/ui.js && node -c static/messages.js✅python -m pytest tests/test_parallel_session_switch.py::TestGitInfoParallel::test_parallel_faster_than_serial -q✅1 passedpython -m pytest tests -qorigin/master:tests/test_workspace_git.py::test_git_commit_selected_rejects_conflicts_and_path_traversaltests/test_workspace_git.py::test_git_stash_and_checkout_is_explicitmaster, sogit checkout mastererrors before product code is exercised.Risks / Follow-ups
workspace_gitfailures are baseline test assumptions unrelated to this diff and should be fixed separately.AI Usage Disclosure
npx -y @openai/codex execgpt-5.5mediumModel Used
gpt-5.5for the implementation passgpt-5.4for verification and PR prep