From 4aada82b757f508965a2b880acef4fac08581847 Mon Sep 17 00:00:00 2001 From: Calvin Smith Date: Fri, 29 Aug 2025 09:18:31 -0600 Subject: [PATCH] fix: Linking condensation and task tracking prompts (#10656) Co-authored-by: Calvin Smith --- .../codeact_agent/prompts/system_prompt_long_horizon.j2 | 6 ++++++ .../memory/condenser/impl/llm_summarizing_condenser.py | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) 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] ``` + + +* 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 + 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)