diff --git a/pilot/const/code_execution.py b/pilot/const/code_execution.py index 8f947a3d4..c54120d53 100644 --- a/pilot/const/code_execution.py +++ b/pilot/const/code_execution.py @@ -3,3 +3,4 @@ MIN_COMMAND_RUN_TIME = 2000 # 2sec MAX_COMMAND_RUN_TIME = 60000 # 1min MAX_COMMAND_OUTPUT_LENGTH = 50000 +MAX_QUESTIONS_FOR_BUG_REPORT = 5 diff --git a/pilot/helpers/agents/Developer.py b/pilot/helpers/agents/Developer.py index 9446eb3ee..bd0bad366 100644 --- a/pilot/helpers/agents/Developer.py +++ b/pilot/helpers/agents/Developer.py @@ -15,7 +15,7 @@ color_white_bold ) from helpers.exceptions import TokenLimitError -from const.code_execution import MAX_COMMAND_DEBUG_TRIES +from const.code_execution import MAX_COMMAND_DEBUG_TRIES, MAX_QUESTIONS_FOR_BUG_REPORT from helpers.exceptions import TooDeepRecursionError from helpers.Debugger import Debugger from utils.questionary import styled_text @@ -689,15 +689,16 @@ def bug_report_generator(self, user_feedback): if len(missing_data) == 0: break + length_before = len(questions_and_answers) for missing_data_item in missing_data: if self.project.check_ipc(): print(missing_data_item['question'], type='verbose') - print('skip question', type='button') + print('continue/skip question', type='button') if self.run_command: print(self.run_command, type='run_command') - answer = ask_user(self.project, missing_data_item['question']) - if answer.lower() == 'skip question': + answer = ask_user(self.project, missing_data_item['question'], require_some_input=False) + if answer.lower() == 'skip question' or answer.lower() == '' or answer.lower() == 'continue': continue questions_and_answers.append({ @@ -705,6 +706,9 @@ def bug_report_generator(self, user_feedback): "answer": answer }) + # if user skips all questions or if we got more than 4 answers, we don't want to get stuck in infinite loop + if length_before == len(questions_and_answers) or len(questions_and_answers) >= MAX_QUESTIONS_FOR_BUG_REPORT: + break bug_report_convo.load_branch(function_uuid) if len(questions_and_answers): diff --git a/pilot/prompts/development/bug_report.prompt b/pilot/prompts/development/bug_report.prompt index cdba1e49e..ab387f118 100644 --- a/pilot/prompts/development/bug_report.prompt +++ b/pilot/prompts/development/bug_report.prompt @@ -23,6 +23,7 @@ If you have enough information don't ask any questions. When thinking of questions, consider the following: - After getting answers to your questions, you must be able to solve the problem. - Category on which you need more information ("general", "frontend", "backend", "database", "devops", "other") +- Client is not very technical person but understands basics. It is crucial that your questions can be answered without looking into code or knowing codebase. Do not ask how something is implemented, how code works or for code snippets. - Make sure to cover all categories that you need to solve the problem. - Ask only specific information that you need to solve the problem. - Ask clear, short and concise questions. diff --git a/pilot/prompts/development/bug_report_summary.prompt b/pilot/prompts/development/bug_report_summary.prompt index 0eca36ec0..9d9ac851b 100644 --- a/pilot/prompts/development/bug_report_summary.prompt +++ b/pilot/prompts/development/bug_report_summary.prompt @@ -23,5 +23,6 @@ Your job is now to write issue explanation that will be sent to developer, stric - Write issue explanation as if you are talking directly to developer (in first person). Do not mention "user", talk as if you found the the issue. - Do not use any subjective thoughts, just facts. - Write only issue explanation. Do not write any recap, summary or ideas how to solve the problem at the end. Do not write introduction at the start (e.g. "Issue Explanation for Developer:"). +- Do not write any new code, only if something is provided by user. - Have in mind that developer is smart and he will understand everything as long as you provide all information that you have and that is needed to fix this issue. - Have in mind that issue might not be related to your current development task.