Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
9191e07
1
Parent(s): af8fa37
Claude Code: Add defensive brain interface check - verify get_brain exists before calling
Browse filesThis prevents AttributeError if brain_minimal module is loaded but incomplete.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- error_handlers.py +4 -0
error_handlers.py
CHANGED
|
@@ -159,6 +159,10 @@ def handle_brain_response(message: str) -> str:
|
|
| 159 |
import openclaw
|
| 160 |
from agents import brain_minimal
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
brain = brain_minimal.get_brain(agent_name="cain", legacy_mode=True)
|
| 163 |
result = brain._conversation_process(message)
|
| 164 |
|
|
|
|
| 159 |
import openclaw
|
| 160 |
from agents import brain_minimal
|
| 161 |
|
| 162 |
+
# Verify brain has required method before calling
|
| 163 |
+
if not hasattr(brain_minimal, 'get_brain'):
|
| 164 |
+
return "Brain interface error: get_brain method not found"
|
| 165 |
+
|
| 166 |
brain = brain_minimal.get_brain(agent_name="cain", legacy_mode=True)
|
| 167 |
result = brain._conversation_process(message)
|
| 168 |
|