{ "id": "KB-199", "description": "Add CLI command `kb task retry ` to retry failed tasks from the command line.\n\n## Background\nCurrently, when a task fails (enters 'failed' status), users must use the dashboard web UI to retry it. This blocks automated recovery workflows and is frustrating for CLI-first users.\n\n## Acceptance Criteria\n- [ ] Add `kb task retry ` command to `packages/cli/src/bin.ts`\n- [ ] Implement `runTaskRetry(id)` function in `packages/cli/src/commands/task.ts`\n- [ ] Use store methods to: validate task is in failed state, clear status/error, move to todo column\n- [ ] Display appropriate messages: error if not failed, success with task state on retry\n- [ ] Log the retry action via `store.logEntry()`\n- [ ] Handle edge cases: task doesn't exist, task not in failed state\n- [ ] Add corresponding Pi extension tool `kb_task_retry` in `packages/cli/src/extension.ts`\n- [ ] Update CLI help text\n\n## Technical Notes\n- Dashboard API: POST /api/tasks/:id/retry\n- Logic: Check `task.status === 'failed'`, then `store.updateTask(id, { status: undefined, error: undefined })`, then `store.moveTask(id, 'todo')`\n- Add log entry: \"Retry requested from CLI\"\n\n## Parent Task\nThis subtask was identified as part of KB-182 dashboard vs CLI gap analysis.", "column": "done", "dependencies": [ "KB-182" ], "steps": [ { "name": "Implement `runTaskRetry()` in task.ts", "status": "done" }, { "name": "Wire up CLI command in bin.ts", "status": "done" }, { "name": "Add Pi extension tool", "status": "done" }, { "name": "Testing & Verification", "status": "done" }, { "name": "Documentation & Delivery", "status": "done" } ], "currentStep": 5, "log": [ { "timestamp": "2026-03-30T19:12:16.035Z", "action": "Task created" }, { "timestamp": "2026-03-30T19:18:20.684Z", "action": "Spec review requested" }, { "timestamp": "2026-03-30T19:18:31.884Z", "action": "Spec review: APPROVE", "outcome": "This is a well-crafted specification for a small, focused CLI feature. The spec correctly identifies existing patterns in the codebase, references real files and methods, and provides concrete, verifiable outcomes for each step. The testing requirements demand real automated tests with assertions, and the sizing (S) with review level 2 is appropriate." }, { "timestamp": "2026-03-30T20:28:06.063Z", "action": "Worktree created at /Users/eclipxe/Projects/kb/.worktrees/glad-trail" }, { "timestamp": "2026-03-30T20:28:06.063Z", "action": "Step 0 (Implement `runTaskRetry()` in task.ts) → pending" }, { "timestamp": "2026-03-30T20:28:08.760Z", "action": "Step 0 (Implement `runTaskRetry()` in task.ts) → in-progress" }, { "timestamp": "2026-03-30T20:28:12.963Z", "action": "Step 0 (Implement `runTaskRetry()` in task.ts) → done" }, { "timestamp": "2026-03-30T20:28:12.966Z", "action": "Step 1 (Wire up CLI command in bin.ts) → in-progress" }, { "timestamp": "2026-03-30T20:28:12.968Z", "action": "plan review requested for Step 1 (Implement runTaskRetry() in task.ts)" }, { "timestamp": "2026-03-30T20:28:42.746Z", "action": "plan review Step 1: APPROVE", "outcome": "The plan for Step 1 is sound and follows existing patterns in the codebase. The approach correctly uses `store.getTask()`, `store.updateTask()`, `store.moveTask()`, and `store.logEntry()` as shown in existing command implementations like `runTaskPause`, `runTaskArchive`, and `runTaskDuplicate`." }, { "timestamp": "2026-03-30T20:29:00.700Z", "action": "code review requested for Step 1 (Implement runTaskRetry() in task.ts)" }, { "timestamp": "2026-03-30T20:29:25.856Z", "action": "code review Step 1: REVISE", "outcome": "The `runTaskRetry()` function is implemented with the correct business logic, but a **critical structural error** was introduced: the `runTaskDelete()` function declaration is missing, leaving orphaned code that will cause a build failure. Additionally, the \"task not found\" validation is not explicitly handled per the specification requirements." }, { "timestamp": "2026-03-30T20:32:36.402Z", "action": "code review requested for Step 1 (Implement runTaskRetry() in task.ts)" }, { "timestamp": "2026-03-30T20:32:58.426Z", "action": "code review Step 1: APPROVE", "outcome": "The `runTaskRetry()` function is correctly implemented following the task requirements and existing codebase patterns. It validates the task exists, checks for failed status, clears the error state, moves the task to the todo column, logs the action, and prints the expected success message. The implementation is consistent with similar functions in the file." }, { "timestamp": "2026-03-30T20:33:00.180Z", "action": "Step 1 (Wire up CLI command in bin.ts) → done" }, { "timestamp": "2026-03-30T20:33:00.181Z", "action": "Step 2 (Add Pi extension tool) → in-progress" }, { "timestamp": "2026-03-30T20:33:00.183Z", "action": "plan review requested for Step 2 (Wire up CLI command in bin.ts)" }, { "timestamp": "2026-03-30T20:33:09.839Z", "action": "plan review Step 2: APPROVE", "outcome": "The plan for Step 2 is clear, follows existing CLI patterns exactly, and will achieve the stated outcomes. The step checkboxes correctly identify all required actions: importing the function, adding the switch case with proper argument validation, and updating HELP text." }, { "timestamp": "2026-03-30T20:33:21.591Z", "action": "code review requested for Step 2 (Wire up CLI command in bin.ts)" }, { "timestamp": "2026-03-30T20:33:33.171Z", "action": "code review Step 2: APPROVE", "outcome": "The implementation correctly wires up the `kb task retry ` CLI command in `bin.ts`. All requirements from Step 2 are met: the import is added, the switch case handles argument parsing and validation, the HELP text is updated, and the code follows existing patterns in the codebase." }, { "timestamp": "2026-03-30T20:33:34.603Z", "action": "Step 2 (Add Pi extension tool) → done" }, { "timestamp": "2026-03-30T20:33:34.603Z", "action": "Step 3 (Testing & Verification) → in-progress" }, { "timestamp": "2026-03-30T20:33:34.604Z", "action": "plan review requested for Step 3 (Add Pi extension tool)" }, { "timestamp": "2026-03-30T20:33:50.347Z", "action": "plan review Step 3: APPROVE", "outcome": "The plan for Step 3 correctly identifies the need to add a `kb_task_retry` tool to `packages/cli/src/extension.ts`. The approach follows established patterns from similar tools like `kb_task_pause` and `kb_task_archive`. The `runTaskRetry()` function has already been implemented in Step 1 with proper validation and error handling." }, { "timestamp": "2026-03-30T20:34:02.686Z", "action": "code review requested for Step 3 (Add Pi extension tool)" }, { "timestamp": "2026-03-30T20:34:27.383Z", "action": "code review Step 3: APPROVE", "outcome": "The `kb_task_retry` tool is correctly implemented in `packages/cli/src/extension.ts` with all required fields (label, description, promptSnippet, promptGuidelines), proper parameter typing, and graceful error handling. The implementation validates task existence and failed state before clearing error status, moving to todo, and logging the action. The success and error message formats match CLI output conventions." }, { "timestamp": "2026-03-30T20:34:28.847Z", "action": "Step 3 (Testing & Verification) → done" }, { "timestamp": "2026-03-30T20:34:28.850Z", "action": "Step 4 (Documentation & Delivery) → in-progress" }, { "timestamp": "2026-03-30T20:35:45.969Z", "action": "Step 4 (Documentation & Delivery) → done" }, { "timestamp": "2026-03-30T20:36:54.415Z", "action": "Completed implementation of kb task retry CLI command", "outcome": "All 4 retry tests pass. Build passes. Changeset created. Pre-existing test failures in runTaskDelete are unrelated to this task." }, { "timestamp": "2026-03-30T20:36:57.958Z", "action": "Task marked done by agent" } ], "columnMovedAt": "2026-03-30T20:37:13.948Z", "createdAt": "2026-03-30T19:12:16.035Z", "updatedAt": "2026-03-30T20:37:13.948Z", "size": "S", "reviewLevel": 2 }