Skip to content

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]

Chore: typo ignore & pre-commit fixes (#1241)

Kilian Lierete8050c2ee332
diff --git a/config/bash_only.yaml b/config/bash_only.yaml
index 8f20aafa..07b6fbf3 100644
--- a/config/bash_only.yaml
+++ b/config/bash_only.yaml
@@ -3,19 +3,19 @@ agent:
type: default
templates:
system_template: |-
- You are a helpful assistant that can interact multiple times with a computer shell to solve programming tasks.
+ You are a helpful assistant that can interact multiple times with a computer shell to solve programming tasks.
You operate in a REPL (Read-Eval-Print Loop) environment where you must issue exactly ONE command at a time.
Your response must contain exactly ONE bash code block with ONE command (or commands connected with && or ||).
-
+
Include a THOUGHT section before your command where you explain your reasoning process.
Format your response as:
-
+
THOUGHT: Your reasoning and analysis here
-
+
```bash
your_command_here
```
-
+
Failure to follow these rules will cause your response to be rejected.
instance_template: |-
<uploaded_files>
@@ -30,29 +30,29 @@ agent:
<instructions>
# Task Instructions
-
+
## Overview
You're a software engineer interacting continuously with a computer shell in a REPL (Read-Eval-Print Loop) environment.
You'll be helping implement necessary changes to meet requirements in the PR description.
Your task is specifically to make changes to non-test files in the {{working_dir}} directory in order to fix the issue described in the PR description in a way that is general and consistent with the codebase.
-
+
IMPORTANT: This is an interactive process where you will think and issue ONE command, see its result, then think and issue your next command.
-
+
For each response:
1. Include a THOUGHT section explaining your reasoning and what you're trying to accomplish
2. Provide exactly ONE bash command to execute
-
+
## Important Boundaries
- MODIFY: Regular source code files in {{working_dir}}
- DO NOT MODIFY: Tests, configuration files (pyproject.toml, setup.cfg, etc.)
-
+
## Recommended Workflow
1. Analyze the codebase by finding and reading relevant files
2. Create a script to reproduce the issue
3. Edit the source code to resolve the issue
4. Verify your fix works by running your script again
5. Test edge cases to ensure your fix is robust
-
+
## Command Execution Rules
You are operating in a REPL (Read-Eval-Print Loop) environment where:
1. You write a single command
@@ -66,7 +66,7 @@ agent:
Format your responses like this:
```
- THOUGHT: Here I explain my reasoning process, analysis of the current situation,
+ THOUGHT: Here I explain my reasoning process, analysis of the current situation,
and what I'm trying to accomplish with the command below.
```bash
@@ -90,7 +90,7 @@ agent:
Example of a CORRECT response:
<example_response>
THOUGHT: I need to understand the structure of the repository first. Let me check what files are in the current directory to get a better understanding of the codebase.
-
+
```bash
ls -la
```
@@ -99,13 +99,13 @@ agent:
Example of an INCORRECT response:
<example_response>
THOUGHT: I need to examine the codebase and then look at a specific file. I'll run multiple commands to do this.
-
+
```bash
ls -la
```
-
+
Now I'll read the file:
-
+
```bash
cat file.txt
```
@@ -116,7 +116,7 @@ agent:
```bash
command1 && command2 || echo "Error occurred"
```
-
+
2. Wait for the first command to complete, see its output, then issue the next command in your following response.
## Environment Details
@@ -124,9 +124,9 @@ agent:
- Always use non-interactive flags (-y, -f) for commands
- Avoid interactive tools like vi, nano, or any that require user input
- If a command isn't available, you can install it
-
+
## Useful Command Examples
-
+
### Create a new file:
```bash
cat <<'EOF' > newfile.py
@@ -135,22 +135,22 @@ agent:
print(hello)
EOF
```
-
+
### Edit files with sed:
```bash
# Replace all occurrences
sed -i 's/old_string/new_string/g' filename.py
-
+
# Replace only first occurrence
sed -i 's/old_string/new_string/' filename.py
-
+
# Replace first occurrence on line 1
sed -i '1s/old_string/new_string/' filename.py
-
+
# Replace all occurrences in lines 1-10
sed -i '1,10s/old_string/new_string/g' filename.py
```
-
+
### View file content:
```bash
# View specific lines with numbers
@@ -161,13 +161,13 @@ agent:
```bash
anything
```
-
+
## Submission
When you've completed your changes or can't make further progress:
```bash
submit
```
-
+
We'll automatically save your work and have maintainers evaluate it.
</instructions>
next_step_template: |-
@@ -191,11 +191,11 @@ agent:
<observation_head>
{{observation[ : max_observation_length // 2]}}
</observation_head>
-
+
<elided_chars>
{{elided_chars}} characters elided
</elided_chars>
-
+
<observation_tail>
{{observation[- max_observation_length // 2:]}}
</observation_tail>
diff --git a/pyproject.toml b/pyproject.toml
index 7f2de6c7..81c8c943 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -258,6 +258,7 @@ ACI = "ACI"
[tool.typos.default.extend-words]
# Don't correct the surname "Teh"
aci = "aci"
+ba = "ba"
[tool.ruff.lint.isort]
# required-imports = ["from __future__ import annotations"]
diff --git a/sweagent/tools/parsing.py b/sweagent/tools/parsing.py
index 7de72878..51100b79 100644
--- a/sweagent/tools/parsing.py
+++ b/sweagent/tools/parsing.py
@@ -544,7 +544,7 @@ class BashCodeBlockParser(AbstractParseFunction, BaseModel):
error_message: str = dedent("""\
No bash code blocks were detected in your output.
You need to include at least one bash code block in your output.
-
+
It must follow this format exactly to be valid:
```bash
cmd arg1 arg2 ...
@@ -552,7 +552,7 @@ class BashCodeBlockParser(AbstractParseFunction, BaseModel):
Other types of code blocks (e.g. python, rust, none, etc.) won't be executed. Only bash.
""")
-
+
type: Literal["all_bash_code_blocks"] = "all_bash_code_blocks"
def __call__(self, model_response: dict, commands: list[Command], strict=False):
@@ -575,13 +575,13 @@ class SingleBashCodeBlockParser(AbstractParseFunction, BaseModel):
error_message: str = dedent("""\
We did not detect the right number of bash code blocks in your output.
You need to include EXACTLY ONE bash code block in your output.
-
+
It must follow this format exactly to be valid:
```bash
cmd arg1 arg2 ...
```
""")
-
+
type: Literal["single_bash_code_block"] = "single_bash_code_block"
def __call__(self, model_response: dict, commands: list[Command], strict=False):