Bug Description
After context compaction, the agent repeats responses to old messages that were already processed hours ago.
Root Cause
When context is compacted, old messages are replaced with a summary. The system injects an "Active Task" field pointing to the last task being worked on. However, this task may be hours old.
The agent's instruction says "Respond ONLY to the latest user message" but the summary's "Active Task" appears as the latest content, causing the agent to continue working on tasks from hours ago as if they were new.
Expected Behavior
After compaction, the agent should only respond to user messages that arrive AFTER the compaction. Old tasks in the summary should be marked as "already completed" and not re-processed.
Proposed Fix
Add a compaction boundary flag in run_agent.py:
# After compaction, inject:
COMPACTED_BOUNDARY = True
LAST_PROCESSED_TURN = {last_turn_id}
The agent prompt should be updated to:
- If
COMPACTED_BOUNDARY == True, ignore summary content and only respond to messages arriving after the compaction point.
- Treat all summary content as "already processed."
Bug Description
After context compaction, the agent repeats responses to old messages that were already processed hours ago.
Root Cause
When context is compacted, old messages are replaced with a summary. The system injects an "Active Task" field pointing to the last task being worked on. However, this task may be hours old.
The agent's instruction says "Respond ONLY to the latest user message" but the summary's "Active Task" appears as the latest content, causing the agent to continue working on tasks from hours ago as if they were new.
Expected Behavior
After compaction, the agent should only respond to user messages that arrive AFTER the compaction. Old tasks in the summary should be marked as "already completed" and not re-processed.
Proposed Fix
Add a compaction boundary flag in
run_agent.py:The agent prompt should be updated to:
COMPACTED_BOUNDARY == True, ignore summary content and only respond to messages arriving after the compaction point.