Claude Code commited on
Commit
e5ac55b
·
1 Parent(s): 54b7757

Claude Code: Fix Cain A2A status display - add explicit health and error_display fields

Browse files

- Add health field (HEALTHY/ERROR) to avoid parsing ambiguity
- Add error_display field to prevent "unknown" string confusion
- Push A2A diagnostic improvements

Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -455,7 +455,8 @@ try:
455
  "stage": "RUNNING_A2A_READY",
456
  "last_updated": datetime.utcnow().isoformat() + "+00:00",
457
  "agent": "cain",
458
- "error": None,
 
459
  "startup_checks": {
460
  "openclaw_imported": False,
461
  "brain_imported": False
@@ -475,17 +476,23 @@ try:
475
  status_data["startup_checks"]["brain_imported"] = True
476
  # CRITICAL: Explicitly set error to null when imports succeed
477
  status_data["error"] = None
 
 
478
  except Exception as e:
479
  error_msg = f"{type(e).__name__}: {e}"
480
  # CRITICAL: Never write "unknown" as error - use specific error or None
481
  # "unknown" is treated as null/healthy, so avoid ambiguity
482
  if error_msg.strip().lower() in ("unknown", "none", "null", ""):
483
  status_data["error"] = None
 
 
484
  else:
485
  status_data["error"] = error_msg
 
 
486
 
487
  # Add explanatory note about error field semantics
488
- status_data["_note"] = "error=null means healthy - null or 'unknown' string are both treated as 'no error'"
489
 
490
  # Write to ALL possible locations to ensure consistency and prevent stale errors
491
  all_status_paths = [
 
455
  "stage": "RUNNING_A2A_READY",
456
  "last_updated": datetime.utcnow().isoformat() + "+00:00",
457
  "agent": "cain",
458
+ "error": None, # ALWAYS null for healthy state
459
+ "error_display": "None", # Explicit display field to avoid "unknown" parsing issues
460
  "startup_checks": {
461
  "openclaw_imported": False,
462
  "brain_imported": False
 
476
  status_data["startup_checks"]["brain_imported"] = True
477
  # CRITICAL: Explicitly set error to null when imports succeed
478
  status_data["error"] = None
479
+ status_data["error_display"] = "None"
480
+ status_data["health"] = "HEALTHY"
481
  except Exception as e:
482
  error_msg = f"{type(e).__name__}: {e}"
483
  # CRITICAL: Never write "unknown" as error - use specific error or None
484
  # "unknown" is treated as null/healthy, so avoid ambiguity
485
  if error_msg.strip().lower() in ("unknown", "none", "null", ""):
486
  status_data["error"] = None
487
+ status_data["error_display"] = "None"
488
+ status_data["health"] = "HEALTHY"
489
  else:
490
  status_data["error"] = error_msg
491
+ status_data["error_display"] = error_msg
492
+ status_data["health"] = "ERROR"
493
 
494
  # Add explanatory note about error field semantics
495
+ status_data["_note"] = "error=null means healthy - health field is authoritative"
496
 
497
  # Write to ALL possible locations to ensure consistency and prevent stale errors
498
  all_status_paths = [