feat: Batch Retrieval and Failure Tracking MCP methods#33
Merged
Conversation
- Added CREATE_TASK_FAILURES_TABLE schema with fields: id, task_id, failure_type, failure_reason, attempt, created_at - Added index on task_id for efficient querying - Added FailureType enum and TaskFailure interface to types.ts - Added generateFailureId() utility function - Implemented addTaskFailure() and getTaskFailures() methods in TaskDatabase - Exported new types and schema from index.ts - Added comprehensive test coverage with 9 passing tests Test coverage includes: - Adding failure records with all fields - Optional attempt parameter handling - All failure types (spec, quality, implementation) - Querying failures by task_id - Correct ordering (DESC by created_at) - Schema validation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added comprehensive test coverage for needs_rework flag in db.test.ts - Added set_needs_rework tool to MCP server with schema and handler - Tests verify flag can be set/cleared, persists across reloads, and auto-clears on task completion - MCP tool allows marking tasks for rework via API Test coverage includes: - Setting and clearing needs_rework flag - Activity logging when flag is modified - Auto-clearing on task completion (done/archived) - Flag persistence across database reloads - Default value of 0 for new tasks - Integration with getTasks query Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The test "should return failures ordered by created_at DESC" was creating a promise without awaiting it, causing the test to complete while the promise was still pending. This left the database in an inconsistent state and caused an "unhandled rejection: Database closed" error. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add RecordFailureSchema with task_id, failure_type, reason, and optional attempt
- Add record_task_failure tool definition to TOOLS array
- Implement handler that calls db.addTaskFailure()
- Returns { success: true, failure_id: string }
- Add comprehensive tests for schema validation and handler
- Validates failure_type as enum: spec, quality, or implementation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add BatchTask interface extending Task with failure_context field - Implement getNextBatch(size) method in TaskDatabase - Returns tasks where status=todo OR needs_rework=1 - Filters out tasks with unmet blockedBy dependencies - Orders by epic priority (P0 first), then created_at - Limits to size (default 3, max 5) - Attaches failure_context from getTaskFailures() for tasks with needs_rework=1 - Add get_next_batch MCP tool with batch_size parameter (default 3, max 5) - Add comprehensive tests for both db method and MCP tool - 15 tests for getNextBatch in db.test.ts - 8 tests for get_next_batch handler in server.test.ts - Schema validation tests for GetNextBatchSchema All tests passing (190 MCP tests, 178 core tests, 122 CLI tests) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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
Implements story-6d20cbf9: ohno MCP Batch Retrieval and Failure Tracking
This adds new MCP methods to ohno for batch-based task retrieval and failure tracking, moving dependency filtering, priority ordering, and blocker checking from the coordinator to ohno.
New Features
task_failurestable for tracking task failures with type, reason, and attemptneeds_reworkboolean flag on tasks with auto-clear on completionrecord_task_failureMCP tool - Records failures for pattern learning (spec/quality/implementation types)get_next_batchMCP tool - Smart batch retrieval with:Tasks Completed
Test plan
🤖 Generated with Claude Code