Skip to content

feat(models): add pluggable provider policy#14137

Open
erichare wants to merge 6 commits into
release-1.11.0from
fix/model-provider-policy-seam
Open

feat(models): add pluggable provider policy#14137
erichare wants to merge 6 commits into
release-1.11.0from
fix/model-provider-policy-seam

Conversation

@erichare

@erichare erichare commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add stable provider IDs, aliases, origin metadata, and static catalog loading so extension packages can contribute enterprise providers without OSS registry edits.
  • Add a pluggable model-provider policy service with separate discover, configure, and use decisions. The context is deployment-wide today and carries user, workspace, role, and attribute seams for later RBAC policies.
  • Enforce hidden-provider behavior server-side across unified model discovery and mutation APIs, variables and environment import, model selectors, Agentic, Knowledge Base, Memory Base, MCP configuration, and runtime model construction.
  • Support credentialless providers and use authoritative registry wiring for known providers so saved metadata cannot redirect model classes or secret parameters.

Architecture and compatibility

  • OSS installs use an allow-all policy by default, preserving existing behavior.
  • Enterprise can install provider-only extension packages and supply a policy implementation or deployment configuration separately.
  • Denied providers are omitted from discovery and return generic not-found responses before validation, secret lookup, storage, or network work.
  • Unknown legacy saved providers retain the historical runtime fallback path.
  • Provider-specific component-class filtering and frontend changes are intentionally out of scope.

Validation

  • 347 LFX provider, model, extension, service, Agentic, and MCP tests passed on the rebased release head.
  • 217 focused backend tests passed with 1 pre-existing xfail.
  • Ruff check and format checks passed for all changed Python files.
  • Bundle API changelog guard and all commit hooks passed.

Summary by CodeRabbit

  • New Features
    • Added model-provider access controls for discovering, configuring, and using providers.
    • Added support for credentialless and optional-key providers.
    • Extension providers can now declare stable IDs, aliases, display names, and static model catalogs.
    • Model and embedding options now reflect provider permissions and hide unavailable choices.
  • Bug Fixes
    • Prevented unauthorized provider credentials from being validated or used.
    • Improved handling of provider mismatches and legacy provider configurations.
  • Documentation
    • Updated extension manifest and bundle API guidance for provider registration and policy services.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 85ec28db-97c4-46f8-afca-8a30404475b3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This change adds pluggable model-provider authorization, stable provider identities, extension catalog loading, optional-credential support, and policy enforcement across unified models, backend APIs, runtime services, and flow-builder operations. It also adds extensive tests and refreshes secret-baseline metadata.

Changes

Model-provider policy and catalog

Layer / File(s) Summary
Policy contract and service wiring
src/lfx/src/lfx/services/model_provider_policy/*, src/lfx/src/lfx/services/*, src/lfx/PLUGGABLE_SERVICES.md
Adds immutable policy contexts/snapshots, an allow-all default service, pluggable service validation, and configuration documentation.
Provider identity and extension catalogs
src/lfx/src/lfx/base/models/provider_registry.py, src/lfx/src/lfx/extension/*, src/lfx/src/lfx/base/models/model_metadata.py
Adds stable provider IDs, aliases, descriptors, registry snapshots, manifest fields, extension origins, and static catalog loaders.
Unified-model policy and credentials
src/lfx/src/lfx/base/models/unified_models/*
Filters model catalogs and options by policy, blocks denied providers before credential lookup, canonicalizes provider mappings, and supports credentialless providers.
Backend API and service enforcement
src/backend/base/langflow/api/*, src/backend/base/langflow/services/*, src/lfx/src/lfx/mcp/flow_builder_tools/*
Applies provider authorization to discovery, variables, defaults, knowledge bases, memory services, assistant setup, and component configuration.
Behavioral validation and baseline updates
src/backend/tests/*, src/lfx/tests/*, .secrets.baseline
Adds coverage for policy filtering, provider catalogs, optional credentials, runtime ordering, plugin loading, API behavior, and refreshed secret-detection metadata.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: test

Suggested reviewers: dkaushik94, ogabrielluiz, cristhianzl

Sequence Diagram(s)

sequenceDiagram
  participant Extension
  participant ProviderRegistry
  participant PolicyService
  participant BackendAPI
  participant UnifiedModels
  participant Credentials
  Extension->>ProviderRegistry: Register descriptor and catalog loader
  BackendAPI->>PolicyService: Resolve provider policy
  PolicyService-->>BackendAPI: Return immutable provider snapshot
  BackendAPI->>UnifiedModels: Request policy-filtered options or model
  UnifiedModels->>PolicyService: Require selected provider
  UnifiedModels->>Credentials: Resolve permitted secret/configuration
  Credentials-->>UnifiedModels: Return credential values
  UnifiedModels-->>BackendAPI: Return canonical model/provider result
Loading
🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately captures the main change: adding a pluggable provider policy for models.
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 PASS: The PR adds concrete tests in backend and lfx for the new provider-policy, registry, MCP, and memory-base behavior, using proper test_* naming.
Test Quality And Coverage ✅ Passed Tests are broad and behavioral: async backend endpoints cover 200/201 and 404 cases, and unit tests assert policy, auth ordering, and no-side-effect behavior.
Test File Naming And Structure ✅ Passed Changed test files are all test_*.py pytest modules with descriptive names, logical fixtures/classes, and positive/negative coverage.
Excessive Mock Usage Warning ✅ Passed Mocks are used to isolate external IO, while several tests exercise real service/client paths; no changed test module is dominated by core-logic over-mocking.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/model-provider-policy-seam

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 enhancement New feature or request label Jul 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Advisor

No source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉

Advisory check only — never blocks merge.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.62466% with 152 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.06%. Comparing base (e58738e) to head (350dead).

Files with missing lines Patch % Lines
src/lfx/src/lfx/base/models/provider_registry.py 72.16% 47 Missing and 34 partials ⚠️
src/backend/base/langflow/api/v1/variable.py 55.17% 13 Missing ⚠️
.../src/lfx/base/models/unified_models/credentials.py 18.75% 13 Missing ⚠️
src/backend/base/langflow/api/v1/models.py 80.76% 10 Missing ⚠️
...lfx/src/lfx/mcp/flow_builder_tools/mutate_tools.py 80.48% 4 Missing and 4 partials ⚠️
...rc/lfx/base/models/unified_models/instantiation.py 84.78% 5 Missing and 2 partials ⚠️
...src/lfx/base/models/unified_models/build_config.py 86.36% 3 Missing and 3 partials ⚠️
src/lfx/src/lfx/extension/manifest.py 68.42% 4 Missing and 2 partials ⚠️
src/lfx/src/lfx/services/deps.py 62.50% 2 Missing and 1 partial ⚠️
...lfx/src/lfx/services/model_provider_policy/base.py 95.52% 2 Missing and 1 partial ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-1.11.0   #14137      +/-   ##
==================================================
- Coverage           61.13%   57.06%   -4.07%     
==================================================
  Files                2427     2294     -133     
  Lines              238928   234563    -4365     
  Branches            37114    32507    -4607     
==================================================
- Hits               146066   133861   -12205     
- Misses              91108    98910    +7802     
- Partials             1754     1792      +38     
Flag Coverage Δ
backend 68.82% <84.02%> (+0.95%) ⬆️
lfx 60.07% <78.57%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/backend/base/langflow/agentic/api/router.py 72.30% <100.00%> (ø)
...base/langflow/agentic/services/provider_service.py 98.21% <100.00%> (+0.13%) ⬆️
...rc/backend/base/langflow/api/v1/knowledge_bases.py 79.48% <100.00%> (+2.26%) ⬆️
src/backend/base/langflow/services/factory.py 84.12% <100.00%> (ø)
...ase/langflow/services/memory_base/preprocessing.py 100.00% <100.00%> (ø)
...kend/base/langflow/services/memory_base/service.py 74.84% <100.00%> (+12.00%) ⬆️
src/backend/base/langflow/services/schema.py 100.00% <100.00%> (ø)
src/backend/base/langflow/services/utils.py 87.01% <100.00%> (-0.20%) ⬇️
...backend/base/langflow/services/variable/service.py 90.26% <100.00%> (-1.14%) ⬇️
src/lfx/src/lfx/base/models/model_metadata.py 92.68% <ø> (ø)
... and 17 more

... and 836 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 46%
46.75% (66418/142061) 70.08% (9285/13249) 45.14% (1521/3369)

Unit Test Results

Tests Skipped Failures Errors Time
5328 0 💤 0 ❌ 0 🔥 19m 19s ⏱️

@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.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/backend/base/langflow/services/memory_base/service.py (2)

85-96: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Allow API-key-optional preprocessing providers.

Credentialless providers still fail validation because every missing key raises PreprocessingValidationError, despite runtime construction supporting optional credentials.

Proposed fix
+from lfx.base.models.provider_registry import is_api_key_optional

-    if not api_key:
+    if not api_key and not is_api_key_optional(provider):
🤖 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/services/memory_base/service.py` around lines 85 -
96, Update _validate_preprocessing_api_key to recognize preprocessing providers
that support credentialless runtime construction and allow a missing API key for
them; continue raising PreprocessingValidationError for providers that require
credentials, preserving the existing provider/model-specific error message.

212-223: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Authorize against the patched values before mutating the record.
require_model_provider() and _validate_preprocessing_api_key() run on mb before patch is applied, so a request can swap in a denied embedding/preprocessing provider and still be persisted. Update the test to change the provider fields, not just threshold, and assert no mutation or commit when the new provider is rejected.

🤖 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/services/memory_base/service.py` around lines 212 -
223, The memory update flow in service.py must validate the effective patched
embedding and preprocessing provider values before mutating mb or committing;
update the authorization checks around require_model_provider and
_validate_preprocessing_api_key to use the patch values while preserving
existing values for omitted fields. In test_memory_bases.py, update the
rejection test to change provider fields rather than only threshold and assert
the record remains unchanged and no commit occurs.
🧹 Nitpick comments (2)
src/backend/base/langflow/services/variable/service.py (1)

34-57: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

resolve_model_provider_policy call isn't covered by the surrounding fail-safe.

The metadata resolution above (Lines 35-49) is guarded so any failure logs and returns early, keeping environment-variable initialization resilient. The resolve_model_provider_policy call in the else: branch (Lines 53-57) isn't covered by that same guard — if a pluggable policy service throws (e.g., a buggy enterprise policy extension), the exception propagates uncaught and crashes initialize_user_variables for every user, instead of failing safe like the metadata step does.

♻️ Proposed fix
         try:
             from lfx.base.models.unified_models import get_model_provider_metadata
             from lfx.services.model_provider_policy import ModelProviderPolicyPurpose, resolve_model_provider_policy
 
             var_to_provider = {}
             var_to_info = {}
             metadata = get_model_provider_metadata()
             for provider, meta in metadata.items():
                 for var in meta.get("variables", []):
                     var_key = var.get("variable_key")
                     if var_key:
                         var_to_provider[var_key] = provider
                         var_to_info[var_key] = var
+            provider_policy = resolve_model_provider_policy(
+                user_id=user_id,
+                providers=metadata,
+                purpose=ModelProviderPolicyPurpose.CONFIGURE,
+            )
         except Exception:  # noqa: BLE001
             await logger.aexception("Could not resolve model-provider metadata; skipping environment variable import")
             return
-        else:
-            provider_policy = resolve_model_provider_policy(
-                user_id=user_id,
-                providers=metadata,
-                purpose=ModelProviderPolicyPurpose.CONFIGURE,
-            )
🤖 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/services/variable/service.py` around lines 34 - 57,
Extend the fail-safe in the initialization flow to cover
resolve_model_provider_policy, keeping policy resolution inside the guarded try
path used for metadata loading. If it raises, log the exception with
logger.aexception and return early, preserving resilient environment-variable
initialization; update the surrounding try/except/else structure near
get_model_provider_metadata and resolve_model_provider_policy without changing
successful behavior.
src/backend/tests/unit/api/v1/test_models_live_only_providers.py (1)

78-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

_unregister reaches into 7+ private provider_registry attributes.

This keeps the test mock-free (good), but couples it tightly to internal state (_registered, _registered_ids, _registered_aliases, _live_discovery_cache, _validator_cache, _catalog_cache, _undo.*, _generation). A future internal refactor of the actively-evolving provider_registry module can silently break this and leak provider state into other tests.

Consider adding a small public helper (e.g. provider_registry.unregister(name)) that performs this same reversal, so tests use a stable contract instead of private fields.

🤖 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_live_only_providers.py` around
lines 78 - 100, The test helper _unregister should stop manipulating
provider_registry’s private attributes directly. Add a small public
provider_registry.unregister(name) operation that reverses the registration and
clears all associated metadata, aliases, caches, undo state, and derived state,
then update _unregister to call that public API while retaining cleanup for the
separate provider collections it owns.
🤖 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.

Inline comments:
In `@docs/docs/Lfx/extensions-manifest.mdx`:
- Line 74: Update the extensions manifest documentation to use the loader’s
public multi-bundle error code, replacing
multi-bundle-deferred-in-this-milestone with multi-bundle-unsupported while
preserving the surrounding v0 behavior description.
- Line 133: Update the provider precedence documentation to distinguish ordinary
provider-name or core-alias collisions, which are skipped, from stable
provider_id or alias conflicts, which raise and surface as provider-invalid; do
not describe all colliding providers as skippable.

In `@src/lfx/src/lfx/base/models/provider_registry.py`:
- Around line 634-654: Normalize the model name with strip() before constructing
the duplicate-detection key in the catalog row validation flow. Update the key
and stored normalized row to use this trimmed name, while preserving the
existing validation and model_type checks in the surrounding loader logic.
- Around line 575-587: Make get_registry_snapshot build the generation and
descriptors atomically under the registry’s existing _lock. Keep optional
validate_registered_provider_catalogs() behavior, then acquire _lock before
reading _generation, _core_provider_ids(), _registered_ids, and provider
descriptors, and construct the complete ProviderRegistrySnapshot from that
single locked state so concurrent register_provider() or clear() mutations
cannot produce mixed-generation results.

In `@src/lfx/src/lfx/base/models/unified_models/build_config.py`:
- Around line 363-370: Update the sticky-default logic around
saved_provider_allowed and provider_policy so provider-less saved selections
remain valid, and add a non-empty saved provider to the policy candidates before
evaluating it. Preserve the existing hidden-provider rejection for explicitly
saved providers while allowing custom saved providers even when absent from the
current options_list.

In `@src/lfx/src/lfx/mcp/flow_builder_tools/mutate_tools.py`:
- Around line 210-220: Update _require_allowed_model_providers in
src/lfx/src/lfx/mcp/flow_builder_tools/mutate_tools.py:210-220 to resolve the
policy with ModelProviderPolicyPurpose.CONFIGURE instead of USE. In
src/lfx/tests/unit/test_flow_builder_tools.py:756-760, capture the resolver
arguments and assert that the CONFIGURE purpose is passed.

In `@src/lfx/tests/unit/test_flow_builder_tools.py`:
- Around line 756-760: Update the resolver stub used by the ConfigureComponent
tests to capture its invocation arguments instead of ignoring them, then assert
that the requested purpose is ModelProviderPolicyPurpose.CONFIGURE. Keep the
existing snapshot return behavior and verify the resolver call specifically
covers the configuration path.

---

Outside diff comments:
In `@src/backend/base/langflow/services/memory_base/service.py`:
- Around line 85-96: Update _validate_preprocessing_api_key to recognize
preprocessing providers that support credentialless runtime construction and
allow a missing API key for them; continue raising PreprocessingValidationError
for providers that require credentials, preserving the existing
provider/model-specific error message.
- Around line 212-223: The memory update flow in service.py must validate the
effective patched embedding and preprocessing provider values before mutating mb
or committing; update the authorization checks around require_model_provider and
_validate_preprocessing_api_key to use the patch values while preserving
existing values for omitted fields. In test_memory_bases.py, update the
rejection test to change provider fields rather than only threshold and assert
the record remains unchanged and no commit occurs.

---

Nitpick comments:
In `@src/backend/base/langflow/services/variable/service.py`:
- Around line 34-57: Extend the fail-safe in the initialization flow to cover
resolve_model_provider_policy, keeping policy resolution inside the guarded try
path used for metadata loading. If it raises, log the exception with
logger.aexception and return early, preserving resilient environment-variable
initialization; update the surrounding try/except/else structure near
get_model_provider_metadata and resolve_model_provider_policy without changing
successful behavior.

In `@src/backend/tests/unit/api/v1/test_models_live_only_providers.py`:
- Around line 78-100: The test helper _unregister should stop manipulating
provider_registry’s private attributes directly. Add a small public
provider_registry.unregister(name) operation that reverses the registration and
clears all associated metadata, aliases, caches, undo state, and derived state,
then update _unregister to call that public API while retaining cleanup for the
separate provider collections it owns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4f33bc59-0778-4556-93dd-67bc297638fb

📥 Commits

Reviewing files that changed from the base of the PR and between ba79861 and e86052d.

📒 Files selected for processing (54)
  • .secrets.baseline
  • BUNDLE_API.md
  • docs/docs/Lfx/extensions-manifest.mdx
  • src/backend/base/langflow/agentic/api/router.py
  • src/backend/base/langflow/agentic/services/provider_service.py
  • src/backend/base/langflow/api/v1/knowledge_bases.py
  • src/backend/base/langflow/api/v1/models.py
  • src/backend/base/langflow/api/v1/variable.py
  • src/backend/base/langflow/services/factory.py
  • src/backend/base/langflow/services/memory_base/preprocessing.py
  • src/backend/base/langflow/services/memory_base/service.py
  • src/backend/base/langflow/services/schema.py
  • src/backend/base/langflow/services/utils.py
  • src/backend/base/langflow/services/variable/service.py
  • src/backend/tests/unit/agentic/api/test_iterations_limit_forwarding.py
  • src/backend/tests/unit/agentic/services/test_provider_service.py
  • src/backend/tests/unit/api/v1/test_detect_env_vars.py
  • src/backend/tests/unit/api/v1/test_models_live_only_providers.py
  • src/backend/tests/unit/api/v1/test_models_provider_policy.py
  • src/backend/tests/unit/services/variable/test_service.py
  • src/backend/tests/unit/test_knowledge_bases_api.py
  • src/backend/tests/unit/test_memory_base_preprocessing.py
  • src/backend/tests/unit/test_memory_bases.py
  • src/backend/tests/unit/test_unified_models.py
  • src/lfx/PLUGGABLE_SERVICES.md
  • src/lfx/lfx.toml.example
  • src/lfx/src/lfx/base/models/model_metadata.py
  • src/lfx/src/lfx/base/models/provider_registry.py
  • src/lfx/src/lfx/base/models/unified_models/__init__.py
  • src/lfx/src/lfx/base/models/unified_models/build_config.py
  • src/lfx/src/lfx/base/models/unified_models/credentials.py
  • src/lfx/src/lfx/base/models/unified_models/instantiation.py
  • src/lfx/src/lfx/base/models/unified_models/model_catalog.py
  • src/lfx/src/lfx/base/models/unified_models/provider_queries.py
  • src/lfx/src/lfx/components/agentics/helpers/llm_setup.py
  • src/lfx/src/lfx/extension/loader/_orchestrator.py
  • src/lfx/src/lfx/extension/manifest.py
  • src/lfx/src/lfx/mcp/flow_builder_tools/mutate_tools.py
  • src/lfx/src/lfx/services/deps.py
  • src/lfx/src/lfx/services/manager.py
  • src/lfx/src/lfx/services/model_provider_policy/__init__.py
  • src/lfx/src/lfx/services/model_provider_policy/base.py
  • src/lfx/src/lfx/services/model_provider_policy/service.py
  • src/lfx/src/lfx/services/model_provider_policy/utils.py
  • src/lfx/src/lfx/services/schema.py
  • src/lfx/tests/unit/base/models/test_build_config_sticky_default.py
  • src/lfx/tests/unit/base/models/test_provider_registry.py
  • src/lfx/tests/unit/components/agentics/test_llm_setup.py
  • src/lfx/tests/unit/extension/test_provider_extension.py
  • src/lfx/tests/unit/inputs/test_model_input_static_options.py
  • src/lfx/tests/unit/services/model_provider_policy/__init__.py
  • src/lfx/tests/unit/services/model_provider_policy/test_policy.py
  • src/lfx/tests/unit/services/test_service_manager.py
  • src/lfx/tests/unit/test_flow_builder_tools.py

Comment thread docs/docs/Lfx/extensions-manifest.mdx Outdated
Comment thread docs/docs/Lfx/extensions-manifest.mdx Outdated
Comment thread src/lfx/src/lfx/base/models/provider_registry.py Outdated
Comment thread src/lfx/src/lfx/base/models/provider_registry.py
Comment thread src/lfx/src/lfx/base/models/unified_models/build_config.py Outdated
Comment thread src/lfx/src/lfx/mcp/flow_builder_tools/mutate_tools.py
Comment thread src/lfx/tests/unit/test_flow_builder_tools.py
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 16, 2026
@erichare

Copy link
Copy Markdown
Collaborator Author

@coderabbitai Addressed the outside-diff/nitpick review items in 74d2503:

  • Credentialless preprocessing: providers that construct without API keys (Ollama or extensions with api_key_required=false) now bypass the API-key requirement; regression added.
  • MemoryBase update patch values: no change needed. MemoryBaseUpdate only exposes name, threshold, and auto_capture, so embedding/preprocessing providers cannot be patched. The service already validates the stored provider identities before applying any allowed mutation.
  • Variable initialization: policy resolution is now inside the fail-safe metadata-loading path; failure logs and returns before importing environment variables; regression added.
  • Registry test cleanup: added public unregister_provider() and moved the fixture off private registry state; cleanup regression added.
  • Docstring coverage: left as an advisory; broad unrelated docstring churn is out of scope, and the new public unregister helper is documented.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git show --stat --oneline --decorate --no-renames 74d2503bc
printf '\n=== affected paths ===\n'
git show --format='' --name-only 74d2503bc | sed '/^$/d'

printf '\n=== relevant definitions and tests ===\n'
for path in \
  src/backend/base/langflow/services/memory_base/preprocessing.py \
  src/backend/base/langflow/services/memory_base/service.py \
  src/backend/base/langflow/services/variable/service.py \
  src/lfx/src/lfx/base/models/provider_registry.py \
  src/backend/tests/unit/test_memory_base_preprocessing.py \
  src/backend/tests/unit/services/variable/test_service.py \
  src/lfx/tests/unit/base/models/test_provider_registry.py
do
  if [ -f "$path" ]; then
    echo "--- $path ---"
    ast-grep outline "$path" --items all --view compact || true
  fi
done

printf '\n=== commit diff for relevant paths ===\n'
git show --no-ext-diff --unified=50 74d2503bc -- \
  src/backend/base/langflow/services/memory_base/preprocessing.py \
  src/backend/base/langflow/services/memory_base/service.py \
  src/backend/base/langflow/services/variable/service.py \
  src/lfx/src/lfx/base/models/provider_registry.py \
  src/backend/tests/unit/test_memory_base_preprocessing.py \
  src/backend/tests/unit/services/variable/test_service.py \
  src/lfx/tests/unit/base/models/test_provider_registry.py

Length of output: 49028


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '=== MemoryBaseUpdate schema and validation call sites ==='
rg -n -A35 -B8 'class\s+MemoryBaseUpdate\b|def\s+_validate_preprocessing_api_key\b|async\s+def\s+update\b' \
  src/backend/base/langflow/services/database/models/memory_base/model.py \
  src/backend/base/langflow/services/memory_base/service.py

printf '%s\n' '=== credentialless preprocessing regression coverage ==='
rg -n -A35 -B8 'api_key_optional|Ollama|credentialless|_validate_preprocessing_api_key|preprocessing.*key' \
  src/backend/tests/unit/test_memory_bases.py \
  src/backend/tests/unit/test_memory_base_preprocessing.py

printf '%s\n' '=== fixture now uses public unregistration ==='
rg -n -A20 -B8 '\bunregister_provider\s*\(' \
  src/backend/tests/unit/api/v1/test_models_live_only_providers.py \
  src/lfx/tests/unit/base/models/test_provider_registry.py

Length of output: 88434


@erichare Confirmed in 74d2503bc:

  • Credentialless preprocessing now skips secret lookup for Ollama and api_key_required=false extensions, with regression coverage.
  • MemoryBaseUpdate cannot alter embedding or preprocessing configuration; stored identities are authorized before the allowed fields are changed. That concern does not apply.
  • Environment-variable import now fails safely when policy resolution fails, before any import occurs, with coverage.
  • Registry cleanup now uses the documented public unregister_provider() and verifies targeted cleanup without disturbing other registrations.
  • Agreed on leaving broad docstring churn out of scope.

✏️ Learnings added
Learnt from: erichare
URL: https://github.com/langflow-ai/langflow/pull/14137

Timestamp: 2026-07-16T22:21:06.427Z
Learning: In `src/backend/base/langflow/services/database/models/memory_base/model.py`, `MemoryBaseUpdate` only permits updates to `name`, `threshold`, and `auto_capture`; embedding and preprocessing model/provider identities are immutable through the update API. `MemoryBaseService.update()` in `src/backend/base/langflow/services/memory_base/service.py` authorizes stored provider identities before applying any permitted patch.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant