Claude Code Claude Opus 4.6 commited on
Commit
eaed9e2
·
1 Parent(s): 2a9d17c

Claude Code: Fix hardcoded /app/openclaw paths → use /app directly

Browse files

Aligns sys.path setup and status file resolution with Docker WORKDIR.
.openclaw is at /app/.openclaw, not /app/openclaw/.openclaw.

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

Files changed (1) hide show
  1. error_handlers.py +6 -6
error_handlers.py CHANGED
@@ -14,12 +14,12 @@ from fastapi.responses import JSONResponse
14
 
15
  # CRITICAL: Set up sys.path for agents imports at module load time
16
  # This ensures `from agents import brain_minimal` works regardless of import order
17
- # Note: Docker WORKDIR is /app, .openclaw is at /app/.openclaw, not /app/openclaw/.openclaw
18
- _openclaw_package_dir = Path(__file__).parent / "openclaw"
19
  _openclaw_internal_dir = Path(__file__).parent / ".openclaw" # /app/.openclaw
20
 
21
- # Add openclaw parent dir and .openclaw to sys.path for agents imports
22
- for path_dir in [_openclaw_package_dir, _openclaw_internal_dir]:
23
  path_str = str(path_dir)
24
  if path_str not in sys.path and path_dir.exists():
25
  sys.path.insert(0, path_str)
@@ -94,8 +94,8 @@ def _resolve_status_file() -> Path:
94
  if env_path:
95
  return Path(env_path)
96
 
97
- # Priority 2: openclaw/.openclaw/agents/cain_status.json (actual location)
98
- openclaw_status = Path(__file__).parent / "openclaw" / ".openclaw" / "agents" / "cain_status.json"
99
  if openclaw_status.exists():
100
  return openclaw_status
101
 
 
14
 
15
  # CRITICAL: Set up sys.path for agents imports at module load time
16
  # This ensures `from agents import brain_minimal` works regardless of import order
17
+ # Note: Docker WORKDIR is /app, .openclaw is at /app/.openclaw
18
+ _openclaw_base_dir = Path(__file__).parent # /app
19
  _openclaw_internal_dir = Path(__file__).parent / ".openclaw" # /app/.openclaw
20
 
21
+ # Add /app and /app/.openclaw to sys.path for agents imports
22
+ for path_dir in [_openclaw_base_dir, _openclaw_internal_dir]:
23
  path_str = str(path_dir)
24
  if path_str not in sys.path and path_dir.exists():
25
  sys.path.insert(0, path_str)
 
94
  if env_path:
95
  return Path(env_path)
96
 
97
+ # Priority 2: /app/.openclaw/agents/cain_status.json (actual location)
98
+ openclaw_status = Path(__file__).parent / ".openclaw" / "agents" / "cain_status.json"
99
  if openclaw_status.exists():
100
  return openclaw_status
101