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]

Fix: Ensure tools PATH takes precedence (#1058)

Kilian Lieret33adb47983f5
diff --git a/sweagent/tools/tools.py b/sweagent/tools/tools.py
index cfc66705..50046fec 100644
--- a/sweagent/tools/tools.py
+++ b/sweagent/tools/tools.py
@@ -242,7 +242,7 @@ class ToolHandler:
asyncio.run(self._upload_bundles(env))
for bundle in self.config.bundles:
cmds = [
- f"export PATH=$PATH:/root/tools/{bundle.path.name}/bin",
+ f"export PATH=/root/tools/{bundle.path.name}/bin:$PATH",
f"chmod +x /root/tools/{bundle.path.name}/bin/*",
]
if (bundle.path / "install.sh").exists():
diff --git a/tools/defaults/install.sh b/tools/defaults/install.sh
index 3b5adbce..cc3175dd 100644
--- a/tools/defaults/install.sh
+++ b/tools/defaults/install.sh
@@ -3,7 +3,7 @@
# script_dir=$(dirname "$(readlink -f "$0")")
bundle_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-export PYTHONPATH=$PYTHONPATH:"$bundle_dir/lib"
+export PYTHONPATH="$bundle_dir/lib":$PYTHONPATH
# Write default environment variables into the environment storage
_write_env "WINDOW" "${WINDOW:-100}"
diff --git a/tools/registry/install.sh b/tools/registry/install.sh
index 9124fa77..712c3ed0 100644
--- a/tools/registry/install.sh
+++ b/tools/registry/install.sh
@@ -3,4 +3,4 @@
# script_dir=$(dirname "$(readlink -f "$0")")
bundle_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-export PYTHONPATH=$PYTHONPATH:"$bundle_dir/lib"
\ No newline at end of file
+export PYTHONPATH="$bundle_dir/lib":$PYTHONPATH
\ No newline at end of file