Skip to content

Conversation

@HzaRashid
Copy link
Collaborator

@HzaRashid HzaRashid commented Jan 18, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved flow execution error handling with better logging and recovery mechanisms
    • Fixed output display to show only final results, skipping intermediate node outputs
  • Improvements

    • Enhanced data extraction and input processing for flows
    • Better graph structure handling and caching behavior
    • Refined field formatting for improved readability

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

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.

  • 🔍 Trigger a full review

Walkthrough

This pull request refactors internal method naming and input handling in the RunFlowBaseComponent. Methods extracting tweaks are renamed to handle "ioputs", graph vertices are unfrozen after loading, error handling is added to cached flow execution, and output formatting is adjusted to skip non-terminal vertices.

Changes

Cohort / File(s) Summary
Test Updates
src/backend/tests/unit/base/tools/test_run_flow.py, src/backend/tests/unit/components/logic/test_run_flow_component.py
Method signature renames reflected in tests: _extract_tweaks_from_keyed_values_extract_ioputs_from_keyed_values and _build_inputs_from_tweaks_build_inputs_from_ioputs. Graph mock initialization updated with vertices and successor_map parameters. New test coverage for Data object handling in ioputs and vertex successor relationship validation.
Core Refactoring
src/lfx/src/lfx/base/tools/run_flow.py
Internal method names updated from tweaks-oriented to ioputs-oriented terminology. Graph vertices explicitly unfrozen after loading. String formatting improved with spacing before parenthetical suffixes. List mutation optimized via explicit extend(). New helper methods _build_inputs() and _build_flow_tweak_data() introduced for input synthesis. _get_cached_run_outputs() and _run_flow_with_cached_graph() signatures simplified by removing tweaks/inputs parameters; internal construction now handled via helpers. Error handling added around flow execution with logging. Output formatting adjusted to skip vertices with outgoing edges. Tool-mode data extraction default changed to False.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR has incomplete test coverage for new _build_inputs method, unresolved issues in test_build_flow_tweak_data_merges_tool_tweaks, and missing tests for significant signature changes. Add dedicated unit test for _build_inputs method, fix trailing whitespace and add mutation validation test for _build_flow_tweak_data, add comprehensive tests for signature changes to _get_cached_run_outputs and _run_flow_with_cached_graph.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning The pull request has test quality and coverage issues including trailing whitespace, missing mutation verification tests, insufficient test coverage for helper methods, and lack of edge case testing. Fix trailing whitespace, add mutation verification tests, create direct tests for _build_inputs, strengthen existing tests with actual data structure validation, and add edge case and error handling tests.
Title check ❓ Inconclusive The title is vague and contains a spelling error ('progation' instead of 'propagation'), making it unclear what specific aspect of runflow toolmode input handling is being fixed. Correct the spelling and be more specific about what the fix addresses, such as 'Fix: runflow toolmode input propagation in flow execution' or clarify which specific issue is being resolved.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Test File Naming And Structure ✅ Passed Test files follow pytest naming conventions with 42 and 25 descriptive test functions organized in logical classes, comprehensive edge case coverage, proper fixtures, and async support.
Excessive Mock Usage Warning ✅ Passed Test files demonstrate appropriate mock usage with 2.0-2.7 mocks per method, well below concerning thresholds. Helper method tests use minimal mocks while testing actual behavior; external dependencies appropriately mocked.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/runflow-toolmode

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.

@HzaRashid HzaRashid force-pushed the fix/runflow-toolmode branch from fffa1fe to 902d937 Compare January 18, 2026 20:33
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/backend/tests/unit/base/tools/test_run_flow.py`:
- Around line 667-687: Remove the trailing whitespace in the test where
component._attributes is defined and add an assertion that _attributes is not
mutated by _build_flow_tweak_data: capture original_attributes =
dict(component._attributes), call component._build_flow_tweak_data(), then
assert component._attributes == original_attributes; if the implementation of
RunFlowBaseComponent._build_flow_tweak_data mutates _attributes, modify that
method to return merged tweak data without altering the original _attributes.

In `@src/lfx/src/lfx/base/tools/run_flow.py`:
- Around line 689-701: The method _build_flow_tweak_data mutates
self._attributes by assigning combined_values = self._attributes and calling
combined_values.update(tool_tweaks); instead, make combined_values a shallow
copy (e.g., copy dict(self._attributes) or use self._attributes.copy()) before
merging tool_tweaks so the original self._attributes is not modified, then
continue to call _extract_ioputs_from_keyed_values(combined_values); ensure you
also handle tool_tweaks.model_dump() as before and only update the copied
combined_values when tool_tweaks is a dict.
🧹 Nitpick comments (1)
src/lfx/src/lfx/base/tools/run_flow.py (1)

495-523: Graph mutation affects cached version; catch overly broad exceptions.

The code caches the graph in get_graph() and later passes it to process_tweaks_on_graph(), which mutates the graph in-place (iterates vertices and calls apply_tweaks_on_vertex() without copying). This means the cached version is modified, affecting subsequent executions. Consider adding a deepcopy before mutations or after retrieving from cache.

The try/except block catches all exceptions with # noqa: BLE001, potentially masking programming errors. get_graph() and run_flow() explicitly raise ValueError, but catching all exceptions and silently returning None can hide unexpected issues during debugging. Consider catching specific exception types.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 18, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 17%
17.54% (5050/28789) 10.96% (2432/22176) 11.63% (733/6299)

Unit Test Results

Tests Skipped Failures Errors Time
2036 0 💤 0 ❌ 0 🔥 26.048s ⏱️

@codecov
Copy link

codecov bot commented Jan 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 34.86%. Comparing base (47f4e80) to head (13a3880).
⚠️ Report is 1 commits behind head on main.

❌ Your project check has failed because the head coverage (41.60%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11348      +/-   ##
==========================================
+ Coverage   34.84%   34.86%   +0.02%     
==========================================
  Files        1420     1420              
  Lines       68200    68162      -38     
  Branches     9981     9974       -7     
==========================================
+ Hits        23762    23765       +3     
+ Misses      43213    43173      -40     
+ Partials     1225     1224       -1     
Flag Coverage Δ
backend 54.21% <ø> (+0.01%) ⬆️
frontend 16.05% <ø> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
src/lfx/src/lfx/base/tools/run_flow.py 0.00% <ø> (ø)

... and 8 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.

@HzaRashid HzaRashid force-pushed the fix/runflow-toolmode branch 2 times, most recently from 56c8d7e to 67d3d2b Compare January 21, 2026 15:17
@HzaRashid HzaRashid added the DO NOT MERGE Don't Merge this PR label Jan 22, 2026
@HzaRashid HzaRashid force-pushed the fix/runflow-toolmode branch 2 times, most recently from 9a1b29d to 817e1d7 Compare January 22, 2026 17:01
@HzaRashid HzaRashid removed the DO NOT MERGE Don't Merge this PR label Jan 22, 2026
@HzaRashid HzaRashid force-pushed the fix/runflow-toolmode branch from 24c6257 to 2259e59 Compare January 22, 2026 17:52
self._attributes.pop("flow_tweak_data", None)

def _process_tweaks_on_graph(self, graph: Graph, tweaks: dict[str, dict[str, Any]]):
# there is a bug with the lfx process_tweaks_on_graph function
Copy link
Collaborator Author

@HzaRashid HzaRashid Jan 22, 2026

Choose a reason for hiding this comment

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

just note that im making a PR that not only fixes the bug but adds several integration tests to verify that the graph runtime behavior correctly reflects prior processing, for all processing helpers

@HzaRashid HzaRashid force-pushed the fix/runflow-toolmode branch 2 times, most recently from 2ac0bde to 8a5ce27 Compare January 26, 2026 21:21
refactor runflow

remove print calls

allow Data inputs and refactoring of runflow component with updated tests

misc

misc

persist tweaks in multi-input scenario

add regression tests

chore: update component index

ruff (tests)

checkout component index from main

chore: update component index
@HzaRashid HzaRashid force-pushed the fix/runflow-toolmode branch from 8a5ce27 to c4afb91 Compare January 26, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run Flow Component can only be used as start of a flow Empty input when using RunFlow component

2 participants