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]

CI: Fix swe-agent installation (#847)

Kilian Lierete04ed365a9b4
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 4422159a..6735bdc1 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -58,7 +58,7 @@ body:
label: Checklist
description: We can only help you if you have done the following
options:
- - label: I'm running with the latest docker container/on the latest development version (this means running both `git pull` and `docker pull sweagent/swe-agent:latest`)
+ - label: I'm running with the latest docker container/on the latest development version (i.e., I ran `git pull`))
required: true
- label: I have copied the full command/code that I ran (as text, not as screenshot!)
required: true
diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml
index b37ec24c..312e4a30 100644
--- a/.github/workflows/pytest.yaml
+++ b/.github/workflows/pytest.yaml
@@ -35,29 +35,20 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
- python-version: '3.9'
- - name: Pull swe-agent docker container
- run: |
- docker pull sweagent/swe-agent:latest
- - name: Pull enigma docker container
- run: |
- docker pull sweagent/enigma:latest
- - name: Set up network for CTF challenges
- run: |
- docker network create ctfnet
- - name: Create keys.cfg
- run: |
- touch keys.cfg
+ python-version: '3.11'
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
- uv pip install --python ${Python_ROOT_DIR} '.[dev]'
+ uv pip install --python ${Python_ROOT_DIR} -e '.[dev]'
+ - name: Check available files
+ run: |
+ find .
- name: Run pytest
uses: sjvrijn/pytest-last-failed@v2
with:
- pytest-args: '--cov'
+ pytest-args: '--cov -n auto -s'
- name: Upload logs & trajectories
uses: actions/upload-artifact@v4
if: always()
diff --git a/sweagent/__init__.py b/sweagent/__init__.py
index d557167c..c1ff12d3 100644
--- a/sweagent/__init__.py
+++ b/sweagent/__init__.py
@@ -22,17 +22,17 @@ getLogger("numexpr.utils").setLevel(WARNING)
getLogger("LiteLLM").setLevel(WARNING)
PACKAGE_DIR = Path(__file__).resolve().parent
-assert PACKAGE_DIR.is_dir()
+assert PACKAGE_DIR.is_dir(), PACKAGE_DIR
REPO_ROOT = PACKAGE_DIR.parent
-assert REPO_ROOT.is_dir()
+assert REPO_ROOT.is_dir(), REPO_ROOT
CONFIG_DIR = PACKAGE_DIR.parent / "config"
-assert CONFIG_DIR.is_dir()
+assert CONFIG_DIR.is_dir(), CONFIG_DIR
TOOLS_DIR = PACKAGE_DIR.parent / "tools"
-assert TOOLS_DIR.is_dir()
+assert TOOLS_DIR.is_dir(), TOOLS_DIR
TRAJECTORY_DIR = PACKAGE_DIR.parent / "trajectories"
-assert TRAJECTORY_DIR.is_dir()
+assert TRAJECTORY_DIR.is_dir(), TRAJECTORY_DIR
def get_agent_commit_hash() -> str:
diff --git a/tests/test_run.py b/tests/test_run.py
index eee17d77..80174a2d 100644
--- a/tests/test_run.py
+++ b/tests/test_run.py
@@ -10,7 +10,7 @@ def test_run_cli_no_arg_error():
output = subprocess.run(args, check=False, capture_output=True)
print(output.stdout.decode())
print(output.stderr.decode())
- assert output.returncode == 2
+ assert output.returncode in [1, 2]
assert "run-batch" in output.stdout.decode()
assert "run-replay" in output.stdout.decode()
assert "run" in output.stdout.decode()
@@ -22,7 +22,6 @@ def test_run_cli_main_help():
"--help",
]
output = subprocess.run(args, check=True, capture_output=True)
- assert output.returncode == 0
assert "run-batch" in output.stdout.decode()
assert "run-replay" in output.stdout.decode()
assert "run" in output.stdout.decode()
@@ -35,5 +34,4 @@ def test_run_cli_subcommand_help():
"--help",
]
output = subprocess.run(args, check=True, capture_output=True)
- assert output.returncode == 0
assert "--config" in output.stdout.decode()
diff --git a/tests/test_run_replay.py b/tests/test_run_replay.py
index 2fd3d398..05b5966e 100644
--- a/tests/test_run_replay.py
+++ b/tests/test_run_replay.py
@@ -28,4 +28,6 @@ def test_run_cli_help():
"run-replay",
"--help",
]
- subprocess.run(args, check=True)
+ output = subprocess.run(args, capture_output=True)
+ assert output.returncode == 0
+ assert "Replay a trajectory file" in output.stdout.decode()