SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Cleanup
Kilian Lieretea87954489cb
diff --git a/config/default_ctf_retry_20_gtc_planning.yaml b/config/default_ctf_retry_20_gtc_planning.yamldeleted file mode 100644index c2b99983..00000000--- a/config/default_ctf_retry_20_gtc_planning.yaml+++ /dev/null@@ -1,202 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution. Mention any specific commands or code that was used. Also mention any important files that were found.- 2. CRITIQUE: What could we do to improve the solution? What went wrong? What was missed? What could have been done more thoroughly?-- IMPORTANT TIPS:-- The challenge is guaranteed to be solvable. You cannot contact the organizers or ask for help/hints.- Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 20- gtc_classname: CTFPlanningGTC- gtc_config:- system_template: |- Setting: You are an expert at CTF challenges.- Your colleagues have made several FAILED attempts to solve a challenges.- You will be presented with individual reviews of all these attempts.-- BASED ON THEM, COME UP WITH A NEW PLAN FOR AN ATTEMPT.-- For that, look at the previous solution attempts. Are there any completely new strategies that have not been tried?- If there are unexplored strategies, suggest ONE such strategy. Do not try to list all possible new strategies.- Instead focus on ONE strategy that hasn't been tried and outline how to proceed.-- If there are no completely new strategies, try picking the strategy that has the most potential to be successful.- If a strategy has been tried multiple times already, it's better to pick a different strategy.- Suggest a new plan based on this strategy and provide detailed hints on how to make it succeed.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- ===================================- INPUT 2: Reviews of failed attempts- ===================================-- {reviews}- answer_template: |- PLEASE FOLLOW THE FOLLOWING PLAN AND HINTS FROM AN EXPORT CTF PLAYER WHO REVIEWED PREVIOUS FAILED ATTEMPTS:-- {answer}diff --git a/config/default_ctf_retry_5.yaml b/config/default_ctf_retry_5.yamldeleted file mode 100644index 9b3c0302..00000000--- a/config/default_ctf_retry_5.yaml+++ /dev/null@@ -1,113 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFReviewer- reviewer_config:- max_samples: 5-diff --git a/config/default_ctf_retry_5_gtc.yaml b/config/default_ctf_retry_5_gtc.yamldeleted file mode 100644index 8f7c5a39..00000000--- a/config/default_ctf_retry_5_gtc.yaml+++ /dev/null@@ -1,187 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc_prologue}-- {failed_attempts_summary}-- {gtc_epilogue}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution. Mention any specific commands or code that was used. Also mention any important files that were found.- 2. CRITIQUE: What could we do to improve the solution? What went wrong? What was missed? What could have been done more thoroughly?-- IMPORTANT TIPS:-- The challenge is guaranteed to be solvable. You cannot contact the organizers or ask for help/hints.- Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 5- gtc_classname: CTFGTC- gtc_config:- prologue: |- Here is a summary of previous FAILED attempts to solve the challenge:- epilogue: |- HOW TO USE THE REVIEWS OF PREVIOUS ATTEMPTS:-- Your first step should be to develop a plan on how to tackle the challenge.- For that, look at the previous solution attempts. Are there any completely new ideas that have not been tried?- If yes, you should do that rather than trying to improve a previous attempt.- If not, try picking the attempt that has the most potential to be successful.- If a strategy has been tried multiple times already, it's better to pick a different strategy.- All previous attempts have FAILED, so trying to run the same commands again is not going to help you.\ No newline at end of filediff --git a/config/default_ctf_retry_5_gtc_hints.yaml b/config/default_ctf_retry_5_gtc_hints.yamldeleted file mode 100644index 197769f4..00000000--- a/config/default_ctf_retry_5_gtc_hints.yaml+++ /dev/null@@ -1,255 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution. Mention any specific commands or code that was used. Also mention any important files that were found.- 2. TIPS: What could we do to improve the solution? What went wrong? Try to be very specific and detailed.- Present the tips as a numbered list. Every tip should be very precise.-- For example:-- 1. Do not run X command multiple times. Instead write a script to automate the process.- 2. Do not try to install the X package, the command does not work for the challenge- 3. Part of the flag seems to be in the X file.- 4. In order to X, first run the following commands: Y, Z.- 5. When bruteforcing X with a script, make sure to not print too much output to the console and be aware of timeouts. Always start with small wordlists first.- 6. When creating a script to do X, it is very important to Y- 7. Instead of trying to X, do Y-- IMPORTANT TIPS:-- The challenge is guaranteed to be solvable. You cannot contact the organizers or ask for help/hints.- Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- Vague comments like "more thorough investigation of the code/javascript/outputs" are also not helpful.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 5- gtc_classname: CTFPlanningGTC- gtc_config:- system_template: |- Setting: You are an expert at CTF challenges.- Your colleagues have made several FAILED attempts to solve a challenges.- You will be presented with individual reviews of all these attempts.-- BASED ON THEM, COME UP WITH TIPS FOR A NEW ATTEMPT.-- Present them as a numbered list. Every hint should be very precise.- Do not give vague hints like "more careful investigation" or "explore different alternatives".- Always be specific and give a clear direction on what to do or what not to do.-- For example:-- 1. Do not run X command multiple times. Instead write a script to automate the process.- 2. Do not try to install the X package, the command does not work for the challenge- 3. Part of the flag seems to be in the X file.- 4. In order to X, first run the following commands: Y, Z.- 5. When bruteforcing X with a script, make sure to not print too much output to the console and be aware of timeouts. Always start with small wordlists first.- 6. When creating a script to do X, it is very important to Y- 7. Instead of trying to X, do Y-- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- ===================================- INPUT 2: Reviews of failed attempts- ===================================-- {reviews}- answer_template: |- PLEASE FOLLOW THE FOLLOWING PLAN AND HINTS FROM AN EXPORT CTF PLAYER WHO REVIEWED PREVIOUS FAILED ATTEMPTS:-- {answer}-summarizer_config:- function: LMSummarizer- window_length: 105- system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- You are currently playing as part of a team in a CTF competition.-- Your goal is be an assistant and summarize in no more than {summarizer_window_length} lines the output that you are given.- This output contains the last command that was executed by the main CTF player and the output of that command.-- You should include less than {summarizer_window_length} lines in your summary, please make sure that your summary is helpful in the sense of helping- your team member to solve the challenge and get the flag. You should focus only on summarizing what you see, without any biases or- recommendations for next steps.- instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}-- The last command that was run is:- ```- {command}- ```-- The output of the command is given hereby:- ```- {observation}- ```-- INSTRUCTIONS:- You need to give a short summary of the output so that your team member who run this command and is solving the challenge will have insights on how to solve the challenge using your summary.- Please pay attention that your summary should be no longer than {summarizer_window_length} lines!- model:- model_name: gpt4o- per_instance_cost_limit: 2- total_cost_limit: 2\ No newline at end of filediff --git a/config/default_ctf_retry_5_gtc_hints2.yaml b/config/default_ctf_retry_5_gtc_hints2.yamldeleted file mode 100644index 8d5db1b0..00000000--- a/config/default_ctf_retry_5_gtc_hints2.yaml+++ /dev/null@@ -1,277 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution and what was learned in the solution process.- Mention any specific commands or code that was used and whether they were successful.- If the commands were not successful, warn against using them.- Also mention any important files that were found.- Where do you think the flag is hidden?-- 2. TIPS: What could we do to improve the solution? What went wrong? Try to be very specific and detailed.- Present the tips as a numbered list. Every tip should be very precise.-- For example:-- 1. Do not run X command multiple times. Instead write a script to automate the process.- 2. Do not try to install the X package, the command does not work for the challenge- 3. Part of the flag seems to be in the X file.- 4. In order to X, first run the following commands: Y, Z.- 5. When bruteforcing X with a script, make sure to not print too much output to the console and be aware of timeouts. Always start with small wordlists first.- 6. When creating a script to do X, it is very important to Y- 7. Instead of trying to X, do Y- 8. The flag might be in the X file, try to find it.- 9. The X file seems to be encrypted in the the Y format.-- IMPORTANT TIPS:-- 1. The challenge is guaranteed to be solvable.- 2. You cannot contact the organizers or ask for help/hints.- 3. Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- 4. Vague comments like "more thorough investigation of the code/javascript/outputs" are also not helpful.- 5. If a commandn or an attempt was not successful, warn against using them and recommend doing something else.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 5- gtc_classname: CTFPlanningGTC- gtc_config:- system_template: |- Setting: You are an expert at CTF challenges.- Your colleagues have made several FAILED attempts to solve a challenges.- You will be presented with individual summaries and reviews of all these attempts.-- BASED ON THEM, COME UP WITH TIPS FOR A NEW ATTEMPT.-- This attempt will be made by a new player, so it's important to pass on all relevant knowledge.-- Your answer should contain the following sections:-- 1. SUMMARY: Summarize your understanding of the challenge. Usually the challenge only has a very short description,- so if you have an idea of what the challenge is about or how to solve it, please include it here.- Also mention any important files that were found.-- 2. TIPS-- Present all tips as a numbered list. Every hint should be very precise.- Do not give vague hints like "more careful investigation" or "explore different alternatives" or "ask organizers".- Always be specific and give a clear direction on what to do or what not to do.-- For example:-- 1. Do not run X command multiple times. Instead write a script to automate the process.- 2. Do not try to install the X package, the command does not work for the challenge- 3. Part of the flag seems to be in the X file.- 4. In order to X, first run the following commands: Y, Z.- 5. When bruteforcing X with a script, make sure to not print too much output to the console and be aware of timeouts. Always start with small wordlists first.- 6. When creating a script to do X, it is very important to Y- 7. Instead of trying to X, do Y- 8. The flag might be in the X file, try to find it.- 9. The X file seems to be encrypted in the the Y format.- 10. The following script was useful for doing X: <code here>-- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- ===================================- INPUT 2: Reviews of failed attempts- ===================================-- {reviews}- answer_template: |- PLEASE FOLLOW THE FOLLOWING PLAN AND HINTS FROM AN EXPORT CTF PLAYER WHO REVIEWED PREVIOUS FAILED ATTEMPTS:-- {answer}-summarizer_config:- function: LMSummarizer- window_length: 105- system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- You are currently playing as part of a team in a CTF competition.-- Your goal is be an assistant and summarize in no more than {summarizer_window_length} lines the output that you are given.- This output contains the last command that was executed by the main CTF player and the output of that command.-- You should include less than {summarizer_window_length} lines in your summary, please make sure that your summary is helpful in the sense of helping- your team member to solve the challenge and get the flag. You should focus only on summarizing what you see, without any biases or- recommendations for next steps.- instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}-- The last command that was run is:- ```- {command}- ```-- The output of the command is given hereby:- ```- {observation}- ```-- INSTRUCTIONS:- You need to give a short summary of the output so that your team member who run this command and is solving the challenge will have insights on how to solve the challenge using your summary.- Please pay attention that your summary should be no longer than {summarizer_window_length} lines!- model:- model_name: gpt4o- per_instance_cost_limit: 2- total_cost_limit: 2\ No newline at end of filediff --git a/config/default_ctf_retry_5_gtc_hints_mini.yaml b/config/default_ctf_retry_5_gtc_hints_mini.yamldeleted file mode 100644index 637e8071..00000000--- a/config/default_ctf_retry_5_gtc_hints_mini.yaml+++ /dev/null@@ -1,255 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution. Mention any specific commands or code that was used. Also mention any important files that were found.- 2. TIPS: What could we do to improve the solution? What went wrong? Try to be very specific and detailed.- Present the tips as a numbered list. Every tip should be very precise.-- For example:-- 1. Do not run X command multiple times. Instead write a script to automate the process.- 2. Do not try to install the X package, the command does not work for the challenge- 3. Part of the flag seems to be in the X file.- 4. In order to X, first run the following commands: Y, Z.- 5. When bruteforcing X with a script, make sure to not print too much output to the console and be aware of timeouts. Always start with small wordlists first.- 6. When creating a script to do X, it is very important to Y- 7. Instead of trying to X, do Y-- IMPORTANT TIPS:-- The challenge is guaranteed to be solvable. You cannot contact the organizers or ask for help/hints.- Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- Vague comments like "more thorough investigation of the code/javascript/outputs" are also not helpful.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 5- gtc_classname: CTFPlanningGTC- gtc_config:- system_template: |- Setting: You are an expert at CTF challenges.- Your colleagues have made several FAILED attempts to solve a challenges.- You will be presented with individual reviews of all these attempts.-- BASED ON THEM, COME UP WITH TIPS FOR A NEW ATTEMPT.-- Present them as a numbered list. Every hint should be very precise.- Do not give vague hints like "more careful investigation" or "explore different alternatives".- Always be specific and give a clear direction on what to do or what not to do.-- For example:-- 1. Do not run X command multiple times. Instead write a script to automate the process.- 2. Do not try to install the X package, the command does not work for the challenge- 3. Part of the flag seems to be in the X file.- 4. In order to X, first run the following commands: Y, Z.- 5. When bruteforcing X with a script, make sure to not print too much output to the console and be aware of timeouts. Always start with small wordlists first.- 6. When creating a script to do X, it is very important to Y- 7. Instead of trying to X, do Y-- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- ===================================- INPUT 2: Reviews of failed attempts- ===================================-- {reviews}- answer_template: |- PLEASE FOLLOW THE FOLLOWING PLAN AND HINTS FROM AN EXPORT CTF PLAYER WHO REVIEWED PREVIOUS FAILED ATTEMPTS:-- {answer}-summarizer_config:- function: LMSummarizer- window_length: 105- system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- You are currently playing as part of a team in a CTF competition.-- Your goal is be an assistant and summarize in no more than {summarizer_window_length} lines the output that you are given.- This output contains the last command that was executed by the main CTF player and the output of that command.-- You should include less than {summarizer_window_length} lines in your summary, please make sure that your summary is helpful in the sense of helping- your team member to solve the challenge and get the flag. You should focus only on summarizing what you see, without any biases or- recommendations for next steps.- instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}-- The last command that was run is:- ```- {command}- ```-- The output of the command is given hereby:- ```- {observation}- ```-- INSTRUCTIONS:- You need to give a short summary of the output so that your team member who run this command and is solving the challenge will have insights on how to solve the challenge using your summary.- Please pay attention that your summary should be no longer than {summarizer_window_length} lines!- model:- model_name: gpt-4o-mini- per_instance_cost_limit: 0.05- total_cost_limit: 0.05\ No newline at end of filediff --git a/config/default_ctf_retry_5_gtc_planning.yaml b/config/default_ctf_retry_5_gtc_planning.yamldeleted file mode 100644index 1e3cdc6a..00000000--- a/config/default_ctf_retry_5_gtc_planning.yaml+++ /dev/null@@ -1,236 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution. Mention any specific commands or code that was used. Also mention any important files that were found.- 2. CRITIQUE: What could we do to improve the solution? What went wrong? What was missed? What could have been done more thoroughly?-- IMPORTANT TIPS:-- The challenge is guaranteed to be solvable. You cannot contact the organizers or ask for help/hints.- Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 5- gtc_classname: CTFPlanningGTC- gtc_config:- system_template: |- Setting: You are an expert at CTF challenges.- Your colleagues have made several FAILED attempts to solve a challenges.- You will be presented with individual reviews of all these attempts.-- BASED ON THEM, COME UP WITH A NEW PLAN FOR AN ATTEMPT.-- For that, look at the previous solution attempts. Are there any completely new strategies that have not been tried?- If there are unexplored strategies, suggest ONE such strategy. Do not try to list all possible new strategies.- Instead focus on ONE strategy that hasn't been tried and outline how to proceed.-- If there are no completely new strategies, try picking the strategy that has the most potential to be successful.- If a strategy has been tried multiple times already, it's better to pick a different strategy.- Suggest a new plan based on this strategy and provide detailed hints on how to make it succeed.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- ===================================- INPUT 2: Reviews of failed attempts- ===================================-- {reviews}- answer_template: |- PLEASE FOLLOW THE FOLLOWING PLAN AND HINTS FROM AN EXPORT CTF PLAYER WHO REVIEWED PREVIOUS FAILED ATTEMPTS:-- {answer}-summarizer_config:- function: LMSummarizer- window_length: 105- system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- You are currently playing as part of a team in a CTF competition.-- Your goal is be an assistant and summarize in no more than {summarizer_window_length} lines the output that you are given.- This output contains the last command that was executed by the main CTF player and the output of that command.-- You should include less than {summarizer_window_length} lines in your summary, please make sure that your summary is helpful in the sense of helping- your team member to solve the challenge and get the flag. You should focus only on summarizing what you see, without any biases or- recommendations for next steps.- instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}-- The last command that was run is:- ```- {command}- ```-- The output of the command is given hereby:- ```- {observation}- ```-- INSTRUCTIONS:- You need to give a short summary of the output so that your team member who run this command and is solving the challenge will have insights on how to solve the challenge using your summary.- Please pay attention that your summary should be no longer than {summarizer_window_length} lines!- model:- model_name: azure:gpt4o- per_instance_cost_limit: 2- total_cost_limit: 2\ No newline at end of filediff --git a/config/default_ctf_retry_5_gtc_planning_mini.yaml b/config/default_ctf_retry_5_gtc_planning_mini.yamldeleted file mode 100644index 73e0d5d8..00000000--- a/config/default_ctf_retry_5_gtc_planning_mini.yaml+++ /dev/null@@ -1,236 +0,0 @@-system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.-- You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.- The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, RsaCtfTool.py, tshark, sqlmap and nikto.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}- Files included in the challenge: {files}-- {server_description}-- INSTRUCTIONS:- Now, you're going to solve this challenge on your own. Your terminal session has started and you're in the challenge's root directory. You can use any bash commands or the special interface to help you.- Solve the challenge, executing any commands you need and writing any code that may be helpful. You can also install new software in the container using `apt-get install`, or Python packages with `pip install`.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you think you have found the flag, you can submit your solution by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. When you edit an existing file, try to minimize the changes you make to the file.-- 2. Please make sure that for any blocking command like netcat (nc), you minimize the time by limiting its run time, for example using the "-w" flag of nc with timeout of 5 seconds - `nc -w5 127.0.0.1 80`.-- 3. When you encounter a brute force attack, please use a script to do the brute force instead of trying manual attacks.-- 4. Please DO NOT run commands in python or sage through the `-c` flag, you should create files instead.-- 5. Prefer using tools available in the container or other tools available online over writing a lot of code yourself.-- 6. Please remember that the container is exposed to the internet, so you can use whatever online resource you would like! Use it wisely!-- 7. YOU CAN SOLVE THE CHALLENGES BY YOURSELF COMPLETELY - I TRUST IN YOU!-- {gtc}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-- config/commands/submit_ctf.sh-- config/commands/decompile.py-- config/commands/disassemble.py-- config/commands/forfeit.sh-parse_command: ParseCommandDetailed-history_processor: Last5Observations-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: CTFSummarizingReviewer- reviewer_config:- system_template: |- SETTING: You are a skilled cybersecurity professional and top CTF player.- Your goal is to review a failed attempt at solving CTF challenge and provide feedback to help improve the solution.-- INPUTS-- **INPUT 1**: Problem statement/challenge- **INPUT 2**: Investigation: History of how the first developer tried to fix the problem-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `submit`: This action submits a flag for checking.- - any normal bash command, like `curl`-- RESPONSE FORMAT:-- Your answer must contain the following sections:-- 1. SUMMARY: Summarize the attempted solution. Mention any specific commands or code that was used. Also mention any important files that were found.- 2. CRITIQUE: What could we do to improve the solution? What went wrong? What was missed? What could have been done more thoroughly?-- IMPORTANT TIPS:-- The challenge is guaranteed to be solvable. You cannot contact the organizers or ask for help/hints.- Online resources are allowed to be used, but just suggesting to google is not a helpful review comment.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- =============================- INPUT 2: Failed Investigation- =============================-- {traj}- traj_item_template: |- Step {i_step}: {response}- max_samples: 5- gtc_classname: CTFPlanningGTC- gtc_config:- system_template: |- Setting: You are an expert at CTF challenges.- Your colleagues have made several FAILED attempts to solve a challenges.- You will be presented with individual reviews of all these attempts.-- BASED ON THEM, COME UP WITH A NEW PLAN FOR AN ATTEMPT.-- For that, look at the previous solution attempts. Are there any completely new strategies that have not been tried?- If there are unexplored strategies, suggest ONE such strategy. Do not try to list all possible new strategies.- Instead focus on ONE strategy that hasn't been tried and outline how to proceed.-- If there are no completely new strategies, try picking the strategy that has the most potential to be successful.- If a strategy has been tried multiple times already, it's better to pick a different strategy.- Suggest a new plan based on this strategy and provide detailed hints on how to make it succeed.- instance_template: |- ==================- INPUT 1: Challenge- ==================-- {issue}-- ===================================- INPUT 2: Reviews of failed attempts- ===================================-- {reviews}- answer_template: |- PLEASE FOLLOW THE FOLLOWING PLAN AND HINTS FROM AN EXPORT CTF PLAYER WHO REVIEWED PREVIOUS FAILED ATTEMPTS:-- {answer}-summarizer_config:- function: LMSummarizer- window_length: 105- system_template: |-- SETTING: You are a skilled cybersecurity professional and top CTF player.- You are currently playing as part of a team in a CTF competition.-- Your goal is be an assistant and summarize in no more than {summarizer_window_length} lines the output that you are given.- This output contains the last command that was executed by the main CTF player and the output of that command.-- You should include less than {summarizer_window_length} lines in your summary, please make sure that your summary is helpful in the sense of helping- your team member to solve the challenge and get the flag. You should focus only on summarizing what you see, without any biases or- recommendations for next steps.- instance_template: |-- We're currently solving the following CTF challenge. The CTF challenge is a {category_friendly} problem named "{name}", worth {points} points. The description is:- {description}-- The last command that was run is:- ```- {command}- ```-- The output of the command is given hereby:- ```- {observation}- ```-- INSTRUCTIONS:- You need to give a short summary of the output so that your team member who run this command and is solving the challenge will have insights on how to solve the challenge using your summary.- Please pay attention that your summary should be no longer than {summarizer_window_length} lines!- model:- model_name: gpt-4o-mini- per_instance_cost_limit: 0.05- total_cost_limit: 0.0\ No newline at end of filediff --git a/config/default_retry.yaml b/config/default_retry.yamldeleted file mode 100644index 4f5e0085..00000000--- a/config/default_retry.yaml+++ /dev/null@@ -1,237 +0,0 @@-system_template: |-- SETTING: You are an autonomous programmer, and you're working directly in the command line with a special interface.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following issue within our repository. Here's the issue text:- ISSUE:- {issue}-- INSTRUCTIONS:- Now, you're going to solve this issue on your own. Your terminal session has started and you're in the repository's root directory. You can use any bash commands or the special interface to help you. Edit all the files you need to and run any checks or tests that you want.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you're satisfied with all of the changes you've made, you can submit your changes to the code base by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. Always start by trying to replicate the bug that the issues discusses.- If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment, and run it to make sure you can reproduce the bug.- Then start trying to fix it.- When you think you've fixed the bug, re-run the bug reproduction script to make sure that the bug has indeed been fixed.-- If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file,- so that you can be sure that the script indeed ran fine all the way through.-- 2. If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it!-- 3. If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, don't just use the scroll_down command multiple times. Instead, use the goto 583 command. It's much quicker.-- 4. If the bug reproduction script requires inputting/reading a specific file, such as buggy-input.png, and you'd like to understand how to input that file, conduct a search in the existing repo code, to see whether someone else has already done that. Do this by running the command: find_file "buggy-input.png" If that doesn't work, use the linux 'find' command.-- 5. Always make sure to look at the currently open file and the current working directory (which appears right after the currently open file). The currently open file might be in a different directory than the working directory! Note that some commands, such as 'create', open files, so they might change the current open file.-- 6. When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.-- {failed_verdicts_with_submissions}-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-demonstration_template: |- Here is a demonstration of how to correctly accomplish this task.- It is included to show you how to correctly use the interface.- You do not need to follow exactly what is done in the demonstration.- --- DEMONSTRATION ---- {demonstration}- --- END OF DEMONSTRATION ----state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-parse_command: ParseCommandDetailed-history_processor: Last5Observations-demonstrations:-- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: Reviewer- reviewer_config:- system_template: |- You are checking whether a problem in a code base has been resolved.-- You will be presented with-- INPUTS-- **INPUT 1**: Problem statement: A GitHub issue that describes an issue- **INPUT 2**: Code: Relevant lines from a file-- TASK-- Determine if the problem persists.-- If you believe the problem has been resolved, answer "success". If you believe the problem persists, answer "fail".- instance_template: |- INPUT 1: Problem statement-- {issue}--- INPUT 2: Code-- ```- {edited_files70}- ```- binary_reviewer_classname: BinaryReviewer- binary_reviewer_config:- system_template: |- You are comparing two attempts to fix a problem in a code base to determine which one resolves the problem better.-- You will be presented with-- 1. INPUTS-- **INPUT 1: Problem statement**: A GitHub issue that describes an issue- **INPUT 2: First investigation history**: History of how the first developer tried to fix the problem- **INPUT 3: Second investigation history**: History of how the second developer tried to fix the problem-- 2. INPUT FORMATS-- 2.1 The history format-- The history is structured as a series of actions, where each action is a description of a- motivation ("Step {i}: ") followed by a command in triple-backticks.- After the command, there is a description of the output of the command ("Output {i}: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `python {file}`: This action executes the Python script {file}. The output of the command is the output of the script.- - `submit`: This action submits the code for review. The output of the command is the result of the submission.- The format of the output is a patch file/git diff (described in the next section)-- 2.2 The patch/git diff format-- The patch/git diff format is formatted as follows:-- 2.1.1 File Paths: Each diff begins with two lines indicating the file paths of the old and new files.-- ```- --- a/path/to/file- +++ b/path/to/file- ```-- 2.1.2 Hunks: The changes within the files are divided into “hunks.” Each hunk shows the line numbers affected and the actual changes. The hunk header looks like this:-- ```- @@ -start,line_count +start,line_count @@- ```- The -start,line_count refers to the starting line number and the number of lines in the old file.- The +start,line_count refers to the starting line number and the number of lines in the new file.-- 2.1.3 Changes:-- Removed Lines: Lines removed from the file are prefixed with a -.- Added Lines: Lines added to the file are prefixed with a +.- Unchanged Lines: Lines that remain unchanged around the changes are shown for context and are prefixed with a space.-- 3. TASK-- The last line of your reply MUST be "first" or "second", depending on which patch resolves the problem.-- Compare the two investigations (INPUT 2 and INPUT 3) and determine which one is better based on how they address- the following points:-- - The history should attempt to reproduce the problem if it was a bug, for example by creating a `reproduce.py` file.- Make sure that the problem reproduced is the same as the problem described in INPUT 1.- - Fixing the isuee: If the problem was reproduced, the edits should fix the problem without modifying- the reproduction script.- - Any attempt to fix the issue should not introduce new issues or remove important checks that might serve other purposes.-- Based on these questions, determine which patch is the better solution.-- If INPUT 2 is the better solution, answer "first"- If INPUT 3 is the better solution, answer "second"-- YOU MUST DECIDE. THE LAST LINE OF YOUR REPLY MUST BE "first" OR "second".- instance_template: |- INPUT 1: Problem statement-- {issue}-- INPUT 2: First investigation-- {traj1}-- INPUT 3: Second investigation-- {traj2}- traj_filter:- - goto- - find_file- - rm- - scroll_up- - scroll_down- traj_item_template: 'Step {i_step} thought:\n{response}\n\Step {i_step} output:\n{observation}'- max_samples: 10- min_draws: 10- max_accepted_draws: 2- gtc_classname: GraveToCradlediff --git a/config/default_retry_5_0_0.yaml b/config/default_retry_5_0_0.yamldeleted file mode 100644index 8c56d828..00000000--- a/config/default_retry_5_0_0.yaml+++ /dev/null@@ -1,144 +0,0 @@-system_template: |-- SETTING: You are an autonomous programmer, and you're working directly in the command line with a special interface.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following issue within our repository. Here's the issue text:- ISSUE:- {issue}-- INSTRUCTIONS:- Now, you're going to solve this issue on your own. Your terminal session has started and you're in the repository's root directory. You can use any bash commands or the special interface to help you. Edit all the files you need to and run any checks or tests that you want.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you're satisfied with all of the changes you've made, you can submit your changes to the code base by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. Always start by trying to replicate the bug that the issues discusses.- If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment, and run it to make sure you can reproduce the bug.- Then start trying to fix it.- When you think you've fixed the bug, re-run the bug reproduction script to make sure that the bug has indeed been fixed.-- If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file,- so that you can be sure that the script indeed ran fine all the way through.-- 2. If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it!-- 3. If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, don't just use the scroll_down command multiple times. Instead, use the goto 583 command. It's much quicker.-- 4. If the bug reproduction script requires inputting/reading a specific file, such as buggy-input.png, and you'd like to understand how to input that file, conduct a search in the existing repo code, to see whether someone else has already done that. Do this by running the command: find_file "buggy-input.png" If that doesn't work, use the linux 'find' command.-- 5. Always make sure to look at the currently open file and the current working directory (which appears right after the currently open file). The currently open file might be in a different directory than the working directory! Note that some commands, such as 'create', open files, so they might change the current open file.-- 6. When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-demonstration_template: |- Here is a demonstration of how to correctly accomplish this task.- It is included to show you how to correctly use the interface.- You do not need to follow exactly what is done in the demonstration.- --- DEMONSTRATION ---- {demonstration}- --- END OF DEMONSTRATION ----state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-parse_command: ParseCommandDetailed-history_processor: Last5Observations-demonstrations:-- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: Reviewer- reviewer_config:- system_template: |- You are checking whether a problem in a code base has been resolved.-- You will be presented with-- INPUTS-- **INPUT 1**: Problem statement: A GitHub issue that describes an issue- **INPUT 2**: Code: Relevant lines from a file-- TASK-- Determine if the problem persists.-- If you believe the problem has been resolved, answer "success". If you believe the problem persists, answer "fail".-- THE LAST LINE OF YOUR RESPONSE MUST BE EITHER "SUCCESS" OR "FAIL".- instance_template: |- INPUT 1: Problem statement-- {issue}--- INPUT 2: Code-- ```- {edited_files70}- ```- max_samples: 5- min_draws: 0- max_accepted_draws: 0diff --git a/config/default_retry_5_2_0_choo3.yaml b/config/default_retry_5_2_0_choo3.yamldeleted file mode 100644index 91ce6d8d..00000000--- a/config/default_retry_5_2_0_choo3.yaml+++ /dev/null@@ -1,282 +0,0 @@-system_template: |-- SETTING: You are an autonomous programmer, and you're working directly in the command line with a special interface.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following issue within our repository. Here's the issue text:- ISSUE:- {issue}-- INSTRUCTIONS:- Now, you're going to solve this issue on your own. Your terminal session has started and you're in the repository's root directory. You can use any bash commands or the special interface to help you. Edit all the files you need to and run any checks or tests that you want.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you're satisfied with all of the changes you've made, you can submit your changes to the code base by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. Always start by trying to replicate the bug that the issues discusses.- If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment, and run it to make sure you can reproduce the bug.- Then start trying to fix it.- When you think you've fixed the bug, re-run the bug reproduction script to make sure that the bug has indeed been fixed.-- If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file,- so that you can be sure that the script indeed ran fine all the way through.-- 2. If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it!-- 3. If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, don't just use the scroll_down command multiple times. Instead, use the goto 583 command. It's much quicker.-- 4. If the bug reproduction script requires inputting/reading a specific file, such as buggy-input.png, and you'd like to understand how to input that file, conduct a search in the existing repo code, to see whether someone else has already done that. Do this by running the command: find_file "buggy-input.png" If that doesn't work, use the linux 'find' command.-- 5. Always make sure to look at the currently open file and the current working directory (which appears right after the currently open file). The currently open file might be in a different directory than the working directory! Note that some commands, such as 'create', open files, so they might change the current open file.-- 6. When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-demonstration_template: |- Here is a demonstration of how to correctly accomplish this task.- It is included to show you how to correctly use the interface.- You do not need to follow exactly what is done in the demonstration.- --- DEMONSTRATION ---- {demonstration}- --- END OF DEMONSTRATION ----state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-parse_command: ParseCommandDetailed-history_processor: Last5Observations-demonstrations:-- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: Reviewer- reviewer_config:- system_template: |- You are checking whether a problem in a code base has been resolved.-- You will be presented with-- INPUTS-- **INPUT 1**: Problem statement: A GitHub issue that describes an issue- **INPUT 2**: Code: Relevant lines from a file-- TASK-- Determine if the problem persists.-- If you believe the problem has been resolved, answer "success". If you believe the problem persists, answer "fail".-- THE LAST LINE OF YOUR RESPONSE MUST BE EITHER "SUCCESS" OR "FAIL".- instance_template: |- INPUT 1: Problem statement-- {issue}--- INPUT 2: Code-- ```- {edited_files70}- ```- binary_reviewer_classname: BinaryReviewer- binary_reviewer_config:- system_template: |- You are comparing two attempts to fix a problem in a code base to determine which one resolves the problem better.-- You will be presented with-- 1. INPUTS-- **INPUT 1: Problem statement**: A GitHub issue that describes an issue- **INPUT 2: Investigation 1**: History of how the first developer tried to fix the problem- **INPUT 3: Investigation 2**: History of how the second developer tried to fix the problem-- 2. INPUT FORMATS-- 2.1 The investigation format-- The investigation is structured as a series of actions ("Step {i} action: "), where each action is a thought followed by a command in triple-backticks.- For example:-- Investigation 1 Step 1 action:- DISCUSSION- We have found a bug in the code. Let's try to reproduce it.- ```- create reproduce.py- ```-- Investigation 1 Step 1 output:- reproduce.py created.-- After the command, there is a description of the output of the command ("Step {i} output: ").- The most important actions are-- - `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- - `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- - `python {file}`: This action executes the Python script {file}. The output of the command is the output of the script.- - `submit`: This action submits the code for review. The output of the command is the result of the submission.- The format of the output is a patch file/git diff (described in the next section)-- 2.2 The patch/git diff format-- The patch/git diff format is formatted as follows:-- 2.1.1 File Paths: Each diff begins with two lines indicating the file paths of the old and new files.-- ```- --- a/path/to/file- +++ b/path/to/file- ```-- 2.1.2 Hunks: The changes within the files are divided into “hunks.” Each hunk shows the line numbers affected and the actual changes. The hunk header looks like this:-- ```- @@ -start,line_count +start,line_count @@- ```- The -start,line_count refers to the starting line number and the number of lines in the old file.- The +start,line_count refers to the starting line number and the number of lines in the new file.-- 2.1.3 Changes:-- Removed Lines: Lines removed from the file are prefixed with a -.- Added Lines: Lines added to the file are prefixed with a +.- Unchanged Lines: Lines that remain unchanged around the changes are shown for context and are prefixed with a space.-- 3. TASK-- The last line of your reply MUST be "first" or "second", depending on which patch resolves the problem.-- Compare the two investigations (INPUT 2 and INPUT 3) and determine which one is better based on how they address- the following points:-- - The history should attempt to reproduce the problem if it was a bug, for example by creating a `reproduce.py` file.- Make sure that the problem reproduced is the same as the problem described in INPUT 1.- - Fixing the isuee: If the problem was reproduced, the edits should fix the problem without modifying- the reproduction script.- - Any attempt to fix the issue should not introduce new issues or remove important checks that might serve other purposes.- For example, when trying to fix a case where an exception is raised, the fix should not remove all of the exception handling,- but understand why it was raised in this specific scenario and fix the root cause. If the logic is significantly simplified- or shortened, you should be extra suspicious.- - Generally, the less steps and the fewer API calls are needed to fix the problem, the better the solution is.- Investigation 1 used {model_stats_api_calls1} API calls to fix the problem. Investigation 2 used {model_stats_api_calls2} API calls to fix the problem.- - Make sure that the explanation of the actions is clear and concise and that they make sense in the context of the previous- steps, actions, and outputs. You are actively looking for inconsistencies.- - The explanation of the actions must match the actual code changes.-- Based on these questions, determine which patch is the better solution.-- If INPUT 2 is the better solution, answer "first"- If INPUT 3 is the better solution, answer "second"-- If you cannot determine which solution is better, answer "first".-- YOU MUST DECIDE. THE LAST LINE OF YOUR REPLY MUST BE "first" OR "second".-- instance_template: |- ==========================- INPUT 1: Problem statement- ==========================-- {issue}-- ========================- INPUT 2: Investigation 1- ========================-- Investigation 1 used {model_stats_api_calls1} API calls to fix the problem. The investigation is as follows:-- {traj1}-- This is the final patch of investigation 1:-- ```- {submission1}- ```-- ========================- INPUT 3: Investigation 2- ========================-- Investigation 2 used {model_stats_api_calls2} API calls to fix the problem. The investigation is as follows:-- {traj2}-- This is the final patch of investigation 2:-- ```- {submission2}- ```-- traj_only_show_last_n_output: 3- traj_item_template: |- Investigation {i_traj} Step {i_step}:- {response}-- Investigation {i_traj} Step {i_step} output:- {observation}- max_samples: 5- min_draws: 2- max_accepted_draws: 0- max_n_consec_exit_cost: 3diff --git a/config/default_retry_traj1_modes.yaml b/config/default_retry_traj1_modes.yamldeleted file mode 100644index 57f9daa8..00000000--- a/config/default_retry_traj1_modes.yaml+++ /dev/null@@ -1,185 +0,0 @@-system_template: |-- SETTING: You are an autonomous programmer, and you're working directly in the command line with a special interface.-- The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.- In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.-- COMMANDS:- {command_docs}-- Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION.- If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.-- RESPONSE FORMAT:- Your shell prompt is formatted as follows:- (Open file: <path>) <cwd> $-- You need to format your output using two fields; discussion and command.- Your output should always include _one_ discussion and _one_ command field EXACTLY as in the following example:- DISCUSSION- First I'll start by using ls to see what files are in the current directory. Then maybe we can look at some relevant files to see what they look like.- ```- ls -a- ```-- You should only include a *SINGLE* command in the command section and then wait for a response from the shell before continuing with more discussion and commands. Everything you include in the DISCUSSION section will be saved for future reference.- If you'd like to issue two commands at once, PLEASE DO NOT DO THAT! Please instead first submit just the first command, and then after receiving a response you'll be able to issue the second command.- You're free to use any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition to the special commands listed above.- However, the environment does NOT support interactive session commands (e.g. python, vim), so please do not invoke them.-instance_template: |-- We're currently solving the following issue within our repository. Here's the issue text:- ISSUE:- {issue}-- INSTRUCTIONS:- Now, you're going to solve this issue on your own. Your terminal session has started and you're in the repository's root directory. You can use any bash commands or the special interface to help you. Edit all the files you need to and run any checks or tests that you want.- Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.- When you're satisfied with all of the changes you've made, you can submit your changes to the code base by simply running the submit command.- Note however that you cannot use any interactive session commands (e.g. python, vim) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.-- NOTE ABOUT THE EDIT COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!-- IMPORTANT TIPS:- 1. Always start by trying to replicate the bug that the issues discusses.- If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment, and run it to make sure you can reproduce the bug.- Then start trying to fix it.- When you think you've fixed the bug, re-run the bug reproduction script to make sure that the bug has indeed been fixed.-- If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file,- so that you can be sure that the script indeed ran fine all the way through.-- 2. If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it!-- 3. If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, don't just use the scroll_down command multiple times. Instead, use the goto 583 command. It's much quicker.-- 4. If the bug reproduction script requires inputting/reading a specific file, such as buggy-input.png, and you'd like to understand how to input that file, conduct a search in the existing repo code, to see whether someone else has already done that. Do this by running the command: find_file "buggy-input.png" If that doesn't work, use the linux 'find' command.-- 5. Always make sure to look at the currently open file and the current working directory (which appears right after the currently open file). The currently open file might be in a different directory than the working directory! Note that some commands, such as 'create', open files, so they might change the current open file.-- 6. When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.-- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_template: |-- {observation}- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-next_step_no_output_template: |-- Your command ran successfully and did not produce any output.- (Open file: {open_file})- (Current directory: {working_dir})- bash-$-demonstration_template: |- Here is a demonstration of how to correctly accomplish this task.- It is included to show you how to correctly use the interface.- You do not need to follow exactly what is done in the demonstration.- --- DEMONSTRATION ---- {demonstration}- --- END OF DEMONSTRATION ----state_command:- name: state- code: |- state() {- local working_dir="$PWD";- if [ -z $CURRENT_FILE ]; then- echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';- else- echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';- fi- };-parse_function: ThoughtActionParser-env_variables:- WINDOW: 100- OVERLAP: 2- CURRENT_LINE: 0- CURRENT_FILE: ''- SEARCH_RESULTS: ()- SEARCH_FILES: ()- SEARCH_INDEX: 0-command_files:-- config/commands/defaults.sh-- config/commands/search.sh-- config/commands/edit_linting.sh-- config/commands/_split_string.py-parse_command: ParseCommandDetailed-history_processor: Last5Observations-demonstrations:-- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj-review_loop_config:- review_loop_classname: ReviewLoop- reviewer_classname: Reviewer- reviewer_config:- system_template: |- You are an expert at checking pull requests and changes to code.-- You are provided the following:-- INPUT 1. The problem statement.- INPUT 2. The history of how someone tried to solve the problem and the final changes.- The history is structured as a series of actions, where each action is a description of a- motivation ("Step {i}: ") followed by a command in triple-backticks.- After the command, there is a description of the output of the command ("Output {i}: ").- The most important actions are- `open {file}`: This action opens the file {file}. The output of the command shows part of the content of the file.- `edit {from}:{to}`, followed by the content to replace lines {from} to {to}. This action always affects the currently- opened file. The output of the command is the content of the file after the edit.- `python {file}`: This action executes the Python script {file}. The output of the command is the output of the script.-- Analyze the code provided in the pull request and determine if it correctly and efficiently solves the problem as stated in the problem statement.- Evaluate the history to assess if the iterative process and decision-making are logically sound and lead to the solution effectively.-- Here is how you should proceed in the evaluation:-- 1. Failed to Reproduce: If the history includes attempts to reproduce the problem statement (by creating `reproduce.py`) but does not- manage to reproduce the problem, you should answer "FAIL (failed to reproduce)".- 2. Did not attempt to reproduce: If the history does not include attempts to reproduce the problem statement, you should answer "FAIL (did not reproduce)".- 3. Failed to understand problem statement: If the problem was reproduced, but the reproduction does not match the problem statement,- you should answer "FAIL (did not understand problem)".- 4. Failed to fix reproduction script: If the problem was reproduced, but the edits do not fix the problem, you should answer "FAIL (failed to fix)".- 5. Overly Specific Implementation: If the problem might be fixed but the changes are likely to introduce other issues, for example by- breaking exiting functionality, removing important checks, or similar, you should answer "FAIL (overly specific)".- 6. If None of the above applies and you are sure that the code snippet is correct, you should answer "SUCCESS".-- Note: This is a pull request generated by an automated system. The absence of any additional new unit tests,- or any testing steps that do not relate to the reproduction script or the original error is **not**- a reason to fail the pull request. The focus should be on the code changes and the iterative process that led to them.-- THE LAST LINE OF YOUR REPLY MUST CONTAIN EITHER "SUCCESS" OR "FAIL (failure mode)" TO INDICATE IF THE CODE SNIPPET IS CORRECT OR NOT.- You can add multiple failure modes, for example "FAIL (failed to reproduce, overly specific)".-- Demonstration of your reply:-- The history shows a commendable attempt to reproduce the described problem, adjust the code, and validate changes. However, issues arose along the way, and the final execution of the reproduction script still resulted in an error related to imports. The process struggled with circular imports that ultimately were not resolved within the provided environment. Despite applying logic to avoid the `TypeError`, the circular import problem obstructed proper validation of the fix.-- **Final Assessment:**-- While the initial steps and intentions were correct and there was a clear strategy to reproduce the problem and fix it, the issue with the circular imports indicates an unresolved problem with the Python environment setup or test execution methodology which prevents the successful execution of the test script. Such environmental issues could lead to unresolved or undetected issues in real-world applications.-- **Conclusion:**- FAIL (failed to fix reproduction script)- instance_template: |- INPUT 1. The problem statement-- {issue}-- INPUT 2. The history of how the machine learning model tried to solve the problem.-- {traj}- traj_output_filter:- - goto- - find- - find_file- - search_file- - search_dir- - rm- - scroll_up- - scroll_down- - open- - grep- - ls- - cat- - mv- filter_failed_edits: True- max_samples: 5diff --git a/scripts/isolate_attempt_preds.py b/scripts/isolate_attempt_preds.pydeleted file mode 100755index 30ba8e75..00000000--- a/scripts/isolate_attempt_preds.py+++ /dev/null@@ -1,87 +0,0 @@-#!/usr/bin/env python-from __future__ import annotations--import argparse-import json-from pathlib import Path--from sweagent.utils.log import get_logger--logger = get_logger("splitter")---class TrajSplitter:- def __init__(self, results_dir: Path):- self._results_dir = results_dir-- def _get_trajs(self) -> list[Path]:- res = list(self._results_dir.glob("*.traj"))- logger.debug(f"Found {len(res)} trajectories in {self._results_dir}")- return res-- def _get_attempts(self, results: dict) -> dict:- return results["attempts"]-- def _get_pred_from_attempt(self, attempt: dict) -> str:- try:- pred = attempt["info"]["submission"]- except KeyError:- return ""- if pred is None:- return ""- return pred-- def _get_instance_id(self, traj_path: Path) -> str:- return traj_path.stem-- def _get_experiment_id(self, results_dir: Path) -> str:- return results_dir.stem-- def _get_preds_path(self, i_attempt: int) -> Path:- return self._results_dir / "by_attempt" / str(i_attempt) / "preds.jsonl"-- def _save_preds(self, *, i_attempt: int, instance_id: str, experiment_id: str, pred: str) -> None:- out_path = self._get_preds_path(i_attempt)- out_path.parent.mkdir(parents=True, exist_ok=True)- out_path.touch(exist_ok=True)- with out_path.open("a") as f:- f.write(- json.dumps({"model_name_or_path": experiment_id, "instance_id": instance_id, "model_patch": pred})- + "\n"- )-- def _remove_existing_preds(self) -> None:- existing_preds = list(self._results_dir.glob("by_attempt/*/preds.jsonl"))- for pred_path in existing_preds:- pred_path.unlink()-- def split(self) -> None:- i_attempts = 0- eid = self._get_experiment_id(self._results_dir)- self._remove_existing_preds()- for traj in self._get_trajs():- data = json.loads(traj.read_text())- attempts = self._get_attempts(data)- for i_attempt, attempt in enumerate(attempts):- i_attempts += 1- iid = self._get_instance_id(traj)- pred = self._get_pred_from_attempt(attempt)- if not pred:- logger.warning("No prediction for instance %s attempt %d", iid, i_attempt)- self._save_preds(- i_attempt=i_attempt,- instance_id=iid,- experiment_id=eid,- pred=pred,- )- attempt_traj_path = self._get_preds_path(i_attempt).parent / f"{iid}.traj"- attempt_traj_path.write_text(json.dumps(attempt, indent=2))- logger.info("Wrote a total of %d predictions", i_attempts)---if __name__ == "__main__":- parser = argparse.ArgumentParser()- parser.add_argument("results_dir", type=Path)- args = parser.parse_args()- splitter = TrajSplitter(args.results_dir)- splitter.split()diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex e58ca35a..60b0f031 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -23,10 +23,9 @@ from sweagent.agent.models import (get_model,)from sweagent.agent.parsing import FormatError, ParseFunction-from sweagent.agent.reviewer import AbstractReviewLoop, ReviewLoopConfig, get_review_loop_from_configfrom sweagent.agent.summarizer import SummarizerConfigfrom sweagent.environment.swe_env import SWEEnv-from sweagent.types import AgentInfo, History, HistoryItem, ReviewSubmission, Trajectory, TrajectoryStep+from sweagent.types import AgentInfo, History, HistoryItem, Trajectory, TrajectoryStepfrom sweagent.utils.config import convert_paths_to_abspathfrom sweagent.utils.log import get_logger@@ -107,7 +106,6 @@ class AgentConfig(FrozenSerializable):_commands: list[Command] = field(default_factory=list)_subroutines: dict[str, Subroutine] = field(default_factory=dict)subroutine_types: list[Subroutine] = field(default_factory=list)- review_loop_config: ReviewLoopConfig | None = Nonedef __post_init__(self):object.__setattr__(self, "command_files", convert_paths_to_abspath(self.command_files))@@ -266,8 +264,6 @@ class Agent:self.name = name# todo: currently only used to get the model name, so might remove this laterself._args = args- #: Model used by the agent. Note: Will initialize a separate model together with the reviewer- #: (if any) to disentangle costs.self.model = get_model(args.model, args.config._commands + args.config.subroutine_types)self.summarizer_model = get_model(args.config.summarizer_config.model if args.config.summarizer_config.model is not None else args.model@@ -284,7 +280,7 @@ class Agent:self.hooks = []self.logger = get_logger("agent")# Requires instance, so is set in `setup` methods- self._rloop: AbstractReviewLoop | None = None+ self._rloop = None# Set in run methodself._env: SWEEnv | None = None@@ -367,11 +363,6 @@ class Agent:assert self.config is not None # mypyself.instance_args = instance_args- if self.config.review_loop_config is not None:- rmodel = get_model(self._args.model, [])- rmodel.reset_stats()- self._rloop = get_review_loop_from_config(self.config.review_loop_config, instance_args, rmodel)-self._i_attempt = 0self._history_by_attempt = defaultdict(list)self._trajectory_by_attempt = defaultdict(list)@@ -453,7 +444,7 @@ class Agent:return self.config.history_processor([entry for entry in self.history if entry["agent"] == self.name])def _get_total_stats(self) -> APIStats:- """Combine model stats of different attempts and the reviewer"""+ """Combine model stats of different attempts"""total_stats = APIStats()for stats in self._info_by_attempt.values():assert "model_stats" in stats # mypy@@ -484,18 +475,9 @@ class Agent:})- if self._rloop is not None:- best_attempt_idx = self._rloop.get_best()- data = {- "attempts": [get_attempt_data(i) for i in range(self._i_attempt + 1)],- **get_attempt_data(best_attempt_idx),- }- data["info"]["model_stats"] = self._get_total_stats().to_dict()- data["extra_info"] = {"comparisons": [(a, b, comp.to_dict()) for a, b, comp in self._rloop.comparisons]}- else:- data = {- **get_attempt_data(0),- }+ data = {+ **get_attempt_data(0),+ }assert self.traj_path is not Noneself.traj_path.write_text(json.dumps(data, indent=2))@@ -1058,22 +1040,7 @@ class Agent:observation, done = self._run_step(observation)self.save_trajectory()if done:- # fixme: Would have to fix this for replay model- if self._rloop is not None:- # Note: The trajectory/info will not include the last `submit` command- self._rloop.on_submit(ReviewSubmission(trajectory=self.trajectory, info=self.info))- # (make sure to save trajectory after self._rloop.on_submit)- retry: bool = self._rloop.retry()- self._forwarded_vars = self._rloop.get_forwarded_vars()- self.info["review"] = self._rloop.reviews[-1].to_dict()- # Call save_trajectory again to save the updated info with the final reviews- self.save_trajectory()- if retry:- self._i_attempt += 1- self.setup_attempt()- done = not retry- else:- done = True+ done = Truefor hook in self.hooks:hook.on_run_done(trajectory=self.trajectory, info=self.info)diff --git a/sweagent/agent/reviewer.py b/sweagent/agent/reviewer.pydeleted file mode 100644index 9f8af3ae..00000000--- a/sweagent/agent/reviewer.py+++ /dev/null@@ -1,712 +0,0 @@-"""The reviewer implements a retry loop for the agent to retry-solving the issue and to select the best solution.-"""--from __future__ import annotations--import copy-from abc import ABC, abstractmethod-from dataclasses import dataclass, field-from typing import Any, Literal--from simple_parsing.helpers.serialization.serializable import FrozenSerializable--from sweagent.agent.models import APIStats, BaseModel-from sweagent.types import BinaryReviewerResult, ReviewerResult, ReviewSubmission, Trajectory, TrajectoryStep-from sweagent.utils.log import get_logger--INSTANCE_TYPE = dict[str, Any]--logger = get_logger("reviewer")--# --- INTERFACES ------class AbstractReviewer(ABC):- """The reviewer checks a single solution and tries to predict- if it successfully solves the issue.- """-- LOG_PREFIX = "🧑⚖️ Reviewer: "-- def __init__(self, config, model): ...-- @abstractmethod- def review(self, instance: INSTANCE_TYPE, submission: ReviewSubmission) -> ReviewerResult:- """Returns True if the submission is believed to be correct"""---class AbstractBinaryReviewer(ABC):- """The binary reviewer checks two solutions and tries to predict- which one is better.- """-- @abstractmethod- def compare_submissions(- self,- instance: INSTANCE_TYPE,- sub1: ReviewSubmission,- sub2: ReviewSubmission,- rev1: ReviewerResult,- rev2: ReviewerResult,- ) -> BinaryReviewerResult:- """Returns 0 if sub1 is better, 1 if sub2 is better"""---class AbstractGraveToCradle(ABC):- LOG_PREFIX = "️👶 Grave to cradle: "- """Forward messages from past attempts to the next one"""-- @abstractmethod- def get_forwarded_vars(- self,- instance: INSTANCE_TYPE,- submissions: list[ReviewSubmission],- reviews: list[ReviewerResult],- breviews: list[tuple[int, int, BinaryReviewerResult]],- ) -> dict[str, Any]:- """Get the variables that should be forwarded to the next iteration.-- Note: Must return a dictionary with the correct keys even when called- with empty lists. This is because else we cannot use the variables in the template- when we call for the first attempt.-- Returns:- A dictionary of variables that should be forwarded to the next iteration.- """---class AbstractReviewLoop(ABC):- """The review loop controls how often the agent tries to solve- the issue and how it selects the best solution.- """-- @abstractmethod- def retry(self) -> bool:- """Returns True if the agent should retry solving the issue"""-- @abstractmethod- def on_submit(self, submission: ReviewSubmission) -> None:- """Called when the agent submits a solution"""-- @abstractmethod- def get_best(self) -> int:- """Returns the best solution"""-- @property- @abstractmethod- def model_stats(self) -> APIStats:- """Returns the API stats of the model (if any)"""-- @property- @abstractmethod- def reviews(self) -> list[ReviewerResult]: ...-- @property- @abstractmethod- def comparisons(self) -> list[tuple[int, int, BinaryReviewerResult]]:- """Get information about comparisons-- Returns:- A list of tuples, where each tuple contains the indices of the- compared submissions and the result of the comparison.- """-- def get_forwarded_vars(self) -> dict[str, Any]:- """Get the variables that should be forwarded to the next iteration.-- Returns:- A dictionary of variables that should be forwarded to the next iteration.- """- return {}---# --- CONFIGS ------@dataclass(frozen=True)-class ReviewerConfig(FrozenSerializable):- """The configuration for the reviewer"""-- system_template: str- instance_template: str- #: If a submission autosubmits because of total cost or a similar exit status,- #: it will be desk rejected- reject_exit_status: bool = True- #: Filter the following actions from the trajectory- traj_filter: list[str] = field(default_factory=list)- #: Filter outputs from the following actions from the trajectory- traj_output_filter: list[str] = field(default_factory=list)- #: Format of the trajectory item- traj_item_template: str = "Model: {response}\n\nObservation: {observation}"- filter_failed_edits: bool = False---@dataclass(frozen=True)-class CTFSummarizingReviewerConfig(ReviewerConfig):- pass---@dataclass(frozen=True)-class BinaryReviewerConfig(FrozenSerializable):- """The configuration for the binary reviewer"""-- system_template: str- instance_template: str- #: Filter the following actions from the trajectory- traj_filter: list[str] = field(default_factory=list)- #: Format of the trajectory item- traj_item_template: str = "Model: {response}\n\nObservation: {observation}"- traj_output_filter: list[str] = field(default_factory=list)- traj_filter_failed_edits: bool = False- traj_only_show_last_n_output: int = 0---@dataclass(frozen=True)-class GTCConfig(FrozenSerializable):- """The configuration for the GraveToCradle"""---@dataclass(frozen=True)-class CTFGTCConfig(FrozenSerializable):- """The configuration for the GraveToCradle"""-- prologue: str = ""- epilogue: str = ""---@dataclass(frozen=True)-class CTFPlanningGTCConfig(FrozenSerializable):- """The configuration for the GraveToCradle"""-- system_template: str- instance_template: str- answer_template: str = "{answer}"---@dataclass(frozen=True)-class ReviewLoopConfig(FrozenSerializable):- """The configuration for the review loop"""-- review_loop_classname: str- reviewer_config: ReviewerConfig | CTFSummarizingReviewerConfig | None = None- binary_reviewer_config: BinaryReviewerConfig | None = None- gtc_config: dict | None = None- reviewer_classname: str | None = None- binary_reviewer_classname: str | None = None- gtc_classname: str = ""- #: Maximal number of attempts- max_samples: int = 2- #: Minimal number of attempts.- min_draws: int = 1- #: For use together with a `min_draws > 1`. Even if we have- #: not reached the `min_draws`, we will stop if we have accepted- #: `max_accepted_draws` submissions.- max_accepted_draws: int = 0- #: If set > 0 and there are more than this number of consecutive attempts- #: with an 'exit cost' exit stats, the review loop will quit.- max_n_consec_exit_cost: int = 0-- def validate(self):- """Checks config. Raises `ValueError` in case of misconfiguration"""- if self.min_draws < 1:- msg = "`min_draws` must be at least 1"- raise ValueError(msg)- if self.max_samples < 1:- msg = "`max_samples` must be at least 1"- raise ValueError(msg)- if self.max_samples < self.min_draws:- msg = "`max_samples` must be greater than or equal to `min_draws`"- raise ValueError(msg)- if self.max_accepted_draws > self.min_draws:- msg = "`max_accepted_draws` must be less than or equal to `min_draws`, else it has no effect"- raise ValueError(msg)---# --- IMPLEMENTATIONS ------class Reviewer(AbstractReviewer):- def __init__(self, config: ReviewerConfig, model: BaseModel):- self._config = config- self._model = model- self._traj_formatter = TrajectoryFormatter(- traj_filter=config.traj_filter,- traj_item_template=config.traj_item_template,- traj_output_filter=config.traj_output_filter,- filter_failed_edits=config.filter_failed_edits,- )-- def format_messages(self, instance: INSTANCE_TYPE, submission: ReviewSubmission):- system_message = self._config.system_template- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (system)\n{system_message}")- user_message = self._config.instance_template.format(- **instance,- **submission.to_format_dict(),- traj=self._traj_formatter.format_trajectory(submission.trajectory),- )- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (user)\n{user_message}")- return [- {"role": "system", "content": system_message},- {"role": "user", "content": user_message},- ]-- def interpret(self, response: str) -> bool:- last_line = response.strip().split("\n")[-1].strip()- if "success" in last_line.lower():- return True- elif "fail" in last_line.lower():- return False- logger.warning("Could not interpret response: %s, will reject submission.", response)- return False-- def review(self, instance: dict[str, Any], submission: ReviewSubmission) -> ReviewerResult:- exit_status = submission.info.get("exit_status")- messages = []- if not exit_status:- answer = "No exit status in submission, will reject."- accept = False- elif self._config.reject_exit_status and exit_status.strip() != "submitted":- answer = f"Submission desk-rejected because of exit status {exit_status!r}."- accept = False- else:- messages = self.format_messages(instance, submission)- answer = self._model.query(messages)- accept = self.interpret(answer)- accept_emoji = "✅" if accept else "❌"- logger.info(f"{self.LOG_PREFIX}{accept_emoji}\n{answer}")- return ReviewerResult(accept, answer, messages=messages)---class CTFReviewer(AbstractReviewer):- """A reviewer for CTF challenges where we can explicitly check if the output is correct"""-- def __init__(self, **kwargs):- pass-- def review(self, instance: dict[str, Any], submission: ReviewSubmission) -> ReviewerResult:- exit_status = submission.info.get("exit_status")- messages = []- if not exit_status:- answer = "No exit status in submission, will reject."- accept = False- elif exit_status.strip() != "submitted":- answer = f"Submission desk-rejected because of exit status {exit_status!r}."- accept = False- else:- accept = True- answer = "Submission auto-accepted because of 'submitted' status."- accept_emoji = "✅" if accept else "❌"- logger.info(f"{self.LOG_PREFIX}{accept_emoji}\n{answer}")- return ReviewerResult(accept, answer, messages=messages)---class CTFSummarizingReviewer(AbstractReviewer):- """A reviewer for CTF challenges where we can explicitly check if the output is correct"""-- def __init__(self, config: CTFSummarizingReviewerConfig, model: BaseModel):- self._config = config- self._model = model- self._traj_formatter = TrajectoryFormatter(- traj_filter=config.traj_filter,- traj_item_template=config.traj_item_template,- traj_output_filter=config.traj_output_filter,- filter_failed_edits=config.filter_failed_edits,- )-- def format_messages(self, instance: INSTANCE_TYPE, submission: ReviewSubmission):- system_message = self._config.system_template- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (system)\n{system_message}")- user_message = self._config.instance_template.format(- **instance,- **submission.to_format_dict(),- traj=self._traj_formatter.format_trajectory(submission.trajectory),- )- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (user)\n{user_message}")- return [- {"role": "system", "content": system_message},- {"role": "user", "content": user_message},- ]-- def summarize(self, instance: INSTANCE_TYPE, submission: ReviewSubmission) -> str:- messages = self.format_messages(instance, submission)- return self._model.query(messages), messages-- def review(self, instance: INSTANCE_TYPE, submission: ReviewSubmission) -> ReviewerResult:- exit_status = submission.info.get("exit_status")- if not exit_status:- accept = False- elif exit_status.strip() != "submitted":- accept = False- else:- accept = True- answer = "Submission auto-accepted because of 'submitted' status."- messages = []- if not accept:- answer, messages = self.summarize(instance, submission)- accept_emoji = "✅" if accept else "❌"- logger.info(f"{self.LOG_PREFIX}{accept_emoji}\n{answer}")- return ReviewerResult(accept, answer, messages=messages)---# todo: Couldn't I just replace the whole thing with Jinja templates?-class TrajectoryFormatter:- def __init__(- self,- *,- traj_filter: list[str] | None = None,- traj_output_filter: list[str] | None = None,- traj_item_template: str = "Model: {response}\n\nObservation: {observation}",- filter_failed_edits: bool = False,- only_show_last_n_output: int = 0,- ):- """Formats trajectories for the use in prompts"""- self._traj_filter = traj_filter or []- self._traj_output_filter = traj_output_filter or []- self._traj_item_template = traj_item_template- self._filter_failed_edits = filter_failed_edits- self._only_show_last_n_output = only_show_last_n_output-- def _include_step(self, item: TrajectoryStep) -> bool:- action = item["action"].strip()- for f in self._traj_filter:- if action.startswith(f):- return False- if self._filter_failed_edits and "Your proposed edit has introduced new syntax error(s)" in item["observation"]:- return False- return True-- def _include_step_output(self, item: TrajectoryStep, i_step: int, n_steps: int) -> bool:- if self._only_show_last_n_output > 0 and i_step < n_steps - self._only_show_last_n_output:- return False- action = item["action"].strip()- for f in self._traj_output_filter:- if action.startswith(f):- return False- return True-- def _format_trajectory_step(self, step: TrajectoryStep, i_step: int, *, n_steps: int, i_traj: int = 1) -> str:- step = copy.deepcopy(step)- if not self._include_step_output(step, i_step, n_steps=n_steps):- step["observation"] = "[Output omitted]"- return self._traj_item_template.format(- **step,- i_step=i_step,- i_traj=i_traj,- )-- def format_trajectory(self, trajectory: Trajectory, i_traj: int = 1) -> str:- traj_messages = [step for step in trajectory if self._include_step(step)]- return "\n\n".join(- [- self._format_trajectory_step(step, i_step, i_traj=i_traj, n_steps=len(traj_messages))- for i_step, step in enumerate(traj_messages)- ]- )---class BinaryReviewer(AbstractBinaryReviewer):- LOG_PREFIX = "⚖️ Binary Reviewer: "-- def __init__(self, config: BinaryReviewerConfig, model: BaseModel):- self._config = config- self._model = model- self._traj_formatter = TrajectoryFormatter(- traj_filter=config.traj_filter,- traj_item_template=config.traj_item_template,- traj_output_filter=config.traj_output_filter,- filter_failed_edits=config.traj_filter_failed_edits,- only_show_last_n_output=config.traj_only_show_last_n_output,- )-- def format_messages(self, instance: INSTANCE_TYPE, sub1: ReviewSubmission, sub2: ReviewSubmission):- system_message = self._config.system_template- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (system)\n{system_message}")- user_message = self._config.instance_template.format(- **instance,- **sub1.to_format_dict(suffix="1"),- **sub2.to_format_dict(suffix="2"),- traj1=self._traj_formatter.format_trajectory(sub1.trajectory, i_traj=1),- traj2=self._traj_formatter.format_trajectory(sub2.trajectory, i_traj=2),- )- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (user)\n{user_message}")- return [- {"role": "system", "content": system_message},- {"role": "user", "content": user_message},- ]-- def interpret(self, response: str) -> Literal[0, 1]:- """Interpret response from LM. Note: 1-based indexing"""- last_line = response.strip().split("\n")[-1].strip()- if "first" in last_line.lower():- return 0- elif "second" in last_line.lower():- return 1- logger.warning("Could not interpret response: %s, will choose first submission.", response)- return 0-- def compare_submissions(- self,- instance: INSTANCE_TYPE,- sub1: ReviewSubmission,- sub2: ReviewSubmission,- rev1: ReviewerResult,- rev2: ReviewerResult,- ) -> BinaryReviewerResult:- messages = self.format_messages(instance, sub1, sub2)- answer = self._model.query(messages)- idx = self.interpret(answer)- # Use words because else confusion with 0-based vs 1-based indices- choice_emoji = "first" if idx == 0 else "second"- logger.info(f"{self.LOG_PREFIX}{choice_emoji}\n{answer}")- return BinaryReviewerResult(idx, output=answer, messages=messages)---class GraveToCradle(AbstractGraveToCradle):- def __init__(self, config: GTCConfig | dict, model: BaseModel):- if isinstance(config, dict):- config = GTCConfig(**config)- self._config: GTCConfig = config- self._model = model-- def get_forwarded_vars(- self,- instance: INSTANCE_TYPE,- submissions: list[ReviewSubmission],- reviews: list[ReviewerResult],- breviews: list[tuple[int, int, BinaryReviewerResult]],- ) -> dict[str, Any]:- assert len(submissions) == len(reviews)- failed_idxs = [i for i, r in enumerate(reviews) if not r.accept]- if not failed_idxs:- return {"failed_verdicts_with_submissions": ""}- msg_lines = ["The following previous submissions were deemed to be incorrect:"]- for i, idx in enumerate(failed_idxs):- info = submissions[idx].info- if not info.get("submission"):- continue- submission = info["submission"]- review = reviews[idx].output- msg_lines.append(f"Submission {i+1}:\n\n{submission}\n\nReview {i+1}:\n\n{review}")- msg = "\n\n".join(msg_lines)- return {"failed_verdicts_with_submissions": msg}---class CTFGTC(AbstractGraveToCradle):- def __init__(self, config: CTFGTCConfig | dict, model: BaseModel):- """GTC for CTF challenges that simply concatenates all of the reviews"""- if isinstance(config, dict):- config = CTFGTCConfig(**config)- self._config: CTFGTCConfig = config- self._model = model-- def get_forwarded_vars(- self,- instance: INSTANCE_TYPE,- submissions: list[ReviewSubmission],- reviews: list[ReviewerResult],- breviews: list[tuple[int, int, BinaryReviewerResult]],- ) -> dict[str, Any]:- assert len(submissions) == len(reviews)- if not reviews:- return {"gtc_prologue": "", "failed_attempts_summary": "", "gtc_epilogue": ""}- msg_lines = []- for i, review in enumerate(reviews):- msg_lines.append(f"Review of FAILED attempt {i+1}:\n\n{review.output}")- msg = "\n\n".join(msg_lines)- return {- "gtc_prologue": self._config.prologue,- "failed_attempts_summary": msg,- "gtc_epilogue": self._config.epilogue,- }---class CTFPlanningGTC(AbstractGraveToCradle):- def __init__(self, config: CTFPlanningGTCConfig, model: BaseModel):- """GTC for CTF challenges that summarizes previous attempts and creates a new plan"""- if isinstance(config, dict):- config = CTFPlanningGTCConfig(**config)- self._config: CTFPlanningGTCConfig = config- self._model = model-- def format_messages(self, instance: INSTANCE_TYPE, reviews: list[ReviewerResult]):- system_message = self._config.system_template- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (system)\n{system_message}")- msg_lines = []- for i, review in enumerate(reviews):- msg_lines.append(f"Review of FAILED attempt {i+1}:\n\n{review.output}")- user_message = self._config.instance_template.format(reviews="\n\n".join(msg_lines), **instance)- logger.debug(f"{self.LOG_PREFIX}MODEL INPUT (user)\n{user_message}")- return [- {"role": "system", "content": system_message},- {"role": "user", "content": user_message},- ]-- def get_forwarded_vars(- self,- instance: INSTANCE_TYPE,- submissions: list[ReviewSubmission],- reviews: list[ReviewerResult],- breviews: list[tuple[int, int, BinaryReviewerResult]],- ) -> dict[str, Any]:- assert len(submissions) == len(reviews)- if not reviews:- return {"gtc": ""}- msgs = self.format_messages(instance, reviews)- answer = self._config.answer_template.format(answer=self._model.query(msgs))- return {- "gtc": answer,- }---class ReviewLoop(AbstractReviewLoop):- LOG_PREFIX = "🔄 Review Loop: "-- def __init__(- self,- loop_config: ReviewLoopConfig,- instance: INSTANCE_TYPE,- model: BaseModel,- ):- self._model = model- self._instance = instance- self._reviewer: AbstractReviewer = globals()[loop_config.reviewer_classname](- config=loop_config.reviewer_config, model=model- )- if loop_config.binary_reviewer_classname is not None:- self._breviewer: AbstractBinaryReviewer | None = globals()[loop_config.binary_reviewer_classname](- loop_config.binary_reviewer_config, model- )- else:- self._breviewer = None- self._gtc: AbstractGraveToCradle | None = None- if loop_config.gtc_classname:- self._gtc = globals()[loop_config.gtc_classname](loop_config.gtc_config, model)- self._loop_config = loop_config- # Note: These are "cumulative" submissions, i.e., they include all retries- # up to that point.- self._submissions: list[ReviewSubmission] = []- self._reviews: list[ReviewerResult] = []- self._comparisons: list[tuple[int, int, BinaryReviewerResult]] = []- # Once we have k submissions, there will always be one voted at the- # top through k calls to the binary reviewer. Here, we store the- # corresponding index- self._best_idx: int = 0- #: Number of consecutive exit cost submissions- self._n_consec_exit_cost: int = 0-- @property- def reviews(self) -> list[ReviewerResult]:- return self._reviews-- @property- def comparisons(self) -> list[tuple[int, int, BinaryReviewerResult]]:- return self._comparisons-- @property- def _n_samples(self) -> int:- return len(self._submissions)-- @property- def _n_accepted(self) -> int:- return sum([r.accept for r in self._reviews])-- @property- def model_stats(self) -> APIStats:- return self._model.stats-- def on_submit(self, submission: ReviewSubmission) -> None:- self._submissions.append(submission)- self._review()- self._compare()-- def _review(self) -> bool:- review = self._reviewer.review(self._instance, self._submissions[-1])- self._reviews.append(review)- if "exit_cost" in self._submissions[-1].info.get("exit_status", "").lower():- self._n_consec_exit_cost += 1- else:- self._n_consec_exit_cost = 0- return review.accept-- def _compare(self) -> None:- if self._breviewer is None:- self._best_idx = self._n_samples - 1- return- if self._n_samples < 2:- return- if self._reviews[self._best_idx].accept and not self._reviews[-1].accept:- # Require that the best submission is accepted, so don't- # even need to compare here- return- if not self._reviews[self._best_idx].accept and self._reviews[-1].accept:- # If the best submission is not accepted, but the last one is,- # then the last one is the new best- self._best_idx = self._n_samples - 1- return- sub1 = self._submissions[self._best_idx]- sub2 = self._submissions[-1]- rev1 = self._reviews[self._best_idx]- rev2 = self._reviews[-1]- cresult = self._breviewer.compare_submissions(self._instance, sub1, sub2, rev1, rev2)- self._comparisons.append((self._n_samples - 2, self._n_samples - 1, cresult))- assert cresult.choice in [0, 1]- # this was a comparison between the current best and the last one- self._best_idx = [self._best_idx, self._n_samples - 1][cresult.choice]-- def retry(self) -> bool:- stat_str = f"n_samples={self._n_samples}, n_accepted={self._n_accepted}"- # n_samples is 1-based- if self._n_samples >= self._loop_config.max_samples:- # We've exceeded our budget. Returning best solution no matter what.- logger.info(f"{self.LOG_PREFIX}Exiting retry loop ({stat_str}): `max_samples` reached")- return False-- if self._n_accepted and self._n_samples >= self._loop_config.min_draws:- # We have an accepted submission and have reached the minimum number of draws- logger.info(- f"{self.LOG_PREFIX}Existing retry loop ({stat_str}): `min_draws` reached and last submission was accepted"- )- return False-- if self._n_accepted >= self._loop_config.max_accepted_draws > 0:- # We have reached more than the required number of accepted submissions.- # Exiting even if we haven't reached the minimum number of draws.- logger.info(f"{self.LOG_PREFIX}Exiting retry loop ({stat_str}): `max_accepted_draws` reached")- return False-- max_n_exit_cost = self._loop_config.max_n_consec_exit_cost- if self._n_consec_exit_cost >= max_n_exit_cost > 0:- logger.info(- f"{self.LOG_PREFIX}Exiting retry loop ({stat_str}): {max_n_exit_cost} exit cost attempts reached"- )- return False-- return True-- def get_best(self) -> int:- if self._breviewer is not None:- assert len(self._reviews) == len(self._submissions)- return self._best_idx-- def get_forwarded_vars(self) -> dict[str, Any]:- if self._gtc is None:- return {}- return self._gtc.get_forwarded_vars(self._instance, self._submissions, self._reviews, self._comparisons)---def get_review_loop_from_config(- config: ReviewLoopConfig | None, instance: INSTANCE_TYPE, model: BaseModel-) -> AbstractReviewLoop | None:- if config is None:- logger.debug("Running without review loop")- return None- if not isinstance(config, ReviewLoopConfig):- msg = (- f"Expected a `ReviewLoopConfig`, got {config!r} of type {type(config)}. "- "This usually happens for misconfiguration issues: Make sure that all validation "- "conditions are satisfied (e.g., min draws <= max draws etc.) and that all "- "required keys are there."- )- raise ValueError(msg)- return globals()[config.review_loop_classname](config, instance, model)diff --git a/tests/test_reviewer.py b/tests/test_reviewer.pydeleted file mode 100644index 75cdd4d3..00000000--- a/tests/test_reviewer.py+++ /dev/null@@ -1,289 +0,0 @@-from __future__ import annotations--import json-import pprint--import pytest--from run import ActionsArguments, Main, ScriptArguments-from sweagent import CONFIG_DIR-from sweagent.agent.agents import Agent, AgentArguments, AgentHook-from sweagent.agent.models import BaseModel, ModelArguments-from sweagent.agent.reviewer import (- BinaryReviewer,- BinaryReviewerConfig,- GTCConfig,- Reviewer,- ReviewerConfig,- ReviewLoop,- ReviewLoopConfig,- get_review_loop_from_config,-)-from sweagent.types import ReviewerResult, ReviewSubmission---def dummy_reviewer_config() -> ReviewerConfig:- return ReviewerConfig("system_template", "instance_template")---def dummy_binary_reviewer_config() -> BinaryReviewerConfig:- return BinaryReviewerConfig("system_template", "instance_template")---def dummy_review_loop_config(dummy_reviewer_config, dummy_binary_reviewer_config) -> ReviewLoopConfig:- return ReviewLoopConfig(- review_loop_classname="ReviewLoop",- reviewer_classname="Reviewer",- reviewer_config=dummy_reviewer_config,- binary_reviewer_config=dummy_binary_reviewer_config,- )---class DeterminedModel(BaseModel):- MODELS = {- "determined_model": {- "max_context": 100_000,- "max_tokens_to_sample": 4096,- "cost_per_input_token": 0,- "cost_per_output_token": 0,- }- }-- def __init__(self, replies: list[str]):- ma = ModelArguments("determined_model")- super().__init__(ma, []) # type: ignore- self._replies = replies- self._idx = 0-- def query(self, messages):- reply = self._replies[self._idx]- self._idx += 1- self.update_stats(0, 0)- return reply---def test_determined_model_costs():- model = DeterminedModel([""])- assert model.stats.api_calls == 0- model.query([{"role": "system", "content": ""}])- assert model.stats.api_calls == 1---def test_get_from_config(dummy_review_loop_config):- get_review_loop_from_config(dummy_review_loop_config, instance={}, model=DeterminedModel([]))---def test_reviewer(dummy_reviewer_config):- model = DeterminedModel(["success", "fail", "false", ""])- reviewer = Reviewer(dummy_reviewer_config, model)- instance = {}- submission = _get_fake_submission()- assert reviewer.review(instance, submission).accept- assert not reviewer.review(instance, submission).accept- assert not reviewer.review(instance, submission).accept- assert not reviewer.review(instance, submission).accept---def test_reviewer_reject_no_exit(dummy_reviewer_config):- model = DeterminedModel([])- reviewer = Reviewer(dummy_reviewer_config, model)- sub = _get_fake_submission()- del sub.info["exit_status"]- assert not reviewer.review({}, sub).accept---def test_reviewer_reject_exit_cost(dummy_reviewer_config):- model = DeterminedModel([])- reviewer = Reviewer(dummy_reviewer_config, model)- sub = _get_fake_submission(exit_status="submitted (exit_cost)")- assert not reviewer.review({}, sub).accept---def _get_fake_submission(exit_status="submitted"):- return ReviewSubmission(- trajectory=[],- info={"exit_status": exit_status},- )---def test_binary_reviewer(dummy_binary_reviewer_config):- model = DeterminedModel(["first", "second", "false", ""])- br = BinaryReviewer(dummy_binary_reviewer_config, model)- instance = {}- sub1 = _get_fake_submission()- osub2 = _get_fake_submission()- drr = ReviewerResult(True, "", [])- assert br.compare_submissions(instance, sub1, osub2, drr, drr).choice == 0- assert br.compare_submissions(instance, sub1, osub2, drr, drr).choice == 1- assert br.compare_submissions(instance, sub1, osub2, drr, drr).choice == 0- assert br.compare_submissions(instance, sub1, osub2, drr, drr).choice == 0---def test_loop_comparison_quit_after_max_accepted(dummy_reviewer_config, dummy_binary_reviewer_config):- rmodel = DeterminedModel(["success", "fail", "success", "fail"])- # Only have one comparison: The two successes- bmodel = DeterminedModel(["second"])- lconfig = ReviewLoopConfig(- review_loop_classname="ReviewLoop",- reviewer_classname="Reviewer",- reviewer_config=dummy_reviewer_config,- binary_reviewer_classname="BinaryReviewer",- binary_reviewer_config=dummy_binary_reviewer_config,- max_samples=100,- min_draws=100,- max_accepted_draws=2,- )- loop = ReviewLoop(lconfig, instance={}, model=rmodel)- loop._breviewer._model = bmodel- for i in range(3):- loop.on_submit(_get_fake_submission())- print(loop.reviews)- print(loop.comparisons)- if i < 2:- assert loop.retry()- else:- assert not loop.retry()- if i < 2:- assert loop.get_best() == 0- else:- assert loop.get_best() == 2- assert loop._n_samples == 3- assert rmodel.stats.api_calls == 3- assert bmodel.stats.api_calls == 1---def test_loop_comparison_quit_after_accept(dummy_reviewer_config, dummy_binary_reviewer_config):- rmodel = DeterminedModel(["fail", "fail", "success"])- # Only have one comparison: The two fails- bmodel = DeterminedModel(["second"])- lconfig = ReviewLoopConfig(- review_loop_classname="ReviewLoop",- reviewer_classname="Reviewer",- reviewer_config=dummy_reviewer_config,- binary_reviewer_classname="BinaryReviewer",- binary_reviewer_config=dummy_binary_reviewer_config,- max_samples=100,- )- loop = ReviewLoop(lconfig, instance={}, model=rmodel)- loop._breviewer._model = bmodel- for i in range(3):- loop.on_submit(_get_fake_submission())- print(loop.reviews)- print(loop.comparisons)- if i < 2:- assert loop.retry()- else:- assert not loop.retry()- assert loop.get_best() == i- assert loop._n_samples == 3- assert rmodel.stats.api_calls == 3- assert bmodel.stats.api_calls == 1---def test_loop_stop_max_fail(dummy_reviewer_config, dummy_binary_reviewer_config):- rmodel = DeterminedModel(["fail"] * 5)- # Only have one comparison: The two successes- bmodel = DeterminedModel(["second"] * 4)- lconfig = ReviewLoopConfig(- "ReviewLoop",- reviewer_classname="Reviewer",- binary_reviewer_classname="BinaryReviewer",- reviewer_config=dummy_reviewer_config,- binary_reviewer_config=dummy_binary_reviewer_config,- max_samples=5,- )- loop = ReviewLoop(lconfig, instance={}, model=rmodel)- loop._breviewer._model = bmodel- for i in range(5):- print(i)- loop.on_submit(_get_fake_submission())- print(loop._reviews)- if i < 4:- assert loop.retry()- else:- assert not loop.retry()- assert loop.get_best() == i- assert rmodel.stats.api_calls == 5- assert bmodel.stats.api_calls == 4---def get_agent_arguments(review_loop_config) -> AgentArguments:- args = AgentArguments(- model=ModelArguments(model_name="instant_empty_submit"),- config_file=CONFIG_DIR / "default_from_url.yaml",- config=None,- )- config = args.config- object.__setattr__(config, "review_loop_config", review_loop_config)- object.__setattr__(args, "config", config)- return args---def test_agent_with_reviewer(dummy_reviewer_config, dummy_binary_reviewer_config, test_env_args):- rl_config = ReviewLoopConfig(- review_loop_classname="ReviewLoop",- reviewer_classname="Reviewer",- binary_reviewer_classname="BinaryReviewer",- reviewer_config=dummy_reviewer_config,- binary_reviewer_config=dummy_binary_reviewer_config,- gtc_classname="GraveToCradle",- gtc_config=GTCConfig(),- max_samples=100,- min_draws=100,- max_accepted_draws=2,- )- agent_args = get_agent_arguments(rl_config)- assert agent_args.config.review_loop_config is not None- sa = ScriptArguments(- environment=test_env_args,- agent=agent_args,- actions=ActionsArguments(),- print_config=False,- skip_existing=False,- raise_exceptions=True,- )-- class InjectRModelsTests(AgentHook):- """We need to intercept the initialization of the reviewer as well- as the run loop of main to inject our models for testing- as well as the actual tests- """-- def on_init(self, agent: Agent):- self._agent = agent- print("hook initialized")-- def on_setup_done(self):- # Same setup as in test_loop_comparison- model = DeterminedModel(["success", "fail", "success", "second"])- rloop: ReviewLoop = self._agent._rloop # type: ignore- rloop._reviewer._model = model # type: ignore- rloop._breviewer._model = model # type: ignore- rloop._model = model-- def on_run_done(self, trajectory, info):- rloop: ReviewLoop = self._agent._rloop # type: ignore- assert rloop is not None- assert rloop._n_samples == 3- assert rloop.get_best() == 2- assert info["exit_status"] == "submitted"- assert info["model_stats"]["api_calls"] == 2-- main = Main(sa)- main.agent.add_hook(InjectRModelsTests())- # main.agent.logger.setLevel(logging.ERROR)- main.main()- assert main.agent._rloop.model_stats.api_calls == 4- full_info = json.loads(main.agent.traj_path.read_text()) # type: ignore- full_info["attempts"] = [- {k: v for k, v in attempt.items() if k not in ["trajectory", "history"]} for attempt in full_info["attempts"]- ]- del full_info["trajectory"]- del full_info["history"]- pprint.pprint(full_info)- assert len(full_info["attempts"]) == 3- assert full_info["info"]["model_stats"]["api_calls"] == 3 * 2 + 4diff --git a/tests/test_run.py b/tests/test_run.pyindex f9643faa..72fd5f03 100644--- a/tests/test_run.py+++ b/tests/test_run.py@@ -5,7 +5,6 @@ import jsonimport loggingimport osimport subprocess-from dataclasses import replacefrom pathlib import Pathfrom typing import Any@@ -134,25 +133,6 @@ def test_exception_raised(test_script_args: ScriptArguments):main.main()- "config_file_name", ["config/default_retry.yaml", "tests/test_data/config_files/default_retry_no_breviewer.yaml"]-)-def test_retry_from_config(test_script_args: ScriptArguments, config_file_name):- agent = AgentArguments(- model=ModelArguments(- model_name="instant_empty_submit",- ),- config_file=config_file_name,- )- assert agent.config is not None- assert agent.config.review_loop_config is not None- # Note: Not enough to just replace `config_file`- test_script_args = replace(test_script_args, agent=agent)- main = Main(test_script_args)- main.main()--@pytest.mark.slowclass CreateFakeLogFile(MainHook):"""Testing the skip functionality"""