Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2881,10 +2881,18 @@ def _hydrate_todo_store(self, history: List[Dict[str, Any]]) -> None:
continue

if last_todo_response:
# Filter out completed/cancelled items when restoring from history,
# matching the logic in format_for_injection() -- these are intentionally
# excluded from context compression and should not be resurrected when
# the next turn hydrates the store from conversation history.
active_items = [
item for item in last_todo_response
if item.get("status") in ("pending", "in_progress")
]
# Replay the items into the store (replace mode)
self._todo_store.write(last_todo_response, merge=False)
self._todo_store.write(active_items, merge=False)
if not self.quiet_mode:
self._vprint(f"{self.log_prefix}📋 Restored {len(last_todo_response)} todo item(s) from history")
self._vprint(f"{self.log_prefix}📋 Restored {len(active_items)} todo item(s) from history ({len(last_todo_response) - len(active_items)} filtered)")
_set_interrupt(False)

@property
Expand Down