feat(reminder): catch stale in-progress tasks, shape reminder after Claude Code - #37
Merged
Merged
Conversation
…laude Code The system-reminder could previously only fire from the tool_result hook, so an agent that finished work in a text-only turn (no tool call) never got nudged and left tasks stuck in_progress. Detect that on turn_end and schedule a reminder for the next LLM call. Reshape the reminder after Claude Code's todo reminders: an empty-list nudge, or a JSON state echo of the current list. The echo is capped at 10 tasks (completed dropped first) to bound its size on large/persistent lists, and says so when truncated rather than claiming to be the full list. Also restore the cheap-first store.list() guard on the hot tool_result path and stop mutating the shared cadence config. Co-authored-by: Quang Thai <thainq@tryhand.tech>
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.
What
Reworks the task system-reminder in two parts:
Fix: stale in-progress tasks were never surfaced. The reminder only fired from
tool_result, so a text-only turn (agent says "done" with no tool call) never triggered it — tasks leftin_progresswent unnoticed. Nowturn_enddetects this and schedules a reminder. This is the core fix from Fix stale in-progress task reminders #31 by @QuangThai — preserved intact, credited below.Shape the reminder after Claude Code's todo reminders. An empty-list nudge plus a JSON state echo of the current list, matching Claude Code's wording and structure (adapted to this extension's task tool names). The echo is capped at 10 tasks (completed dropped first) so it stays bounded on large/persistent lists, and it says
list truncatedinstead of claiming completeness when capped.Why the trigger matters here (and not in Claude Code)
Claude Code doesn't need staleness detection because its todo list is ephemeral, single-actor and in-context — state can't outlive the agent that manages it. pi-tasks' list is persistent and multi-agent, so state can go stale with no tool call to observe it. That's why the
turn_endtrigger is load-bearing here and the reminder needs an out-of-band nudge Claude Code doesn't.Notes
store.list()guard so the hottool_resultpath does no disk I/O until a reminder could actually be due.subjectis echoed ascontentto mirror Claude Code's todo item shape.Credit
Supersedes #31 by @QuangThai, whose
turn_endstaleness trigger is the load-bearing fix and is preserved here. Co-authored accordingly.Test plan
npx vitest run→ 177 passingnpx tsc --noEmitcleannpx biome checkclean