Claude Code Claude Opus 4.6 commited on
Commit
d147990
·
1 Parent(s): 0abdf8e

Claude Code: Fix Cain - add missing memory directory paths to all status file resolution

Browse files

Consistently add memory/cain_status.json paths to:
- health_monitor.py _find_status_file()
- error_handlers.py _resolve_status_file()

This ensures stale "unknown" errors in memory directory are cleaned everywhere.

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

error_handlers.py CHANGED
@@ -135,6 +135,17 @@ def _resolve_status_file() -> Path:
135
  if app_path.parent.exists():
136
  return app_path
137
 
 
 
 
 
 
 
 
 
 
 
 
138
  # Priority 7: Script directory as final fallback
139
  script_dir = Path(os.path.dirname(__file__))
140
  return script_dir / "cain_status.json"
 
135
  if app_path.parent.exists():
136
  return app_path
137
 
138
+ # Priority 6.5: Memory directory paths (CRITICAL: can have stale 'unknown' errors)
139
+ _script_dir = Path(os.path.abspath(os.path.dirname(__file__)))
140
+ _memory_paths = [
141
+ Path("/app/memory/cain_status.json"),
142
+ Path("/data/memory/cain_status.json"),
143
+ _script_dir / "memory" / "cain_status.json",
144
+ ]
145
+ for mem_path in _memory_paths:
146
+ if mem_path.exists():
147
+ return mem_path
148
+
149
  # Priority 7: Script directory as final fallback
150
  script_dir = Path(os.path.dirname(__file__))
151
  return script_dir / "cain_status.json"
openclaw/.openclaw/health_monitor.py CHANGED
@@ -877,6 +877,17 @@ def _find_status_file() -> Path:
877
  _fix_stale_error_field(root_path)
878
  return root_path
879
 
 
 
 
 
 
 
 
 
 
 
 
880
  # Strategy 7: Fall back to /data/cain_status.json (default for Docker)
881
  return Path("/data/cain_status.json")
882
 
 
877
  _fix_stale_error_field(root_path)
878
  return root_path
879
 
880
+ # Strategy 6.5: Memory directory paths (CRITICAL: can have stale 'unknown' errors)
881
+ memory_paths = [
882
+ Path("/app/memory/cain_status.json"),
883
+ Path("/data/memory/cain_status.json"),
884
+ workspace_root / "memory" / "cain_status.json",
885
+ ]
886
+ for mem_path in memory_paths:
887
+ if mem_path.exists():
888
+ _fix_stale_error_field(mem_path)
889
+ return mem_path
890
+
891
  # Strategy 7: Fall back to /data/cain_status.json (default for Docker)
892
  return Path("/data/cain_status.json")
893