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.ymlindex 4422159a..6735bdc1 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -58,7 +58,7 @@ body:label: Checklistdescription: We can only help you if you have done the followingoptions:- - 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: truediff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yamlindex 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@v5with:- 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 uvrun: |curl -LsSf https://astral.sh/uv/install.sh | sh- name: Install dependenciesrun: |- 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 pytestuses: sjvrijn/pytest-last-failed@v2with:- pytest-args: '--cov'+ pytest-args: '--cov -n auto -s'- name: Upload logs & trajectoriesuses: actions/upload-artifact@v4if: always()diff --git a/sweagent/__init__.py b/sweagent/__init__.pyindex 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_DIRREPO_ROOT = PACKAGE_DIR.parent-assert REPO_ROOT.is_dir()+assert REPO_ROOT.is_dir(), REPO_ROOTCONFIG_DIR = PACKAGE_DIR.parent / "config"-assert CONFIG_DIR.is_dir()+assert CONFIG_DIR.is_dir(), CONFIG_DIRTOOLS_DIR = PACKAGE_DIR.parent / "tools"-assert TOOLS_DIR.is_dir()+assert TOOLS_DIR.is_dir(), TOOLS_DIRTRAJECTORY_DIR = PACKAGE_DIR.parent / "trajectories"-assert TRAJECTORY_DIR.is_dir()+assert TRAJECTORY_DIR.is_dir(), TRAJECTORY_DIRdef get_agent_commit_hash() -> str:diff --git a/tests/test_run.py b/tests/test_run.pyindex 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 == 0assert "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 == 0assert "--config" in output.stdout.decode()diff --git a/tests/test_run_replay.py b/tests/test_run_replay.pyindex 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()