Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
d808b0d
1
Parent(s): 5c9db21
Claude Code: Fix Cain A2A health display - add explicit health and error_display fields
Browse files- Added health field to /a2a/health endpoint (HEALTHY/DEGRADED/ERROR)
- Added error_display field to /a2a/health endpoint (explicit "None" for no error)
- Added health and error_display fields to /api/status endpoint
- This prevents "Error: unknown" display when error field is None
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- app.py +15 -1
- openclaw/.openclaw/agents/cain_status.json +1 -1
app.py
CHANGED
|
@@ -306,6 +306,14 @@ async def api_status():
|
|
| 306 |
except Exception:
|
| 307 |
pass
|
| 308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
return {
|
| 310 |
"status": status_data,
|
| 311 |
"personality": {
|
|
@@ -424,6 +432,10 @@ async def a2a_health():
|
|
| 424 |
|
| 425 |
# A2A endpoint is ALWAYS available (this endpoint responding proves it)
|
| 426 |
# Brain readiness is informational, not blocking
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
return {
|
| 428 |
"status": "ok", # A2A endpoint is working
|
| 429 |
"agent": "Cain",
|
|
@@ -435,7 +447,9 @@ async def a2a_health():
|
|
| 435 |
"endpoint_available": True
|
| 436 |
},
|
| 437 |
"uptime_seconds": time.time() - START_TIME,
|
| 438 |
-
"
|
|
|
|
|
|
|
| 439 |
}
|
| 440 |
|
| 441 |
print(">>> CAIN: FastAPI app created successfully", flush=True)
|
|
|
|
| 306 |
except Exception:
|
| 307 |
pass
|
| 308 |
|
| 309 |
+
# CRITICAL: Ensure health and error_display fields are explicitly set
|
| 310 |
+
# This prevents "Error: unknown" display issues
|
| 311 |
+
if "health" not in status_data:
|
| 312 |
+
status_data["health"] = "HEALTHY" if brain_ready else "DEGRADED"
|
| 313 |
+
if "error_display" not in status_data:
|
| 314 |
+
error = status_data.get("error")
|
| 315 |
+
status_data["error_display"] = str(error) if error else "None"
|
| 316 |
+
|
| 317 |
return {
|
| 318 |
"status": status_data,
|
| 319 |
"personality": {
|
|
|
|
| 432 |
|
| 433 |
# A2A endpoint is ALWAYS available (this endpoint responding proves it)
|
| 434 |
# Brain readiness is informational, not blocking
|
| 435 |
+
# CRITICAL: Add explicit health and error_display fields to prevent "Error: unknown" display
|
| 436 |
+
health = "HEALTHY" if brain_ready else ("DEGRADED" if brain_status == "unknown" else "ERROR")
|
| 437 |
+
error_display = error_details if error_details else "None"
|
| 438 |
+
|
| 439 |
return {
|
| 440 |
"status": "ok", # A2A endpoint is working
|
| 441 |
"agent": "Cain",
|
|
|
|
| 447 |
"endpoint_available": True
|
| 448 |
},
|
| 449 |
"uptime_seconds": time.time() - START_TIME,
|
| 450 |
+
"health": health,
|
| 451 |
+
"error": error_details,
|
| 452 |
+
"error_display": error_display
|
| 453 |
}
|
| 454 |
|
| 455 |
print(">>> CAIN: FastAPI app created successfully", flush=True)
|
openclaw/.openclaw/agents/cain_status.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"current_state": "idle",
|
| 3 |
-
"last_updated": "2026-03-16T20:
|
| 4 |
"agent": "cain",
|
| 5 |
"error": null,
|
| 6 |
"_note": "error=null means healthy - treated as 'no error'",
|
|
|
|
| 1 |
{
|
| 2 |
"current_state": "idle",
|
| 3 |
+
"last_updated": "2026-03-16T20:57:50.241631+00:00",
|
| 4 |
"agent": "cain",
|
| 5 |
"error": null,
|
| 6 |
"_note": "error=null means healthy - treated as 'no error'",
|