Implement self-healing system Phase 1: Error capture and logging
- Add SelfHealingSystem with error observation infrastructure - Capture errors with full context: type, message, stack trace, intent, inputs - Log to MEMORY.md with deduplication (max 3 attempts per error signature) - Integrate error capture in agent, tools, runtime, and scheduler - Non-invasive: preserves all existing error handling behavior - Foundation for future diagnosis and auto-fixing capabilities Phase 1 of 4-phase rollout - observation only, no auto-fixing yet. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -345,6 +345,17 @@ class TaskScheduler:
|
||||
print(f"[Scheduler] Task failed: {task.name}")
|
||||
print(f" Error: {e}")
|
||||
traceback.print_exc()
|
||||
if self.agent and hasattr(self.agent, 'healing_system'):
|
||||
self.agent.healing_system.capture_error(
|
||||
error=e,
|
||||
component="scheduled_tasks.py:_execute_task",
|
||||
intent=f"Executing scheduled task: {task.name}",
|
||||
context={
|
||||
"task_name": task.name,
|
||||
"schedule": task.schedule,
|
||||
"prompt": task.prompt[:100],
|
||||
},
|
||||
)
|
||||
|
||||
async def _send_to_platform(
|
||||
self, task: ScheduledTask, response: str
|
||||
|
||||
Reference in New Issue
Block a user