Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Contradiction between comments and implementation in plan updating logic #955

Open
William-Wang-Dev opened this issue Mar 12, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@William-Wang-Dev
Copy link

Description

In the _generate_updated_plan method of the MultiStepAgent class. There's a direct contradiction between the code comments and the actual implementation, which likely causes the planning functionality to behave differently than intended.

The Issue

In agents.py,

def _generate_updated_plan(self, task: str, step: int) -> Tuple[ChatMessage, ChatMessage]:
    # Do not take the system prompt message from the memory
    # summary_mode=False: Do not take previous plan steps to avoid influencing the new plan
    memory_messages = self.write_memory_to_messages()[1:]

However, when examining how write_memory_to_messages() and PlanningStep.to_messages() work together, I discovered that setting summary_mode=False (the default when not specified) actually includes previous plans rather than excluding them.
Looking at memory.py, the PlanningStep.to_messages() method shows:

def to_messages(self, summary_mode: bool, **kwargs) -> List[Message]:
    messages = []
    messages.append(
        Message(
            role=MessageRole.ASSISTANT, content=[{"type": "text", "text": f"[FACTS LIST]:\n{self.facts.strip()}"}]
        )
    )

    if not summary_mode:  # This step is not shown to a model writing a plan to avoid influencing the new plan
        messages.append(
            Message(
                role=MessageRole.ASSISTANT, content=[{"type": "text", "text": f"[PLAN]:\n{self.plan.strip()}"}]
            )
        )
    return messages

This means the condition is the exact opposite of what the comment suggests: when summary_mode=False, plans ARE included, not excluded

@William-Wang-Dev William-Wang-Dev added the bug Something isn't working label Mar 12, 2025
@sysradium
Copy link
Contributor

Check out #934

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

No branches or pull requests

2 participants