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(hp): LastNObservations to handle all message formats
Kilian Lieret3550c0faf26d
diff --git a/sweagent/agent/history_processors.py b/sweagent/agent/history_processors.pyindex 8cf3a02d..9139205d 100644--- a/sweagent/agent/history_processors.py+++ b/sweagent/agent/history_processors.py@@ -118,7 +118,8 @@ class LastNObservations(BaseModel):assert data["message_type"] == "observation", (f"Expected observation for dropped entry, got: {data['message_type']}")- data["content"] = f"Old environment output: ({len(entry['content'].splitlines())} lines omitted)"+ text = _get_content_text(data)+ _set_content_text(data, f"Old environment output: ({len(text.splitlines())} lines omitted)")new_history.append(data)return new_history