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]
Do not use unix signal calls
Kilian Lieret6b1d3697a448
diff --git a/sweagent/environment/utils.py b/sweagent/environment/utils.pyindex a4be13ff..c5e993ef 100644--- a/sweagent/environment/utils.py+++ b/sweagent/environment/utils.py@@ -264,14 +264,10 @@ def _get_non_persistent_container(ctr_name: str, image_name: str) -> Tuple[subpr)time.sleep(START_UP_DELAY)# try to read output from container setup (usually an error), timeout if no output- try:- with timeout(seconds=2):- output = container.stdout.read()- if output:- logger.error(f"Unexpected container setup output: {output}")- except TimeoutError:- pass- return container, {"1", } # bash PID is always 1 for non-persistent containers+ output = read_with_timeout(container, lambda: list(), timeout_duration=2)+ if output:+ logger.error(f"Unexpected container setup output: {output}")+ return container, {"1", } # bash PID is always 1 for non-persistent containersdef _get_persistent_container(ctr_name: str, image_name: str, persistent: bool = False) -> Tuple[subprocess.Popen, Set]:@@ -320,13 +316,9 @@ def _get_persistent_container(ctr_name: str, image_name: str, persistent: bool =)time.sleep(START_UP_DELAY)# try to read output from container setup (usually an error), timeout if no output- try:- with timeout(seconds=2):- output = container.stdout.read()- if output:- logger.error(f"Unexpected container setup output: {output}")- except TimeoutError:- pass+ output = read_with_timeout(container, lambda: list(), timeout_duration=2)+ if output:+ logger.error(f"Unexpected container setup output: {output}")# Get the process IDs of the container# There should be at least a head process and possibly one child bash processbash_pids, other_pids = get_background_pids(container_obj)diff --git a/sweagent/web/server.py b/sweagent/web/server.pyindex ed19bfb4..c96bffa2 100644--- a/sweagent/web/server.py+++ b/sweagent/web/server.py@@ -25,16 +25,15 @@ html_page = """<h1>Start run</h1><form action="/run" method="post"><label for="data_path">Data Path:</label>- <input type="text" id="data_path" name="data_path" required>+ <input type="text" id="data_path" name="data_path" value="https://github.com/klieret/swe-agent-test-repo/issues/1" required><button type="submit">Run</button>- <input type="checkbox" id="test_run" name="test_run">+ <input type="checkbox" id="test_run" name="test_run" checked><label for="test_run">Test run (no LM queries)</label><br><br></form></body></html>"""-@app.route('/')def index():return render_template_string(html_page)