Claude Code Claude Opus 4.6 commited on
Commit
3653fbe
·
1 Parent(s): bfaf859

Claude Code: Fix brain_minimal health reporting bugs

Browse files

- Add missing 'error' and 'state' fields to get_info() return value
- Fix format_status() call: was using 'stage' parameter but function expects 'state'
- Increment version to 0.1.2

These fixes ensure health_monitor receives correct brain status info.

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

openclaw/.openclaw/agents/brain_minimal.py CHANGED
@@ -1263,10 +1263,11 @@ class BrainMinimal:
1263
  # Build base status using formatting utility
1264
  base_status = format_status(
1265
  status="healthy",
1266
- stage="RUNNING",
1267
  agent=self.agent_name,
1268
  extra={
1269
- "state": self.brain_state.value,
 
1270
  "role": self.current_role.value if self.current_role else "unknown",
1271
  "tools_count": len(self.get_allowed_tools()),
1272
  "error": None
@@ -1585,13 +1586,15 @@ class BrainMinimal:
1585
  return {
1586
  "agent": self.agent_name,
1587
  "role": self.current_role.value if self.current_role else "unknown",
 
1588
  "brain_state": self.brain_state.value,
1589
  "agent_state": self.state_machine.get_state(),
1590
  "legacy_mode": self.legacy_mode,
1591
  "tools_registered": len(self.tools),
1592
  "tools_allowed": len(self.get_allowed_tools()),
1593
  "last_action": self.last_action,
1594
- "last_action_time": self.last_action_time
 
1595
  }
1596
 
1597
  def list_tools(self, category: Optional[ToolCategory] = None) -> List[Dict[str, Any]]:
 
1263
  # Build base status using formatting utility
1264
  base_status = format_status(
1265
  status="healthy",
1266
+ state="RUNNING", # Fixed: was "stage" but format_status expects "state"
1267
  agent=self.agent_name,
1268
  extra={
1269
+ "brain_state": self.brain_state.value,
1270
+ "agent_state": self.state_machine.get_state(),
1271
  "role": self.current_role.value if self.current_role else "unknown",
1272
  "tools_count": len(self.get_allowed_tools()),
1273
  "error": None
 
1586
  return {
1587
  "agent": self.agent_name,
1588
  "role": self.current_role.value if self.current_role else "unknown",
1589
+ "state": self.state_machine.get_state(), # For health_monitor compatibility
1590
  "brain_state": self.brain_state.value,
1591
  "agent_state": self.state_machine.get_state(),
1592
  "legacy_mode": self.legacy_mode,
1593
  "tools_registered": len(self.tools),
1594
  "tools_allowed": len(self.get_allowed_tools()),
1595
  "last_action": self.last_action,
1596
+ "last_action_time": self.last_action_time,
1597
+ "error": None # CRITICAL: Explicitly set error to null for healthy state
1598
  }
1599
 
1600
  def list_tools(self, category: Optional[ToolCategory] = None) -> List[Dict[str, Any]]:
openclaw/__init__.py CHANGED
@@ -15,4 +15,4 @@ _openclaw_internal = _package_dir / ".openclaw"
15
  if str(_openclaw_internal) not in sys.path:
16
  sys.path.insert(0, str(_openclaw_internal))
17
 
18
- __version__ = "0.1.1" # Health monitor fix: treat null/unknown error as healthy
 
15
  if str(_openclaw_internal) not in sys.path:
16
  sys.path.insert(0, str(_openclaw_internal))
17
 
18
+ __version__ = "0.1.2" # Fix brain_minimal get_info error field + format_status parameter mismatch