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]

failing back to simple summarizer in case that the command is not summarizable

Talor Abramovich6d4b0861d00d
diff --git a/sweagent/agent/summarizer.py b/sweagent/agent/summarizer.py
index fb28ac04..01e5138f 100644
--- a/sweagent/agent/summarizer.py
+++ b/sweagent/agent/summarizer.py
@@ -179,6 +179,11 @@ class LMSummarizer(SummarizeFunction):
"search_dir",
]
+ fail_back_to_simple_summarizer_input = [
+ "xxd",
+ "hexdump",
+ ]
+
lm_summarizer_char_limit = 200000
def __init__(self, window_length: int):
@@ -203,7 +208,9 @@ class LMSummarizer(SummarizeFunction):
or len(observation.splitlines()) <= self._window_length
):
return observation, APIStats()
- if len(observation) > self.lm_summarizer_char_limit:
+ if len(observation) > self.lm_summarizer_char_limit or any(
+ input.startswith(s) for s in self.fail_back_to_simple_summarizer_input
+ ):
self.logger.warning("Observation is too long for LMSummarizer, using SimpleSummarizer instead")
return self._simple_summarizer(input, observation, env, model)
self.logger.debug(f"Summarizing current observation for input {input}")