feat: Agent 2A - Recurring Tasks Implementation#25
Merged
Conversation
…cking Implement comprehensive recurring task functionality enabling automatic task regeneration on completion. This is a core Agent 2A feature for the TaskFlow platform. ## What's New ### Database Model (7 new fields) - is_recurring: Enable recurrence for a task - recurrence_pattern: 1m, 5m, 10m, 15m, 30m, 1h, daily, weekly, monthly - max_occurrences: Optional limit on total spawns (null = unlimited) - recurring_root_id: Links all spawned tasks to original root for chain tracking - recurrence_trigger: When to spawn (currently: on_complete only) - clone_subtasks_on_recur: Copy subtasks to new occurrence - has_spawned_next: Duplicate prevention flag ### Backend Logic - create_next_occurrence(): Spawns next task when current is completed - Chain tracking via recurring_root_id + COUNT query - Automatic due date calculation based on pattern - Optional recursive subtask cloning - Full audit logging for all spawn events ### MCP Integration (Agent Parity) - taskflow_add_task supports all recurring fields - Agents can create and manage recurring tasks identically to humans ### Web Dashboard - New task form with recurring options - Task detail page shows recurring status and chain info - Tasks list displays recurrence indicators ### ChatKit Integration - Task form widget supports recurring field configuration - Natural chat-based recurring task creation ## Known Limitations (Documented in Review) - recurrence_trigger only supports 'on_complete' (on_due_date not implemented) - Monthly = 30 days (not calendar-accurate) - No dedicated test suite for recurring logic yet 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Shorten description strings in Task model fields (E501) - Shorten comment for self-referential relationship (E501) - Remove unused new_task variable assignment (F841) - Add index=True to recurring_root_id for query performance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6850fbb to
50987f8
Compare
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
recurring_root_idlinking all spawned tasks to original rootWhat Was Built
is_recurring,recurrence_pattern,max_occurrences,recurring_root_id,recurrence_trigger,clone_subtasks_on_recur,has_spawned_nextcreate_next_occurrence()- Creates next task when current is completedrecurring_root_idmax_occurrenceschecked viaCOUNT(*)query, not stored counterhas_spawned_nextflag prevents re-spawn on re-completion1m,5m,10m,15m,30m,1h,daily,weekly,monthlyFiles Changed
Backend API
packages/api/src/taskflow_api/models/task.py- 7 new recurring fieldspackages/api/src/taskflow_api/routers/tasks.py- Spawn logic + helper functionspackages/api/src/taskflow_api/schemas/task.py- Schema updates with validationMCP Server (Agent Parity)
packages/mcp-server/src/taskflow_mcp/api_client.py- Recurring params supportpackages/mcp-server/src/taskflow_mcp/models.py- Model updatespackages/mcp-server/src/taskflow_mcp/tools/tasks.py- Tool interface updatesWeb Dashboard
web-dashboard/src/app/projects/[id]/tasks/new/page.tsx- Recurring form fieldsweb-dashboard/src/app/tasks/[id]/page.tsx- Display recurring statusweb-dashboard/src/app/tasks/page.tsx- List view indicatorsweb-dashboard/src/types/index.ts- TypeScript typesChatKit Integration
packages/api/src/taskflow_api/services/chat_agent.py- Agent tool updatespackages/api/src/taskflow_api/services/chatkit_server.py- Server updatespackages/api/src/taskflow_api/services/widgets/task_form.py- Form widgetArchitectural & Design Concerns
🔴 Critical (Should Fix Before Production)
recurrence_triggerHas Unimplemented Values -on_due_dateandbothare stored but no background job existsrecurring_root_idneedsindex=Truefor query performance🟡 Medium (Should Address)
🟢 Low (Future Consideration)
new_taskvariable unused inapprove_taskrecurrence_patternPositive Aspects
✅ Clean chain tracking design using
recurring_root_id+ COUNT query✅ Proper audit logging for all spawn events
✅ Full agent parity - MCP tools support recurring task creation
✅ UI integration - Both web form and ChatKit form support recurring fields
✅ Duplicate prevention via
has_spawned_nextflag✅ Subtask cloning is configurable per-task
Test Plan
Questions for Review
🤖 Generated with Claude Code