Skip to content

Commit c678433

Browse files
authored
minor fixes for troubleshooter (#675)
1 parent b668088 commit c678433

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

pilot/const/code_execution.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
MIN_COMMAND_RUN_TIME = 2000 # 2sec
44
MAX_COMMAND_RUN_TIME = 60000 # 1min
55
MAX_COMMAND_OUTPUT_LENGTH = 50000
6+
MAX_QUESTIONS_FOR_BUG_REPORT = 5

pilot/helpers/agents/Developer.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
color_white_bold
1616
)
1717
from helpers.exceptions import TokenLimitError
18-
from const.code_execution import MAX_COMMAND_DEBUG_TRIES
18+
from const.code_execution import MAX_COMMAND_DEBUG_TRIES, MAX_QUESTIONS_FOR_BUG_REPORT
1919
from helpers.exceptions import TooDeepRecursionError
2020
from helpers.Debugger import Debugger
2121
from utils.questionary import styled_text
@@ -689,22 +689,26 @@ def bug_report_generator(self, user_feedback):
689689
if len(missing_data) == 0:
690690
break
691691

692+
length_before = len(questions_and_answers)
692693
for missing_data_item in missing_data:
693694
if self.project.check_ipc():
694695
print(missing_data_item['question'], type='verbose')
695-
print('skip question', type='button')
696+
print('continue/skip question', type='button')
696697
if self.run_command:
697698
print(self.run_command, type='run_command')
698699

699-
answer = ask_user(self.project, missing_data_item['question'])
700-
if answer.lower() == 'skip question':
700+
answer = ask_user(self.project, missing_data_item['question'], require_some_input=False)
701+
if answer.lower() == 'skip question' or answer.lower() == '' or answer.lower() == 'continue':
701702
continue
702703

703704
questions_and_answers.append({
704705
"question": missing_data_item['question'],
705706
"answer": answer
706707
})
707708

709+
# if user skips all questions or if we got more than 4 answers, we don't want to get stuck in infinite loop
710+
if length_before == len(questions_and_answers) or len(questions_and_answers) >= MAX_QUESTIONS_FOR_BUG_REPORT:
711+
break
708712
bug_report_convo.load_branch(function_uuid)
709713

710714
if len(questions_and_answers):

pilot/prompts/development/bug_report.prompt

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ If you have enough information don't ask any questions.
2323
When thinking of questions, consider the following:
2424
- After getting answers to your questions, you must be able to solve the problem.
2525
- Category on which you need more information ("general", "frontend", "backend", "database", "devops", "other")
26+
- 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.
2627
- Make sure to cover all categories that you need to solve the problem.
2728
- Ask only specific information that you need to solve the problem.
2829
- Ask clear, short and concise questions.

pilot/prompts/development/bug_report_summary.prompt

+1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ Your job is now to write issue explanation that will be sent to developer, stric
2323
- 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.
2424
- Do not use any subjective thoughts, just facts.
2525
- 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:").
26+
- Do not write any new code, only if something is provided by user.
2627
- 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.
2728
- Have in mind that issue might not be related to your current development task.

0 commit comments

Comments
 (0)