Skip to content

Conversation

rodrigosnader
Copy link
Contributor

@rodrigosnader rodrigosnader commented Sep 27, 2025

Summary

  • Adds memory_order dropdown parameter to Agent component with options ["Ascending", "Descending"]
  • Allows users to control chat history message ordering (oldest first vs newest first)
  • Set as advanced parameter with default "Ascending" to maintain backward compatibility

Changes

  • Added DropdownInput for memory order selection
  • Updated get_memory_data() to use configurable order instead of hardcoded "Ascending"
  • Added parameter to exclusion list in get_base_args()

Test plan

  • Verify Agent component shows memory order parameter in advanced settings
  • Test that "Ascending" order shows oldest messages first
  • Test that "Descending" order shows newest messages first
  • Confirm default behavior unchanged (Ascending)

Note: This PR should be reviewed after the memory-related fixes in #10008.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a selectable memory retrieval order (Ascending/Descending) to the Agent component.
    • Message history now respects the chosen order when retrieving past interactions.
    • Build configuration recognizes and validates the new memory order option, ensuring it’s included during setup and updates.

- Add memory_order dropdown input with Ascending/Descending options
- Set as advanced parameter with default "Ascending"
- Update get_memory_data() to use configurable order instead of hardcoded "Ascending"
- Add memory_order to exclusion list in get_base_args()

This allows users to control whether chat history is retrieved in chronological order (oldest first) or reverse chronological order (newest first).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

coderabbitai bot commented Sep 27, 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

Adds a new public input memory_order (Ascending/Descending) to AgentComponent, uses it in get_memory_data to control message retrieval order, and includes memory_order in update_build_config’s required keys.

Changes

Cohort / File(s) Summary of Changes
Agent component: memory order input
src/lfx/src/lfx/components/agents/agent.py
Added DropdownInput memory_order to inputs; get_memory_data uses this to set retrieval order instead of hard-coded "Ascending"; update_build_config now requires/includes memory_order.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant A as AgentComponent
    participant M as MemoryStore

    U->>A: Build/run with memory_order (Ascending/Descending)
    Note over A: New input: memory_order
    A->>M: get_messages(order=memory_order)
    M-->>A: messages (ordered)
    A-->>U: Output using retrieved messages
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 error, 3 warnings)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error The PR modifies the Agent component by adding a configurable memory order but introduces no updates or additions under the repository’s backend or frontend test directories, and no test files matching the project’s naming conventions were added. Because this is a new feature, we expect accompanying unit or integration coverage verifying the ascending versus descending behavior, yet no such tests exist in the diff. Consequently, the custom check criteria for ensuring tests that cover new functionality are not met. Please add automated tests (e.g., pytest module with test_*.py) that exercise the new memory order parameter, validating both ascending and descending retrieval paths, and resubmit once coverage for the added functionality is in place.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Test Quality And Coverage ⚠️ Warning No new or updated automated tests accompany the introduction of the configurable memory order; existing test suites still assume the previous hard-coded ascending behavior, leaving the descending branch and the new dropdown input entirely unverified, so the main functionality lacks meaningful coverage. Please add tests that exercise both ascending and descending memory ordering paths (ideally verifying the returned message order) and ensure the Agent component exposes the new dropdown input as expected before merging.
Test File Naming And Structure ⚠️ Warning No new or updated tests accompany the added memory order functionality, so there are no test files to inspect for naming, structure, or coverage; consequently, the repository lacks tests validating both ascending and descending memory retrieval behavior. Please add appropriately named and structured tests (e.g., test_*.py or *.test.ts[x]) that verify the new memory order parameter handles ascending and descending retrieval paths, including any relevant edge cases, and then resubmit for review.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly specifies that a memory order parameter is being added to the Agent component, directly reflecting the main change of introducing a memory_order dropdown input and updating related methods. It succinctly conveys the feature addition without extraneous detail and uses precise terminology matching the code changes. This phrasing is both clear and specific, ensuring that reviewers can immediately understand the primary purpose of the pull request.
Excessive Mock Usage Warning ✅ Passed Examined the existing test suite and found only one relevant unit test file, tests/unit/components/agents/test_agent_component.py, which uses a single Mock from unittest.mock solely to intercept the invocations of the underlying component; it mainly verifies configuration handling rather than simulating core logic, so the mock usage is minimal and appropriate, and no other tests introduce additional mocks. Therefore, the pull request does not exhibit excessive mocking or poor test design related to this change.

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

@github-actions github-actions bot added the enhancement New feature or request label Sep 27, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Sep 27, 2025
- Fix bug where descending order would return oldest N messages instead of newest N
- When order="DESC", take first N messages (newest) instead of last N messages
- Optimize internal memory to use limit parameter directly instead of post-filtering

This ensures that regardless of sort order, we always keep the most recent N messages.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Sep 27, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Sep 27, 2025
Copy link

codecov bot commented Sep 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 23.25%. Comparing base (fbad5fa) to head (2368314).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10010   +/-   ##
=======================================
  Coverage   23.25%   23.25%           
=======================================
  Files        1090     1090           
  Lines       39855    39855           
  Branches     5531     5531           
=======================================
  Hits         9270     9270           
  Misses      30414    30414           
  Partials      171      171           
Flag Coverage Δ
backend 45.56% <ø> (ø)

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

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

- Change limit parameter logic to handle None values explicitly, ensuring that the default limit of 10000 is applied when n_messages is not provided.
- Updated the code_hash in the metadata section for the Custom Component Generator, Meeting Summary, and Memory Chatbot JSON files to ensure consistency across projects.
- The changes reflect the latest implementation of the MemoryComponent, which handles message storage and retrieval effectively.
- Updated the code_hash in the metadata section for the Custom Component Generator, Meeting Summary, and Memory Chatbot JSON files to maintain consistency across projects.
- These changes reflect the latest implementation of the MemoryComponent, which effectively manages message storage and retrieval.
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Sep 29, 2025
Copy link

@github-actions github-actions bot added the lgtm This PR has been approved by a maintainer label Sep 29, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Sep 29, 2025
@ogabrielluiz ogabrielluiz removed this pull request from the merge queue due to a manual request Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants