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]

Follow rename of SwerexException

Kilian Lieretf39e057122bc
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index f950be55..eb98741d 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -11,7 +11,7 @@ import yaml
from jinja2 import Template
from pydantic import BaseModel, ConfigDict, Field, model_validator
from simple_parsing.helpers.fields import field
-from swerex.exceptions import BashIncorrectSyntaxError, CommandTimeoutError, SweRexception
+from swerex.exceptions import BashIncorrectSyntaxError, CommandTimeoutError, SwerexException
from tenacity import RetryError
from 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.py
index e35226e7..56ad32cd 100644
--- a/sweagent/agent/models.py
+++ b/sweagent/agent/models.py
@@ -13,7 +13,7 @@ import litellm
import litellm.types.utils
from pydantic import BaseModel as PydanticBaseModel
from pydantic import ConfigDict, Field, SecretStr
-from swerex.exceptions import SweRexception
+from swerex.exceptions import SwerexException
from 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.py
index d07a8cbc..18fc2e6f 100644
--- a/tests/test_agent.py
+++ b/tests/test_agent.py
@@ -1,6 +1,6 @@
import pytest
import yaml
-from swerex.exceptions import SweRexception
+from swerex.exceptions import SwerexException
from swerex.runtime.abstract import Action, BashObservation, Observation
from 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)