From 3a315f3e1c2b7d0edba13be1d2efaa97e5bdd49d Mon Sep 17 00:00:00 2001 From: Liang Jiaqing Date: Sat, 11 Jul 2026 22:04:10 +0800 Subject: [PATCH] Fix Python compatibility and tune checkpoint intervals --- ga.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ga.py b/ga.py index 9b23e217..e700f9bc 100644 --- a/ga.py +++ b/ga.py @@ -543,7 +543,8 @@ class GenericAgentHandler(BaseHandler): if skip: return "\n" h = self.history_info; W = 30 earlier = f'\n{self._fold_earlier(h[:-W])}\n\n' if len(h) > W and self.current_turn % 4 == 1 else "" - history = f'\n{"\n".join(h[-W:])}\n' if self.current_turn % 2 == 1 else "" + joined_history = "\n".join(h[-W:]) + history = f'\n{joined_history}\n' if self.current_turn % 2 == 1 else "" prompt = f"\n### [WORKING MEMORY]\n{earlier}{history}" prompt += f"\nCurrent turn: {self.current_turn}\n" if self.working.get('key_info'): prompt += f"\n{self.working.get('key_info')}" @@ -565,9 +566,9 @@ class GenericAgentHandler(BaseHandler): if turn % 175 == 0 and (not _plan): next_prompt += f"\n\n[DANGER] Turn {turn}. Must call ask_user to summarize progress and get direction. No more blind retries." - elif turn % 7 == 0: + elif turn % 13 == 0: next_prompt += f"\n\n[SYSTEM] Turn {turn}. Call update_working_checkpoint to save key context. Stop ineffective retries; if no progress, switch strategy: 1) Probe physical boundaries 2) **Re-read relevant SOPs**" - elif turn % 25 == 0: + elif turn % 31 == 0: next_prompt += f"\n\n[SYSTEM] Turn {turn}. Write checkpoints/key findings/tried approaches to a **file** for future reference (not only working_checkpoint!). Avoid losing critical info." elif turn % 10 == 0: next_prompt += get_global_memory()