diff --git a/core/agents/bug_hunter.py b/core/agents/bug_hunter.py index 30df597af..570b0603a 100644 --- a/core/agents/bug_hunter.py +++ b/core/agents/bug_hunter.py @@ -75,9 +75,10 @@ async def check_logs(self, logs_message: str = None): for hunting_cycle in self.current_state.current_iteration.get("bug_hunting_cycles", []): convo = convo.assistant(hunting_cycle["human_readable_instructions"]).template( "log_data", - backend_logs=hunting_cycle["backend_logs"], - frontend_logs=hunting_cycle["frontend_logs"], - fix_attempted=hunting_cycle["fix_attempted"], + backend_logs=hunting_cycle.get("backend_logs"), + frontend_logs=hunting_cycle.get("frontend_logs"), + fix_attempted=hunting_cycle.get("fix_attempted"), + user_feedback=hunting_cycle.get("user_feedback"), ) human_readable_instructions = await llm(convo, temperature=0.5) @@ -161,12 +162,21 @@ async def ask_user_to_test(self, awaiting_bug_reproduction: bool = False, awaiti + self.current_state.current_iteration["bug_reproduction_description"], ) + if frontend_logs.button == "done": + self.next_state.complete_iteration() + else: + user_feedback = await self.ask_question( + "Do you want to add anything else to help Pythagora solve this bug?", + buttons={"continue": "Continue", "done": "Bug is fixed"}, + default="continue", + hint="Instructions for testing:\n\n" + + self.current_state.current_iteration["bug_reproduction_description"], + ) + # TODO select only the logs that are new (with PYTHAGORA_DEBUGGING_LOG) self.next_state.current_iteration["bug_hunting_cycles"][-1]["backend_logs"] = backend_logs.text self.next_state.current_iteration["bug_hunting_cycles"][-1]["frontend_logs"] = frontend_logs.text + self.next_state.current_iteration["bug_hunting_cycles"][-1]["user_feedback"] = user_feedback.text self.next_state.current_iteration["status"] = IterationStatus.HUNTING_FOR_BUG - if frontend_logs.button == "done": - self.next_state.complete_iteration() - return AgentResponse.done(self) diff --git a/core/prompts/bug-hunter/log_data.prompt b/core/prompts/bug-hunter/log_data.prompt index af76a1a67..511081fd7 100644 --- a/core/prompts/bug-hunter/log_data.prompt +++ b/core/prompts/bug-hunter/log_data.prompt @@ -7,7 +7,13 @@ Here are the logs we added to the frontend: ``` {{ frontend_logs }} ``` +{% endif %}{% if user_feedback is not none %} +Finally, here is a hint from a human who tested the app: +``` +{{ user_feedback }} +``` +When you're thinking about what to do next, take into the account human's feedback. {% endif %}{% if fix_attempted %} The problem wasn't solved with the last changes. You have 2 options - to tell me exactly where is the problem happening or to add more logs to better determine where is the problem. If you think we should add more logs around the code to better understand the problem, tell me code snippets in which we should add the logs. If you think you know where the issue is, don't add any new logs but explain what log print tell point you to the problem, what the problem is, what is the solution to this problem and how the solution will fix the problem. What is your answer? Make sure not to repeat mistakes from before that didn't work. {% endif %} -{% if backend_logs is none and frontend_logs is none and fix_attempted == false %}Human didn't supply any data{% endif %} +{% if backend_logs is none and frontend_logs is none and user_feedback is none and fix_attempted == false %}Human didn't supply any data{% endif %}