Skip to content

fix: Enable Run Flow Component dropdown by using backend database#10120

Open
MugheesMehdi07 wants to merge 3 commits into
langflow-ai:mainfrom
MugheesMehdi07:fix/run-flow-component-dropdown-disabled
Open

fix: Enable Run Flow Component dropdown by using backend database#10120
MugheesMehdi07 wants to merge 3 commits into
langflow-ai:mainfrom
MugheesMehdi07:fix/run-flow-component-dropdown-disabled

Conversation

@MugheesMehdi07
Copy link
Copy Markdown

@MugheesMehdi07 MugheesMehdi07 commented Oct 5, 2025

🐛 Problem

The Run Flow Component had a disabled dropdown field for selecting flow names, making it impossible to use the component. This was caused by LFX always using a stub implementation that returns an empty list, even when running in the full Langflow application with a database backend.

🔧 Solution

Modified list_flows() in src/lfx/src/lfx/helpers/flow.py to:

  • Try to import and use the backend list_flows implementation when available
  • Fall back to the stub implementation when backend is not available
  • This allows the Run Flow Component to populate its dropdown with actual flows

📍 Changes Made

  • File: src/lfx/src/lfx/helpers/flow.py (lines 79-86)
  • Change: Added try/catch to use backend implementation when available
  • Result: Run Flow Component dropdown now shows available flows

🧪 Testing

  • ✅ Existing tests pass (test_list_flows_flow_objects, test_list_flows_return_type)
  • ✅ No breaking changes to existing functionality
  • ✅ Backward compatible - falls back gracefully when backend unavailable

🔗 Related

Fixes #10119

Summary by CodeRabbit

  • New Features
    • Flow listing now retrieves data from a connected backend when available, providing up-to-date results instead of an always-empty list.
    • Graceful fallback: if no backend is available, the app logs a warning and returns an empty list, maintaining stability and predictable behavior.
    • No changes required to existing usage; session validation behavior remains the same.

- Fix list_flows() in lfx to use backend implementation when available
- Resolves issue where Run Flow Component dropdown was disabled
- Falls back to stub implementation when backend is not available
- Fixes langflow-ai#10119
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 5, 2025

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.

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

Walkthrough

list_flows in lfx/helpers/flow.py now attempts to dynamically import and delegate to langflow.helpers.flow.list_flows when available; on ImportError/ModuleNotFoundError it logs a warning and returns an empty list. The function signature and invalid-session error behavior remain unchanged.

Changes

Cohort / File(s) Summary of changes
Flow helpers
src/lfx/src/lfx/helpers/flow.py
Replaced local stub with dynamic delegation to backend list_flows via import and await; added fallback to log a warning and return [] on import failure; preserved function signature and error behavior for invalid sessions.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Caller
    participant LFX as lfx.helpers.flow.list_flows
    participant Import as Dynamic Import
    participant Backend as langflow.helpers.flow.list_flows
    participant Logger as Logger

    Caller->>LFX: list_flows(session, ...)
    LFX->>Import: import Backend
    alt Import succeeds
        LFX->>Backend: await list_flows(session, ...)
        Backend-->>LFX: flows[]
        LFX-->>Caller: flows[]
    else Import fails
        LFX->>Logger: warn("Backend not available")
        LFX-->>Caller: []
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 error, 1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error Reviewing the diff shows that the PR only modifies src/lfx/src/lfx/helpers/flow.py to delegate list_flows to a backend implementation when available, and no new or updated test files are present; there are no changes under any test_*.py or similar naming convention, so no regression coverage has been added for the bug fix. Consequently, the requirement that bug fixes include corresponding tests is unmet. Please add a regression test that exercises the new backend delegation path for list_flows, ensuring the behavior works when the backend module is available and when it is absent, then update the PR.
Test Quality And Coverage ⚠️ Warning Tests still only assert that list_flows returns an empty list, which misses the new delegation path to the backend implementation and the associated warning behavior; consequently, the primary functionality introduced by this PR remains untested. Add tests that simulate the backend import succeeding (e.g., monkeypatching the module loader) to verify the delegated result, plus a case where the import fails to ensure the warning and fallback behavior remain correct.
Test File Naming And Structure ❓ Inconclusive Unable to complete the test file naming and structure audit because test files were expected in test_ directories but none were found in the repository, leaving the compliance status uncertain. Please confirm whether the repository includes test files (and if so where they reside) so their naming, structure, and coverage can be evaluated.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely describes the primary change of enabling the Run Flow Component dropdown by switching from a stub to a backend database implementation, directly reflecting the main functionality added in the changeset.
Linked Issues Check ✅ Passed The update to list_flows now dynamically imports and uses the backend implementation, fulfilling issue #10119 by populating the dropdown with actual flow names and enabling the Run Flow Component to select and run referenced flows as expected.
Out of Scope Changes Check ✅ Passed The only modification is in src/lfx/src/lfx/helpers/flow.py to delegate to the backend list_flows implementation with a fallback stub, and no other files or unrelated functionality have been altered.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Excessive Mock Usage Warning ✅ Passed Reviewed the test suite relevant to list_flows and surrounding functionality and found no instances of excessive mocking; existing tests rely on actual implementations or minimal, appropriate stubbing for external dependencies, so there is no indication of poor test design under this criterion.

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 and usage tips.

@MugheesMehdi07 MugheesMehdi07 changed the title Fix: Enable Run Flow Component dropdown by using backend database fix: Enable Run Flow Component dropdown by using backend database Oct 5, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 5, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 7, 2025
@mpawlow
Copy link
Copy Markdown
Contributor

mpawlow commented Oct 9, 2025

Note: Superseded by #10136

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 9, 2025
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Oct 9, 2025

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.

Running Latest Langflow 1.6 flow component in another flow error

2 participants