Mark a task as completed.
(self, task_id: int, result: str)
| 202 | return True |
| 203 | |
| 204 | def complete_task(self, task_id: int, result: str) -> bool: |
| 205 | """Mark a task as completed.""" |
| 206 | task = self._tasks.get(task_id) |
| 207 | if not task: |
| 208 | return False |
| 209 | |
| 210 | task.status = TaskStatus.DONE |
| 211 | task.result = result |
| 212 | task.completed_at = int(time.time()) |
| 213 | |
| 214 | # Update database |
| 215 | self.state.complete_task(task_id, result) |
| 216 | |
| 217 | success(f"Planner: completed task {task_id}") |
| 218 | |
| 219 | # Log in episodic memory |
| 220 | self.state.log_action("task_completed", f"Task {task_id}: {result[:100]}") |
| 221 | |
| 222 | # Clear current task if this was it |
| 223 | if self._current_task and self._current_task.id == task_id: |
| 224 | self._current_task = None |
| 225 | |
| 226 | return True |
| 227 | |
| 228 | def fail_task(self, task_id: int, error_msg: str) -> bool: |
| 229 | """ |
nothing calls this directly
no test coverage detected