# Task ID: 130 **Title:** Task service with lifecycle state machine **Status:** pending **Dependencies:** 129 **Priority:** medium **Description:** Create TaskService implementing the full task lifecycle with transition guards and event logging **Details:** Create src/mcpd/src/services/task.service.ts: 1. Define VALID_TRANSITIONS map: { [fromState]: [allowedToStates] } based on PRD lifecycle diagram 2. transition(id, toState, actorType, actorId, note): check transition is valid, call repo.transition, if success create TaskEvent, return result 3. assign(id, agentId): set assigneeId 4. recordVerdict(id, stage, agentId, commit, passed, summary, findings): create TaskVerdict, if failed transition back to in_progress 5. accept(id, userId, note): transition to merged, trigger merge via GitProvider 6. reject(id, userId, note): transition to in_progress 7. reopenOnPostMergeFailure(id): transition merged→reopened **Test Strategy:** Unit tests: test all valid transitions succeed, test invalid transitions throw, test TaskEvent created on every transition, test verdict creation, test accept triggers merge.