Skip to content

Commit ad60fb5

Browse files
committed
Clear todo-list for /clear and /restore.
1 parent 68232db commit ad60fb5

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

python_agent_harness/agent_session.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,14 @@ def pop_todo_scope(self) -> None:
360360
self.todos = list(self._todo_scopes[self._todo_scope_stack[-1]])
361361
self.notify("todos")
362362

363+
def clear_todos(self) -> None:
364+
"""Drop all todo scopes (e.g. session cleared or restored)."""
365+
self._todo_scopes = {"main": []}
366+
self._todo_scope_stack = ["main"]
367+
self._todo_scope_labels = {}
368+
self.todos = []
369+
self.notify("todos")
370+
363371
def find_skill(self, name: str) -> str | None:
364372
if not self._skill_dir:
365373
return None

python_agent_harness/tui.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ def _handle_slash(self, line: str) -> bool:
849849
elif cmd == "/clear":
850850
self.conversation_history = []
851851
self.session.last_messages = []
852+
self.session.clear_todos()
852853
self.console.print("[yellow]Conversation history cleared.[/yellow]")
853854
elif cmd == "/help":
854855
self.console.print(
@@ -1064,6 +1065,7 @@ def _run_restore(self, arg: str) -> None:
10641065
# Replace conversation history
10651066
self.conversation_history = messages
10661067
self.session.last_messages = list(messages)
1068+
self.session.clear_todos()
10671069
self._history_dirty = True
10681070
model = meta.get("gptel-model", "?")
10691071
project = meta.get("python-agent-harness--project-dir", "?")

0 commit comments

Comments
 (0)