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]

better configuration

Talor Abramovich3ed5a9d16165
diff --git a/sweagent/agent/interactive_commands.py b/sweagent/agent/interactive_commands.py
index 2a409a6f..bc6b60bc 100644
--- a/sweagent/agent/interactive_commands.py
+++ b/sweagent/agent/interactive_commands.py
@@ -12,6 +12,8 @@ class InteractiveSessionConfig(FrozenSerializable):
start_command: str
exit_command: str
quit_commands_in_session: list = field(default_factory=list)
+ signal_for_interrupt_limit: int = 3
+ timeout_duration_on_interrupt: int = 5
@dataclass
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py
index b9f928a0..781f019e 100644
--- a/sweagent/environment/swe_env.py
+++ b/sweagent/environment/swe_env.py
@@ -1360,12 +1360,12 @@ class SWEEnv(gym.Env):
"""
Send interrupt signal to interactive session several times to see if we can communicate with the process again.
"""
- for _ in range(3):
+ for _ in range(self.args.interactive_sessions_config[session_name].signal_for_interrupt_limit):
self.container_obj.exec_run(f"pkill -SIGINT {session_name}")
return read_session_with_timeout(
self.interactive_session.session_process,
terminal_pattern=self.args.interactive_sessions_config[session_name].terminal_prompt_pattern,
- timeout_duration=5,
+ timeout_duration=self.args.interactive_sessions_config[session_name].timeout_duration_on_interrupt,
)
def interrupt(self) -> None: