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]

Enh: Save thought output for FormatErrors

Kilian Lieret0cdc5df52c63
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index 4faf709f..53047a28 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -684,6 +684,10 @@ class Agent:
self._chook.on_actions_generated(step=step)
return self.handle_action(step)
except Exception as e:
+ if step.action == step.thought == "":
+ # Probably the parsing failed/no action included. Let's still fill in thought
+ # so that trajectory viewers have something to show us for this step.
+ step.thought = step.output
# Attach the step object to the exception
e.step = step # type: ignore
raise