Skip to content

fix: correct deprecated model settings behavior#14046

Closed
erichare wants to merge 1 commit into
langflow-ai:release-1.10.3from
erichare:fix/deprecated-model-settings
Closed

fix: correct deprecated model settings behavior#14046
erichare wants to merge 1 commit into
langflow-ai:release-1.10.3from
erichare:fix/deprecated-model-settings

Conversation

@erichare

@erichare erichare commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • disable model-provider switches for deprecated and unsupported models
  • reject API attempts to persist those models as explicitly enabled
  • limit age-based auto-deprecation to language models so embeddings do not become deprecated solely because they cross the 900-day threshold

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_models always 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)
  • focused Ruff and Biome checks
  • pre-commit hooks
  • live models.dev smoke test confirms all three OpenAI embedding models remain non-deprecated

Summary by CodeRabbit

  • New Features

    • Deprecated and unsupported models are now clearly disabled in model selection.
    • Attempts to enable unavailable models are rejected with an explanatory error.
  • Bug Fixes

    • Model availability status is applied consistently across the model catalog.
    • Automatic age-based deprecation now applies only to stale language models, while embedding models retain their intended status.
    • Existing static deprecation flags for embedding models are preserved.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

The 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

Layer / File(s) Summary
Catalog deprecation semantics
src/lfx/src/lfx/base/models/models_dev_catalog.py, src/lfx/tests/unit/base/models/test_models_dev_catalog.py
Catalog documentation and tests clarify that age-based auto-deprecation applies only to stale language models, while static embedding deprecation flags remain preserved.
Backend unavailable-model validation
src/backend/base/langflow/api/v1/models.py, src/backend/tests/unit/api/v1/test_models_enabled_providers.py
The enabled-model endpoint reuses the unified catalog, rejects deprecated or unsupported models with HTTP 400, and no longer performs per-update provider credential validation.
Frontend unavailable-model controls
src/frontend/src/modals/modelProviderModal/components/ModelSelection.tsx, src/frontend/src/modals/modelProviderModal/__tests__/ModelSelection.test.tsx
Deprecated and unsupported model switches are disabled, and tests verify disabled toggles do not invoke the model toggle handler.

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
Loading

Possibly related PRs

Suggested reviewers: edwinjosechittilappilly, himavarshavs, deon-sanchez, cristhianzl, ramgopalsrikar

🚥 Pre-merge checks | ✅ 9
✅ Passed checks (9 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing deprecated model settings behavior across the API and UI.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Test Coverage For New Implementations ✅ Passed Yes—each behavior change has matching substantive tests: backend API rejection, frontend disabled toggle, and lfx age-deprecation updates, with filenames following project conventions.
Test Quality And Coverage ✅ Passed Backend async tests cover 400 rejection and existing 200 success flow; frontend and lfx tests assert real behavior, not smoke checks, with proper project patterns.
Test File Naming And Structure ✅ Passed Files follow repo conventions: backend pytest test_*.py, frontend component .test.tsx Jest/RTL, descriptive names, fixtures/setup, and positive/negative edge-case coverage.
Excessive Mock Usage Warning ✅ Passed Mocks are limited to external boundaries (HTTP client, icon/hook). The new tests exercise real API/component behavior with concrete data, not layered stubs.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Jul 13, 2026
@erichare erichare marked this pull request as ready for review July 13, 2026 19:38
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/backend/tests/unit/api/v1/test_models_enabled_providers.py (1)

368-380: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing "not supported" model test coverage across backend and frontend. Both layers now enforce not_supported models (backend rejects with 400, frontend disables toggle), but tests only cover the deprecated path. The not_supported enforcement is untested in both layers.

  • src/backend/tests/unit/api/v1/test_models_enabled_providers.py#L368-L380: add a test posting a not_supported model 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 a not_supported model's toggle is disabled and onModelToggle is 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 win

Comment 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2433e87 and a8e134c.

📒 Files selected for processing (6)
  • src/backend/base/langflow/api/v1/models.py
  • src/backend/tests/unit/api/v1/test_models_enabled_providers.py
  • src/frontend/src/modals/modelProviderModal/__tests__/ModelSelection.test.tsx
  • src/frontend/src/modals/modelProviderModal/components/ModelSelection.tsx
  • src/lfx/src/lfx/base/models/models_dev_catalog.py
  • src/lfx/tests/unit/base/models/test_models_dev_catalog.py

@erichare

Copy link
Copy Markdown
Collaborator Author

Replaced by #14047 so the head branch is hosted directly in langflow-ai/langflow.

@erichare erichare deleted the fix/deprecated-model-settings branch July 15, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant