Skip to content

Revert "fix: prevent duplicate Task and Response display when using litellm with memory"#618

Merged
MervinPraison merged 1 commit into
mainfrom
revert-617-claude/issue-612-20250606_060924
Jun 6, 2025
Merged

Revert "fix: prevent duplicate Task and Response display when using litellm with memory"#618
MervinPraison merged 1 commit into
mainfrom
revert-617-claude/issue-612-20250606_060924

Conversation

@MervinPraison

@MervinPraison MervinPraison commented Jun 6, 2025

Copy link
Copy Markdown
Owner

User description

Reverts #617


PR Type

Bug fix, Tests


Description

  • Reverts previous fix for duplicate Task and Response display.

  • Removes suppression of display logic in agent and LLM modules.

  • Deletes test file for duplicate display issue.


Changes walkthrough 📝

Relevant files
Bug fix
agent.py
Remove suppression of duplicate display in agent chat       

src/praisonai-agents/praisonaiagents/agent/agent.py

  • Removes suppress_display parameter from LLM call.
  • Deletes logic that suppressed duplicate display and custom display
    interaction.
  • +1/-7     
    llm.py
    Restore always-on display interaction in LLM responses     

    src/praisonai-agents/praisonaiagents/llm/llm.py

  • Removes suppress_display parameter from get_response.
  • Restores display logic to always show interaction if verbose.
  • Removes conditional checks for suppressing display.
  • +6/-7     
    Tests
    test_duplicate_fix.py
    Remove duplicate display issue test script                             

    test_duplicate_fix.py

    • Deletes test script for duplicate display issue.
    +0/-37   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • Refactor
      • Simplified display logic by removing the suppression flag; output is now shown whenever verbose mode is enabled.
    • Tests
      • Removed a test script related to duplicate display verification.

    @coderabbitai

    coderabbitai Bot commented Jun 6, 2025

    Copy link
    Copy Markdown
    Contributor

    Caution

    Review failed

    The pull request is closed.

    """

    Walkthrough

    This change removes the suppress_display parameter and related logic from the LLM's get_response method and its usage in the Agent's chat method. Display of reasoning and responses now depends solely on the verbose flag. Additionally, a test script targeting duplicate display behavior has been deleted.

    Changes

    File(s) Change Summary
    src/praisonai-agents/praisonaiagents/llm/llm.py Removed the suppress_display parameter from get_response and all related conditional display logic.
    src/praisonai-agents/praisonaiagents/agent/agent.py Removed use of suppress_display in the chat method and associated verbose display logic.
    test_duplicate_fix.py Deleted test script that verified duplicate display issue in AI agent framework.

    Sequence Diagram(s)

    sequenceDiagram
        participant User
        participant Agent
        participant LLM
    
        User->>Agent: chat(prompt)
        Agent->>LLM: get_response(prompt, verbose)
        LLM-->>Agent: response
        Agent->>Agent: Append to chat history, validate guardrails
        Agent-->>User: response
    
    Loading

    Possibly related PRs

    • Fix redundant tool invocation #594: Both PRs modify the chat method in agent.py to simplify response handling and display logic, indicating a direct connection in refactoring redundant code.

    Suggested labels

    codex

    Poem

    A rabbit hopped through code so bright,
    Tidying flags and keeping things light.
    No more suppress, just let it show—
    If verbose is true, let reasoning flow!
    Old tests retired, the path is clear,
    For agents to chat without duplicate cheer.
    🐇✨
    """


    📜 Recent review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between b924a78 and 9a66956.

    📒 Files selected for processing (3)
    • src/praisonai-agents/praisonaiagents/agent/agent.py (1 hunks)
    • src/praisonai-agents/praisonaiagents/llm/llm.py (4 hunks)
    • test_duplicate_fix.py (0 hunks)
    ✨ Finishing Touches
    • 📝 Generate Docstrings

    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
    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Explain this complex logic.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai explain this code block.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and explain its main purpose.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Support

    Need help? Create a ticket on our support page for assistance with any issues or questions.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR.
    • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    @MervinPraison MervinPraison merged commit dc45059 into main Jun 6, 2025
    3 of 4 checks passed

    @gemini-code-assist gemini-code-assist 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.

    Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

    Summary of Changes

    Hello team, gemini-code-assist here to provide a summary of this pull request. This PR is a direct revert of pull request #617, titled "fix: prevent duplicate Task and Response display when using litellm with memory". The original PR aimed to prevent duplicate display of LLM interactions by suppressing the display within the LLM layer and handling it explicitly in the agent layer. This revert removes that logic, restoring the display behavior to its state before PR #617 was merged.

    Highlights

    • Revert: This pull request fully reverts the changes introduced in PR #617.
    • Display Logic: The changes remove the suppress_display parameter and the logic associated with preventing duplicate displays when using certain LLM configurations (specifically mentioned in the original PR title as litellm with memory).

    Changelog

    • src/praisonai-agents/praisonaiagents/agent/agent.py
      • Removed the suppress_display=True argument from the llm.get_response call (line 1112 in the original code).
      • Removed the subsequent display_interaction block (lines 1118-1121 in the original code) which was intended to handle display when it was suppressed in the LLM.
    • src/praisonai-agents/praisonaiagents/llm/llm.py
      • Removed the suppress_display: bool = False parameter from the get_response function signature (line 293 in the original code).
      • Removed the and not suppress_display condition from multiple if verbose ... checks (lines 458, 466, 669, 677, 722, 745 in the original code) that controlled when display_interaction was called.
    Using Gemini Code Assist

    The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

    Invoking Gemini

    You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

    Feature Command Description
    Code Review /gemini review Performs a code review for the current pull request in its current state.
    Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
    Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
    Help /gemini help Displays a list of available commands.

    Customization

    To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

    Limitations & Feedback

    Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

    You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

    Footnotes

    1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

    @qodo-code-review

    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Duplicate Output

    This revert will likely cause duplicate Task and Response displays when using litellm with memory, which was the original issue that PR #617 fixed. Verify if this regression is intentional or if an alternative solution is planned.

        reasoning_steps=reasoning_steps
    )
    Display Logic

    The revert restores multiple display_interaction calls that will likely cause duplicate output when an agent uses the LLM. Consider if this is the intended behavior or if display logic needs refinement.

    if verbose and reasoning_content:
        display_interaction(
            original_prompt,
            f"Reasoning:\n{reasoning_content}\n\nAnswer:\n{response_text}",
            markdown=markdown,
            generation_time=time.time() - current_time,
            console=console
        )
    else:
        display_interaction(
            original_prompt,
            response_text,
            markdown=markdown,

    @qodo-code-review

    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @gemini-code-assist gemini-code-assist 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.

    Code Review

    This pull request reverts the changes made in PR #617, which aimed to prevent duplicate Task and Response displays when using litellm with memory. The revert involves removing the suppress_display parameter and its associated logic from agent.py and llm.py, and deleting the corresponding test file.

    The revert seems mostly correct and addresses the removal of the suppression logic consistently. However, there's a potential issue in llm.py where the display logic simplification might lead to unintended displays when verbose is false.

    It would also be beneficial for future context if the PR description included a brief rationale for why PR #617 is being reverted.

    Summary of Findings

    • Potential unintended display in llm.py: In llm.py, the simplification of conditional logic for displaying interactions (specifically, changing elif verbose ... to else) might cause display_interaction to be called even when verbose is False. This could lead to unexpected output. It's recommended to change these else conditions to elif verbose:.
    • Completeness of Revert: The removal of the suppress_display parameter and associated logic appears to be consistently applied across agent.py and llm.py. The deletion of test_duplicate_fix.py is also appropriate for a revert.

    Merge Readiness

    The pull request correctly reverts the intended functionality. However, there are a couple of medium-severity issues identified in llm.py related to conditional display logic that could lead to display_interaction being called when verbose is False. It's recommended to address these issues before merging to ensure the display behavior is as expected. As an AI, I am not authorized to approve pull requests; please ensure this PR is reviewed and approved by a human maintainer.

    console=console
    )
    elif verbose and not suppress_display:
    else:

    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.

    medium

    It looks like the change from elif verbose and not suppress_display: to a simple else: might lead to display_interaction being called even when verbose is False.

    The original logic ensured that verbose was true for both branches involving display_interaction. With the current else, this branch will be taken if verbose and reasoning_content is false. This includes the case where verbose itself is False.

    If display_interaction always produces output (and doesn't internally check verbose), this could lead to unexpected output when verbose is set to False.

    Could we consider changing this else: to elif verbose: to maintain the explicit check for verbosity before calling display_interaction?

    Suggested change
    else:
    elif verbose:

    console=console
    )
    elif verbose and not suppress_display:
    else:

    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.

    medium

    Similar to the comment above (around line 465), this else: condition might cause display_interaction to be called even when verbose is False.

    The original elif verbose and not suppress_display: ensured verbose was true. The current else: will be triggered if verbose and reasoning_content is false, which includes scenarios where verbose itself is False.

    To prevent unintended displays when verbose is False, would it be better to change this to elif verbose:?

    Suggested change
    else:
    elif verbose:

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

    ✅ BugBot reviewed your changes and found no bugs!


    BugBot free trial expires on June 11, 2025
    You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

    Was this report helpful? Give feedback by reacting with 👍 or 👎

    @MervinPraison

    Copy link
    Copy Markdown
    Owner Author

    @BugBot review this error

    shaneholloman pushed a commit to shaneholloman/praisonai that referenced this pull request Feb 4, 2026
    …aude/issue-612-20250606_060924
    
    Revert "fix: prevent duplicate Task and Response display when using litellm with memory"
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant