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

There is a bug in the break_cycle logic in CodeReview #387

Open
snakeytm opened this issue Jun 18, 2024 · 5 comments
Open

There is a bug in the break_cycle logic in CodeReview #387

snakeytm opened this issue Jun 18, 2024 · 5 comments

Comments

@snakeytm
Copy link

composed_phase.py

class CodeReview(ComposedPhase):
    def break_cycle(self, phase_env) -> bool:
        if "<INFO> Finished".lower() in phase_env['modification_conclusion'].lower():
            return True
        else:
            return False

According to the prompt, " Finished" is only returned during the CodeReviewComment stage, and the conclusion of this stage will be stored in chat_env.env_dict['review_comments']. There seems to be a bug in the current code logic. I believe the correct code should be as follows:

class CodeReview(ComposedPhase):
    def break_cycle(self, phase_env) -> bool:
        # 修复bug,这个标识来自于review_comments
        if "<INFO> Finished".lower() in phase_env['review_comments'].lower():
            return True
        else:
            return False
@thinkwee
Copy link
Collaborator

thank you! you are right. could u please make a pr on it?

@snakeytm
Copy link
Author

"Okay, my solution above still has some issues. I'll think about how to fix it."

@snakeytm
Copy link
Author

I've found the issue. Here's a better solution:
Move the code line self.phase_env['modification_conclusion'] = self.seminar_conclusion from the update_chat_env method in the CodeReviewModification class in phase.py to the update_chat_env method in the CodeReviewComment class.

@snakeytm
Copy link
Author

Based on the previous issue, another problem has been identified:
In the chatting method of the Phase class in the phase.py file, there is a line of code: seminar_conclusion = seminar_conclusion.split("")[-1]. Even if the agent returns " Finished", this line of code will result in "Finished", which does not conform to the break_cycle judgment logic, causing the loop to be unable to exit.

@snakeytm
Copy link
Author

I have an idea that might solve this problem. We can categorize the dialogue conclusion markers in the prompt into two types. One type needs to be included in the context to provide information for downstream use, such as " PowerPoint" in DemandAnalysis. The other type is just a marker for ending, such as " Finished" in CodeReviewComment. I suggest changing " Finished" in CodeReviewComment to " Finished".
@thinkwee What do you think?

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

No branches or pull requests

2 participants