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]
Follow rename of SwerexException
Kilian Lieretf39e057122bc
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex f950be55..eb98741d 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -11,7 +11,7 @@ import yamlfrom jinja2 import Templatefrom pydantic import BaseModel, ConfigDict, Field, model_validatorfrom simple_parsing.helpers.fields import field-from swerex.exceptions import BashIncorrectSyntaxError, CommandTimeoutError, SweRexception+from swerex.exceptions import BashIncorrectSyntaxError, CommandTimeoutError, SwerexExceptionfrom tenacity import RetryErrorfrom typing_extensions import Self@@ -774,7 +774,7 @@ class Agent:"exit_api",f"Exit due to retry error: {e}",)- except SweRexception as e:+ except SwerexException as e:self.logger.exception(f"Exiting due to environment error: {e}", exc_info=True)return handle_error_with_autosubmission("exit_environment_error",diff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex e35226e7..56ad32cd 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -13,7 +13,7 @@ import litellmimport litellm.types.utilsfrom pydantic import BaseModel as PydanticBaseModelfrom pydantic import ConfigDict, Field, SecretStr-from swerex.exceptions import SweRexception+from swerex.exceptions import SwerexExceptionfrom tenacity import (Retrying,retry_if_not_exception_type,@@ -204,7 +204,7 @@ class AbstractModel(ABC):def _handle_raise_commands(action: str) -> None:if action == "raise_runtime":- raise SweRexception()+ raise SwerexException()elif action == "raise_cost":raise CostLimitExceededError()elif action == "raise_context":diff --git a/tests/test_agent.py b/tests/test_agent.pyindex d07a8cbc..18fc2e6f 100644--- a/tests/test_agent.py+++ b/tests/test_agent.py@@ -1,6 +1,6 @@import pytestimport yaml-from swerex.exceptions import SweRexception+from swerex.exceptions import SwerexExceptionfrom swerex.runtime.abstract import Action, BashObservation, Observationfrom swerex.runtime.dummy import DummyRuntime@@ -130,7 +130,7 @@ def test_exit_blocklist(dummy_env: SWEEnv, test_agent: Agent, tmp_path):class RuntimeRaisesFirst(DummyRuntime):async def run_in_session(self, action: Action) -> Observation:if action.action_type == "bash" and action.command == "raise":- raise SweRexception()+ raise SwerexException()return await super().run_in_session(action)