Skip to content

fix(lfx): include components path in flow builder registry - #13623

Open
luochen211 wants to merge 4 commits into
langflow-ai:release-1.11.0from
luochen211:fix-flow-builder-components-path
Open

fix(lfx): include components path in flow builder registry#13623
luochen211 wants to merge 4 commits into
langflow-ai:release-1.11.0from
luochen211:fix-flow-builder-components-path

Conversation

@luochen211

@luochen211 luochen211 commented Jun 11, 2026

Copy link
Copy Markdown

Fixes #13619.

Summary

  • merge settings.components_path custom components into the flow-builder local registry
  • keep the existing user-component overlay path while allowing it to use the same base registry
  • add search, describe, and build regressions for components from LANGFLOW_COMPONENTS_PATH

Tests

  • uv run pytest tests/unit/test_flow_builder_tools.py -q
  • uv run ruff check src/lfx/graph/flow_builder/builder.py src/lfx/mcp/flow_builder_tools/_state.py ../backend/base/langflow/agentic/services/user_components_overlay.py tests/unit/test_flow_builder_tools.py
  • uv run ruff format --check src/lfx/graph/flow_builder/builder.py src/lfx/mcp/flow_builder_tools/_state.py ../backend/base/langflow/agentic/services/user_components_overlay.py tests/unit/test_flow_builder_tools.py
  • git diff --check

Summary by CodeRabbit

Release Notes

  • New Features

    • Registry loading now supports configurable custom component paths, allowing additional components to be loaded from user-specified locations alongside default components.
    • User overlay system now respects configured component paths for seamless integration.
  • Tests

    • Added comprehensive test coverage for component discovery and flow-building with custom component paths.

@coderabbitai

coderabbitai Bot commented Jun 11, 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 Plus

Run ID: 6ca66e5d-2424-4625-9921-7b2dcfc1839c

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 PR extends registry loading throughout the stack to accept optional custom components paths, enabling bundled component indexes to be merged with custom component registries from caller-provided paths for search, description, and flow-building operations.

Changes

Custom Components Path Registry Integration

Layer / File(s) Summary
Flow builder registry merging core logic
src/lfx/src/lfx/graph/flow_builder/builder.py
load_local_registry reworked to accept optional components_paths, cache results per distinct path set, normalize path inputs, flatten bundled and custom component structures, merge custom entries over the base registry, and return the unified dictionary.
Backend overlay API contract updates
src/backend/base/langflow/agentic/services/user_components_overlay.py
load_registry_with_user_overlay and load_registry_for_current_user updated to accept optional components_paths parameter and forward it to load_local_registry for base registry sourcing.
MCP settings-aware registry loading
src/lfx/src/lfx/mcp/flow_builder_tools/_state.py
New _components_paths_from_settings() helper reads components_path from settings service; _load_registry_user_aware() now passes settings-derived components_path to both the local registry loader (fallback) and user-overlay registry loader.
End-to-end test coverage for components_path registry
src/lfx/tests/unit/test_flow_builder_tools.py
Test helpers for cache reset and settings/registry mocking; three new tests verify SearchComponentTypes, DescribeComponentType, and BuildFlowFromSpec correctly incorporate component types from the configured components_path registry (e.g., BundleSearchTool with category operator_bundle).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Quality And Coverage ⚠️ Warning Tests cover only happy path scenarios (components found, described, built). Missing: cache correctness tests, fallback behavior when langflow import fails, None/empty components_path handling, erro... Add tests for: caching with same path set, ImportError fallback, None components_path edge cases, build_custom_components failures, component merging behavior validation, and settings.components_path missing scenarios.
✅ 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 clearly describes the main change: enabling the flow builder registry to include custom components from the configured components path.
Linked Issues check ✅ Passed The PR addresses issue #13619 by extending registry-loading APIs to accept components_paths, allowing custom components from LANGFLOW_COMPONENTS_PATH to be incorporated into the flow builder's registry alongside user overlays and built-in components.
Out of Scope Changes check ✅ Passed All changes are scoped to extending registry loading to accept and merge custom components from configured paths; no unrelated refactoring or unintended modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Test Coverage For New Implementations ✅ Passed PR includes comprehensive test coverage with 3 new functional tests covering search, describe, and build operations; helper functions for cache management and mocking; proper mocking of new setting...
Test File Naming And Structure ✅ Passed Test file follows correct patterns: test_*.py naming, proper pytest structure with 14 test classes and 58 test methods. Descriptive test names explain what is being tested. Tests are logically orga...
Excessive Mock Usage Warning ✅ Passed The PR adds only 3 new test methods with 6 patch() calls across 2 dependencies (get_settings_service, build_custom_components). These are appropriate external/IO dependencies that require mocking:...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 bug Something isn't working and removed bug Something isn't working labels Jun 11, 2026
@luochen211
luochen211 force-pushed the fix-flow-builder-components-path branch from 894008c to 5ff02eb Compare June 11, 2026 09:51
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 11, 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 (1)
src/lfx/src/lfx/graph/flow_builder/builder.py (1)

61-104: 💤 Low value

Consider returning a shallow copy of the cached merged registry to prevent cache corruption.

The merged registry is stored directly in _registry_with_components_path_cache and returned to callers. If any caller mutates the returned dict (e.g., adds/removes keys), the cached entry is silently corrupted for subsequent lookups.

Currently, user_components_overlay.py already creates a shallow copy before modifications (line 131), and typical search/describe operations are read-only, so the practical risk is low. However, for defensive consistency with the base registry path (which benefits from _registry_cache being only read), consider returning dict(merged) at line 104.

🛡️ Optional defensive copy
     _registry_with_components_path_cache[cache_key] = merged
-    return merged
+    return dict(merged)
🤖 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/lfx/src/lfx/graph/flow_builder/builder.py` around lines 61 - 104, The
merged registry stored in _registry_with_components_path_cache is returned
directly and can be mutated by callers; modify load_local_registry so that
whenever a merged registry is returned from the cache or after computing/setting
merged (references: function load_local_registry, variable
_registry_with_components_path_cache, local name merged), return a shallow copy
(e.g., dict(merged)) instead of the original object to prevent cache corruption
from caller-side mutations.
🤖 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/lfx/src/lfx/graph/flow_builder/builder.py`:
- Around line 61-104: The merged registry stored in
_registry_with_components_path_cache is returned directly and can be mutated by
callers; modify load_local_registry so that whenever a merged registry is
returned from the cache or after computing/setting merged (references: function
load_local_registry, variable _registry_with_components_path_cache, local name
merged), return a shallow copy (e.g., dict(merged)) instead of the original
object to prevent cache corruption from caller-side mutations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 240255fc-2978-4c25-b645-c0ed24e2baba

📥 Commits

Reviewing files that changed from the base of the PR and between 29140c0 and 894008c.

📒 Files selected for processing (4)
  • src/backend/base/langflow/agentic/services/user_components_overlay.py
  • src/lfx/src/lfx/graph/flow_builder/builder.py
  • src/lfx/src/lfx/mcp/flow_builder_tools/_state.py
  • src/lfx/tests/unit/test_flow_builder_tools.py

@luochen211
luochen211 force-pushed the fix-flow-builder-components-path branch from 5ff02eb to 4b2b964 Compare June 11, 2026 10:23
@luochen211

Copy link
Copy Markdown
Author

Addressed the CodeRabbit test-quality warning by adding coverage for components_path normalization/cache reuse and missing-settings fallback, alongside the existing search/describe/build path coverage. Re-verified with uv run pytest tests/unit/test_flow_builder_tools.py -q from src/lfx, ruff check/format, and git diff --check.

@luochen211
luochen211 force-pushed the fix-flow-builder-components-path branch from 4b2b964 to 2c74a1e Compare June 11, 2026 10:24
@github-actions github-actions Bot removed the bug Something isn't working label Jun 11, 2026
@luochen211

Copy link
Copy Markdown
Author

Also addressed CodeRabbit’s cached-registry nit: components_path cache hits and newly merged registries now return shallow copies so caller mutations cannot corrupt cached entries. The registry test now covers that behavior. Re-verified with uv run pytest tests/unit/test_flow_builder_tools.py -q from src/lfx, ruff check/format, and git diff --check.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 11, 2026
@luochen211

Copy link
Copy Markdown
Author

CI looks blocked by runner package repository setup rather than this PR change: Playwright shard 63 failed before tests ran while installing browsers because apt update hit 403 Forbidden from packages.microsoft.com and exited with code 100. A failed-job rerun should be enough, but I do not have repository admin permission to rerun the upstream workflow.

@erichare
erichare deleted the branch langflow-ai:release-1.11.0 July 1, 2026 18:33
@erichare erichare closed this Jul 1, 2026
@erichare erichare reopened this Jul 1, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 2, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 2, 2026
@erichare
erichare deleted the branch langflow-ai:release-1.11.0 July 15, 2026 18:36
@erichare erichare closed this Jul 15, 2026
@erichare erichare reopened this Jul 15, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 8, 2026
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.

2 participants