fix(todo): filter completed/cancelled items when restoring from history - #7595
Closed
johnhom1024 wants to merge 1 commit into
Closed
fix(todo): filter completed/cancelled items when restoring from history#7595johnhom1024 wants to merge 1 commit into
johnhom1024 wants to merge 1 commit into
Conversation
Hydrating the TodoStore from conversation history would resurrect cancelled items that format_for_injection() had intentionally excluded during context compression. This caused previously cancelled tasks to reappear after subsequent agent turns. Now _hydrate_todo_store() only restores pending/in_progress items, matching the behavior of format_for_injection().
This was referenced Apr 11, 2026
Author
|
find the relative issue may not cause by this code |
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7599
Bug Description
Cancelled (or completed) todo items spontaneously resurrect and get executed after subsequent tasks complete. When a user explicitly cancels a task (e.g. says 'don't do that'), the task should remain cancelled permanently. However, after completing another task, the cancelled task reappears and Hermes silently executes it.
Root Cause
In
run_agent.py,_hydrate_todo_store()(~line 2883) restores all todo items from conversation history without filtering outcompleted/cancelledones. This contradictsformat_for_injection()intools/todo_tool.pywhich intentionally excludes them during context compression — causing a mismatch where cancelled items are excluded from compression but resurrected on hydration.Fix
Filter to only
pending/in_progressitems before writing to the todo store, matchingformat_for_injection():Before:
After:
Testing
python3 -m py_compile