fix: correct deprecated model settings behavior#14046
Conversation
WalkthroughChangesThe model catalog now distinguishes static embedding deprecation from age-based language-model deprecation. Backend enabled-model updates reject deprecated or unsupported models, while the frontend disables their toggles. Provider credential validation was removed from this update endpoint. Model availability enforcement
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ModelSelection
participant update_enabled_models
participant UnifiedModelCatalog
ModelSelection->>update_enabled_models: submit enabled model updates
update_enabled_models->>UnifiedModelCatalog: load model metadata
UnifiedModelCatalog-->>update_enabled_models: unavailable model flags
update_enabled_models-->>ModelSelection: accept updates or return HTTP 400
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 9✅ Passed checks (9 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/backend/tests/unit/api/v1/test_models_enabled_providers.py (1)
368-380: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing "not supported" model test coverage across backend and frontend. Both layers now enforce
not_supportedmodels (backend rejects with 400, frontend disables toggle), but tests only cover the deprecated path. Thenot_supportedenforcement is untested in both layers.
src/backend/tests/unit/api/v1/test_models_enabled_providers.py#L368-L380: add a test posting anot_supportedmodel and asserting 400 with detail"Cannot enable not supported model: ...".src/frontend/src/modals/modelProviderModal/__tests__/ModelSelection.test.tsx#L323-L342: add a parallel test verifying anot_supportedmodel's toggle is disabled andonModelToggleis not called.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/backend/tests/unit/api/v1/test_models_enabled_providers.py` around lines 368 - 380, Add backend coverage in src/backend/tests/unit/api/v1/test_models_enabled_providers.py lines 368-380 by adding a test parallel to test_cannot_enable_deprecated_model that posts a not_supported model and asserts HTTP 400 with the detail “Cannot enable not supported model: ...”. Add frontend coverage in src/frontend/src/modals/modelProviderModal/__tests__/ModelSelection.test.tsx lines 323-342 by verifying a not_supported model’s toggle is disabled and onModelToggle is not called.Source: Coding guidelines
src/backend/base/langflow/api/v1/models.py (1)
637-638: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winComment doesn't match the loop's behavior.
The comment says "Update model sets based on user requests" but the loop at lines 639–667 only validates (unavailable model check + credential validation). The actual model set update happens later at line 669 via
_update_model_sets. The comment also omits the new unavailable-model validation, mentioning only credential validation.♻️ Suggested comment update
- # Update model sets based on user requests - # For any model being enabled, validate the provider credentials + # Validate model availability and provider credentials for any model being enabled for update in updates:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/backend/base/langflow/api/v1/models.py` around lines 637 - 638, Update the comments immediately before the loop in the model-update flow to describe only its actual behavior: reject unavailable requested models and validate provider credentials for models being enabled. Remove the claim that this loop updates model sets, since that operation is performed later by _update_model_sets.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/backend/base/langflow/api/v1/models.py`:
- Around line 637-638: Update the comments immediately before the loop in the
model-update flow to describe only its actual behavior: reject unavailable
requested models and validate provider credentials for models being enabled.
Remove the claim that this loop updates model sets, since that operation is
performed later by _update_model_sets.
In `@src/backend/tests/unit/api/v1/test_models_enabled_providers.py`:
- Around line 368-380: Add backend coverage in
src/backend/tests/unit/api/v1/test_models_enabled_providers.py lines 368-380 by
adding a test parallel to test_cannot_enable_deprecated_model that posts a
not_supported model and asserts HTTP 400 with the detail “Cannot enable not
supported model: ...”. Add frontend coverage in
src/frontend/src/modals/modelProviderModal/__tests__/ModelSelection.test.tsx
lines 323-342 by verifying a not_supported model’s toggle is disabled and
onModelToggle is not called.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 14bee7d0-9964-4330-b66f-61564b158845
📒 Files selected for processing (6)
src/backend/base/langflow/api/v1/models.pysrc/backend/tests/unit/api/v1/test_models_enabled_providers.pysrc/frontend/src/modals/modelProviderModal/__tests__/ModelSelection.test.tsxsrc/frontend/src/modals/modelProviderModal/components/ModelSelection.tsxsrc/lfx/src/lfx/base/models/models_dev_catalog.pysrc/lfx/tests/unit/base/models/test_models_dev_catalog.py
|
Replaced by #14047 so the head branch is hosted directly in langflow-ai/langflow. |
Summary
Root cause
The settings UI allowed deprecated models to enter its optimistic toggle queue, and the update endpoint accepted and persisted that state. A later
GET /enabled_modelsalways returned deprecated models as disabled, so the next refetch appeared to undo the user's toggle.Separately, the models.dev fallback marks catalog entries older than 900 days as deprecated. That heuristic also applied to embeddings. The OpenAI
text-embedding-3-*models reached that threshold in July 2026 even though age alone is not a reliable deprecation signal for embedding models.Explicit catalog deprecations remain unchanged, including provider-specific embedding models that are known to be unavailable.
Validation
uv run pytest tests/unit/base/models/test_models_dev_catalog.py -q(23 passed)uv run pytest src/backend/tests/unit/api/v1/test_models_enabled_providers.py -k cannot_enable_deprecated_model -q(1 passed)npm test -- src/modals/modelProviderModal/__tests__/ModelSelection.test.tsx --runInBand(26 passed)Summary by CodeRabbit
New Features
Bug Fixes