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:
2026-02-14 18:03:42 -07:00
parent 0eb5d2cab4
commit f018800d94
5 changed files with 178 additions and 2 deletions

View File

@@ -181,6 +181,17 @@ class AdapterRuntime:
except Exception as e:
print(f"[Runtime] Error processing message: {e}")
traceback.print_exc()
if hasattr(self.agent, 'healing_system'):
self.agent.healing_system.capture_error(
error=e,
component="adapters/runtime.py:_process_message",
intent=f"Processing message from {message.platform}",
context={
"platform": message.platform,
"user": message.username,
"message_preview": message.text[:100],
},
)
await self._send_error_reply(message)
async def _send_error_reply(self, message: InboundMessage) -> None: