There is a bug in the break_cycle logic in CodeReview
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, "<INFO> 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
thank you! you are right. could u please make a pr on it?
"Okay, my solution above still has some issues. I'll think about how to fix it."
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.
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("<INFO>")[-1]. Even if the agent returns "<INFO> 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.
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 "<INFO> PowerPoint" in DemandAnalysis. The other type is just a marker for ending, such as "<INFO> Finished" in CodeReviewComment. I suggest changing "<INFO> Finished" in CodeReviewComment to "<END> Finished". @thinkwee What do you think?