Claude Code Claude Opus 4.6 commited on
Commit
eaa3d52
·
1 Parent(s): 17cf45e

Claude Code: Fix import paths for runtime environment

Browse files

- Change imports from 'openclaw.openclaw.agents.brain_minimal' to direct 'agents.brain_minimal'
- The .openclaw directory is added to sys.path by openclaw/__init__.py
- Direct imports work correctly with the Docker WORKDIR /app layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +3 -1
  2. error_handlers.py +2 -1
app.py CHANGED
@@ -66,7 +66,9 @@ async def hello():
66
  """Hello endpoint - lazy loads brain, graceful degradation if offline."""
67
  try:
68
  # LAZY LOAD: Import brain only when this endpoint is called
69
- from openclaw.openclaw.agents import brain_minimal
 
 
70
  brain = brain_minimal
71
 
72
  # Try to use brain
 
66
  """Hello endpoint - lazy loads brain, graceful degradation if offline."""
67
  try:
68
  # LAZY LOAD: Import brain only when this endpoint is called
69
+ # Import directly since .openclaw is in sys.path after openclaw import
70
+ import openclaw # Trigger sys.path setup
71
+ from agents import brain_minimal
72
  brain = brain_minimal
73
 
74
  # Try to use brain
error_handlers.py CHANGED
@@ -146,7 +146,8 @@ def handle_brain_response(message: str) -> str:
146
  AttributeError: If required brain methods are missing.
147
  """
148
  try:
149
- from openclaw.openclaw.agents.brain_minimal import BrainMinimal
 
150
 
151
  brain = BrainMinimal(agent_name="cain", legacy_mode=True)
152
  result = brain._conversation_process(message)
 
146
  AttributeError: If required brain methods are missing.
147
  """
148
  try:
149
+ # Import directly since .openclaw is in sys.path after openclaw import
150
+ from agents.brain_minimal import BrainMinimal
151
 
152
  brain = BrainMinimal(agent_name="cain", legacy_mode=True)
153
  result = brain._conversation_process(message)