Require explicit model choice after OAuth connect

Stop auto-populating Main and Utility models when an OAuth account is already connected or newly connected.

Add a connected-account gate state that routes users to model configuration instead of choosing provider defaults silently.

Update OAuth notifications, chat gate copy, DOX contracts, and focused static regressions for the explicit model-selection flow.
This commit is contained in:
Alessandro 2026-07-02 12:04:12 +02:00
parent 04ecaac0cd
commit b75b0f2c5c
7 changed files with 54 additions and 80 deletions

View file

@ -116,12 +116,10 @@ def test_oauth_model_slots_reuse_model_config_api():
assert "if (!this.providerConnected(providerId)) return;" in store_js
assert "const providerId = slot.provider;" in store_js
assert "const providerId = this.isOauthProvider(this.activeModelProvider)" not in store_js
assert "autoApplyConnectedProviderIfNeeded(providerId)" in store_js
assert "currentChatModelConfigured()" in store_js
assert 'providerDefaultModel(providerId, "chat_model")' in store_js
assert 'providerDefaultModel(providerId, "utility_model")' in store_js
assert "this.modelSlotDirty = { chat_model: true, utility_model: true };" in store_js
assert 'new CustomEvent("model-configured"' in store_js
assert "autoApplyConnectedProviderIfNeeded" not in store_js
assert "currentChatModelConfigured" not in store_js
assert "providerDefaultModel" not in store_js
assert 'new CustomEvent("model-setup-changed"' in store_js
assert 'detail: { source: "_oauth", providerId }' in store_js
assert "await this.handleProviderConnected(providerId)" in store_js

View file

@ -111,13 +111,15 @@ def test_welcome_composer_can_create_a_chat_before_sending() -> None:
assert "sessionStorage.getItem(STORAGE_KEY)" in gate_store
assert "sessionStorage.removeItem(STORAGE_KEY)" in gate_store
assert 'import("/plugins/_oauth/webui/oauth-config-store.js")' in gate_store
assert "tryConnectedAccountDefaults()" in gate_store
assert "oauthConfigStore.connectedProviderCards()[0]?.provider_id" in gate_store
assert "oauthConfigStore.autoApplyConnectedProviderIfNeeded(providerId)" in gate_store
assert "const refreshed = await callJsonApi(\"/plugins/_model_config/model_config_get\", {});" in gate_store
assert "refreshConnectedAccountState()" in gate_store
assert "accountConnected" in gate_store
assert "accountLabel" in gate_store
assert "oauthConfigStore.connectedProviderCards()[0] || null" in gate_store
assert "autoApplyConnectedProviderIfNeeded" not in gate_store
assert "void this.dispatchPendingIfConfigured();" in gate_store
assert "this.choice = \"\";" in gate_store
assert 'document.addEventListener("model-configured"' in gate_store
assert 'document.addEventListener("model-setup-changed"' in gate_store
assert "const currentContext = globalThis.getContext?.();" in gate_store
assert "bypassModelGate: true" in gate_store
assert 'openPluginConfig("_model_config", "Advanced model configuration")' in gate_store
@ -126,6 +128,8 @@ def test_welcome_composer_can_create_a_chat_before_sending() -> None:
assert "openOnboarding('cloud')" in gate_component
assert "openOnboarding('local')" in gate_component
assert "openOauthConfiguration()" in gate_component
assert "Choose models" in gate_component
assert "Connected account:" in gate_component
assert "Advanced model configuration" in gate_component
assert "Advanced settings" not in gate_component
assert "model-gate-fields" not in gate_component