Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: Linking condensation and task tracking prompts (#10656)

Calvin Smith4aada82b757f
diff --git a/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2 b/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2
index c8f9a46089..5859372efa 100644
--- a/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2
+++ b/openhands/agenthub/codeact_agent/prompts/system_prompt_long_horizon.j2
@@ -38,3 +38,9 @@
[Assistant proceeds with implementation step by step, updating tasks to in_progress and done as work progresses]
```
</TASK_MANAGEMENT>
+
+<TASK_TRACKING_PERSISTENCE>
+* IMPORTANT: If you were using the task_tracker tool before a condensation event, continue using it after condensation
+* Check condensation summaries for TASK_TRACKING sections to maintain continuity
+* If you see a condensation event with TASK_TRACKING, immediately use task_tracker to view and continue managing them
+</TASK_TRACKING_PERSISTENCE>
diff --git a/openhands/memory/condenser/impl/llm_summarizing_condenser.py b/openhands/memory/condenser/impl/llm_summarizing_condenser.py
index b78699bb57..af2c369ae9 100644
--- a/openhands/memory/condenser/impl/llm_summarizing_condenser.py
+++ b/openhands/memory/condenser/impl/llm_summarizing_condenser.py
@@ -69,10 +69,17 @@ class LLMSummarizingCondenser(RollingCondenser):
forgotten_events.append(event)
# Construct prompt for summarization
- prompt = """You are maintaining a context-aware state summary for an interactive agent. You will be given a list of events corresponding to actions taken by the agent, and the most recent previous summary if one exists. Track:
+ prompt = """You are maintaining a context-aware state summary for an interactive agent.
+You will be given a list of events corresponding to actions taken by the agent, and the most recent previous summary if one exists.
+If the events being summarized contain ANY task-tracking, you MUST include a TASK_TRACKING section to maintain continuity.
+When referencing tasks make sure to preserve exact task IDs and statuses.
+
+Track:
USER_CONTEXT: (Preserve essential user requirements, goals, and clarifications in concise form)
+TASK_TRACKING: {Active tasks, their IDs and statuses - PRESERVE TASK IDs}
+
COMPLETED: (Tasks completed so far, with brief results)
PENDING: (Tasks that still need to be done)
CURRENT_STATE: (Current variables, data structures, or relevant state)