Spaces:
Sleeping
Sleeping
Commit History
-
Claude Code: Fix WebSocket/SSE disconnect handling and eliminate zombie polling
Claude Code +1: Claude Opus 4.6- Add managed interval tracking to frontend JavaScript for proper cleanup - Add sendBeacon notification on page unload to notify backend of client closure - Add beforeunload and pagehide handlers to clear all intervals - Update SSE endpoint to detect client disconnects via request.is_disconnected() - Add POST /api/state endpoint to receive disconnect notifications This eliminates the 2-second polling loop that continued running after clients disconnected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3ef499f -
Claude Code: Fix /api/state to return actual cain_status data
Claude Code- Add _read_cain_status() helper to read cain_status.json from common locations - Update /api/state endpoint to include cain_status in response - This fixes the issue where /api/state was only returning worker state from heartbeats95338ad -
Claude Code: Add /api/status endpoint for frontend polling
Claude Code +1: Claude Opus 4.6- Add @app.get("/api/status") route next to /api/state - Return {"status": "healthy", "timestamp": "..."} Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>0036fbd -
Claude Code: Add CollaborationHub WebSocket message broker
Claude Code +1: Claude Opus 4.6- Add CollaborationHub class with room-based messaging (adam, eve, system, dialogue) - Add /ws/hub WebSocket endpoint for room-based connections - Add HTTP API endpoints: /api/hub/status, /api/hub/dialogue, /api/hub/broadcast - Support inter-agent dialogue simulation and targeted room messaging Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>e95366a
-
Claude Code: Refactor state sync from WebSocket to SSE
Claude Code +1: Claude Opus 4.6- Add EventSourceResponse import from fastapi.responses - Create async generator event_stream() for SSE with 15s keep-alive - Add /api/events SSE endpoint returning state updates every 2s - Replace WebSocket state monitoring in frontend with EventSource - Keep /api/state endpoint for initial fetch on page load Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>c190a36 -
Claude Code: Refactor state sync from HTTP polling to WebSocket
Claude Code +1: Claude CodeReplace HTTP polling (setInterval every 2s) with WebSocket connection for real-time state updates. Reduces request overhead and improves responsiveness. - Add connectStateWebSocket() function with auto-reconnect - Remove setInterval(fetchCainState, 2000) polling - Add WebSocket message handler for state updates - Add cleanup on page unload Co-Authored-By: Claude Code <noreply@anthropic.com>5192e85 -
Claude Code: Add rate-limiting middleware with slowapi
Claude Code +1: Claude Opus 4.6- Add slowapi>=0.1.9 to requirements.txt - Configure 60 requests/minute per IP for API endpoints - Return 429 with Retry-After headers when exceeded - Higher limit (100/min) for internal heartbeat endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>df133af -
Claude Code: Add /ws/state WebSocket endpoint for real-time state updates
Claude Code +1: Claude Opus 4.6- New /ws/state WebSocket endpoint pushes state updates every 2 seconds - Replaces polling /api/state with real-time push mechanism - Added frontend/websocket-state-demo.html with example client - Auto-reconnect handling and visual status indicator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>314e069 -
Claude Code: Implement WebSocket ConnectionManager
Claude Code +1: Claude Opus 4.6- Add ConnectionManager class with active_connections dict - Implement connect() with duplicate connection rejection - Implement disconnect() with proper dict cleanup - Implement broadcast() with auto-cleanup of failed sends - Add /ws endpoint with required client_id query param - Add try-catch for JSONDecodeError and WebSocketDisconnect - Add CORS middleware allowing all origins (ws://, wss://) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d35e09a
-
Claude Code: Add missing /api/state endpoint and /internal/heartbeat for worker IPC
Claude Code +1: Claude Opus 4.6- Added /api/state route returning server and worker state - Added /internal/heartbeat POST endpoint for worker heartbeats - Worker state now tracked in-memory for health monitoring Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4f93361
-
Claude Code: Trigger container restart to clear runtime error
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4c6020a -
Claude Code: Add centralized JSON logging with global exception handler
Claude Code +1: Claude Opus 4.6- Implement JSONFormatter for structured JSON log output - Configure uvicorn access logger for JSON format - Add global exception handler catching all Exception types - Returns 500 JSON response with error type and message - Logs full stacktrace to stdout on errors - Startup logs clearly indicate port 7860 binding on 0.0.0.0 - Replace print() statements with proper logger calls Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>c511a6d
-
Claude Code: Add /status endpoint with structured health checks (db, env, fs)
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>54b1241 -
Claude Code: Add structured /health endpoint with timestamp, STARTUP_MODE, and brain_loaded status
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>097b672 -
Claude Code: Rewrite app.py - clean FastAPI with WebSocket and static mount
Claude Code +1: Claude Opus 4.6- Simplify app.py to core FastAPI + WebSocket + static files - WebSocket /ws/agents sends Adam (Thinking) and Eve (Writing) every 2s - Mount frontend/ at root with StaticFiles(html=True) - Bind to 0.0.0.0:7860 via uvicorn Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>81c9c70 -
Claude Code: Fix app.py - add /ws/agents WebSocket, mount StaticFiles at /, use fastapi.staticfiles
Claude Code +1: Claude Opus 4.6- Import StaticFiles from fastapi.staticfiles (not starlette.staticfiles) - Mount frontend at root path "/" instead of "/frontend" - Add @app.websocket("/ws/agents") endpoint sending {"name": "Adam", "status": "Active"} every 2s - Add "Server started" log in lifespan startup - Import WebSocket from fastapi Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>57ecd84 -
Claude Code: Add /api/agents endpoint returning all HuggingClaw agents (Adam, Eve, Cain) with statuses and roles
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d6fead5 -
Claude Code: Fix A2A communication - add missing /a2a/jsonrpc endpoint
Claude Code +1: Claude Opus 4.6The A2A JSON-RPC endpoint was missing, causing all A2A communication to fail with 404 errors. Added proper /a2a/jsonrpc POST endpoint that: - Handles message/send method from other HuggingClaw agents - Processes messages through the brain - Returns proper JSON-RPC 2.0 responses - Updates worker state during processing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d783c91 -
Claude Code: Fix A2A communication - pre-initialize worker_state in minimal mode
Claude Code +1: Claude Opus 4.6Root cause: 3-second delay in state transition caused A2A communication failures during startup. Health endpoint returned STARTING stage while parent agent expected RUNNING. Fix: Pre-initialize _worker_state to RUNNING_A2A_READY in minimal mode at module import time, eliminating the delay and ensuring immediate A2A readiness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>749b560 -
Claude Code: Fix health endpoint - explicitly set error=null to prevent 'Error: unknown' display
Claude Code +1: Claude Opus 4.6The health endpoint was setting 'error': None in the response dict, which serializes to 'error': null in JSON. HuggingFace's infrastructure displays this as 'Error: unknown'. Fix: Remove the error key entirely when there's no actual error, rather than setting it to None. The error field is now only included in the JSON response when there's a real error condition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>7a5b921 -
Claude Code: Fix health endpoint - explicitly set error=null to prevent 'Error: unknown' display
Claude Code +1: Claude Opus 4.6The health endpoint now explicitly includes error: null in the response instead of omitting the field entirely. This prevents monitoring systems from displaying 'Error: unknown' when the error field is missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>732447a -
Claude Code: Verify health endpoint - add debug logging
Claude Code +1: Claude Opus 4.6Investigation findings: - Uvicorn correctly binds to 0.0.0.0:7860 via entrypoint.sh - /health endpoint already has protection against "error": "unknown" - Status files have correct values (error=null, health=HEALTHY) - No code currently sets error to "unknown" Added debug logging to health endpoint to help diagnose "Error: unknown" display issue if it persists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2dc23e5 -
Claude Code: Fix A2A communication in minimal mode - add startup state transition
Claude Code +1: Claude Opus 4.6In minimal mode, the worker process is not spawned, which caused _worker_state to stay in "STARTING" state forever. This broke A2A communication because external agents poll /health expecting stage="RUNNING". Fix: Add background task that transitions state to RUNNING_A2A_READY after 3 seconds, enabling A2A discovery even without worker process. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>fe057ec -
Claude Code: Skip worker spawn in minimal mode to ensure uvicorn starts immediately
Claude Codec860f1e -
Claude Code: Add debug prints to track uvicorn startup sequence
Claude Codee1064e4 -
Claude Code: Fix startup - add explicit uvicorn.run() with logging
Claude Code +1: Claude Opus 4.6- Add main block with uvicorn.run(app, host="0.0.0.0", port=7860) - Add explicit logging before server binding to verify execution - Ensure server binds to port 7860 regardless of agent status Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3eb8441 -
Claude Code: Fix 'Error: unknown' status display
Claude Code +1: Claude Opus 4.6- Add cleanup of stale 'unknown' error strings on app startup - Make /health endpoint defensive - only return error if real error exists - Cleanup runs on module import before FastAPI starts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>e3aa6b2 -
Claude Code: Fix A2A communication - move static mount to /frontend subpath
Claude Code +1: Claude Opus 4.6The static file mount at "/" was overriding all API routes (/health, /agents). This broke A2A proxy discovery and health checks. Now static files are at /frontend and root redirects to /frontend/. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4805801 -
Claude Code: Add /_debug diagnostic route to expose filesystem state
Claude Code +1: Claude Opus 4.6- Adds /_debug endpoint to verify server responsiveness - Returns cwd, frontend existence, frontend listing, static mount status - Helps diagnose root route / static file issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3af5388 -
Claude Code: Fix frontend mount - use absolute path /app/frontend with root mount and html=True
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b8f337d -
Claude Code: Fix Cain - add static file mounting for /frontend directory
Claude Code +1: Claude Opus 4.6The frontend static files were not being served. Added StaticFiles mount for /frontend directory to serve index.html and related assets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1550d6c -
Claude Code: Fix Cain - spawn brain_minimal.py worker process on startup
Claude Code +1: Claude Opus 4.6The worker process was never started, causing health check to report "starting" forever. Added lifespan context manager to spawn worker subprocess on startup and terminate gracefully on shutdown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>63e51e7 -
Claude Code: Check Cain's current application logs (stdout/stderr) to identify the "u
Claude Code78dea99 -
Claude Code: Fix Starlette middleware import - BaseMiddleware -> BaseHTTPMiddleware
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>5982cbe -
Claude Code: Add full traceback logging middleware
Claude Code +1: Claude Opus 4.6- Import traceback and BaseMiddleware - Replace function middleware with class-based LoggingMiddleware - Log full stack trace with traceback.format_exc() on errors - Return JSONResponse with 500 status instead of re-raising Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ba6c66b -
Claude Code: Add request logging middleware and STARTUP_MODE support
Claude Code +1: Claude Opus 4.6- Add middleware to log all requests and exceptions to logs/runtime.log - Create logs/ directory automatically if it doesn't exist - Pass STARTUP_MODE from entrypoint.sh (default: minimal) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ce4bc03 -
Claude Code: Fix A2A - add /health and /agents endpoints
Claude Code- Add missing /internal/heartbeat endpoint for worker communication - Track worker state in-memory instead of hardcoded values - Fix "unknown" error by properly reporting worker stage79d6a8b -
Fix: Enforce strict uvicorn entrypoint configuration
Claude Code03d0f79 -
Claude Code: Fix A2A port routing - expose a2a-proxy on external port 7860
Claude Code +1: Claude Opus 4.6- Move a2a-proxy from internal 7861 to external 7860 (Docker exposed) - Move uvicorn to internal 7862 (only accessed by proxy) - Fixes external A2A health checks failing due to unreachable proxy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>5db4585 -
Claude Code: Simplify app.py - remove redundant uvicorn.run() block, entrypoint.sh handles startup
Claude Code54e4ffb -
Claude Code: Fix stale 'unknown' error - ensure entrypoint cleans cached errors on restart
Claude Code45bc2ae -
Claude Code: Fix A2A - add /health and /agents endpoints
Claude Code441f392 -
Claude Code: Force minimal app.py - diagnostic for unknown error
Claude Code +1: Claude Opus 4.6Backup saved as app.py.broken. Testing if "unknown" error is in Python code layer or Docker/entrypoint layer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>7cab3bb -
Claude Code: Test Eve's hypothesis - disable error_handlers to break dependency chain
Claude Code +1: Claude Opus 4.6- Commented out error_handlers import and registration - Commented out RequestLoggingMiddleware - Added print("APP_READY") immediately after FastAPI instantiation - This will verify if error_handlers or middleware is causing startup hang Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>7d8ff40 -
Claude Code: Fix import structure - decouple error_handlers from app
Claude Code +1: Claude Opus 4.6- Remove module-level sys.path manipulation from error_handlers.py - Add register_error_handlers(app) function for explicit handler registration - Move sys.path setup to app.py where it belongs - This eliminates potential circular import issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3923b92 -
Claude Code: Restore entrypoint.sh to clean stale 'unknown' errors
Claude Code +1: Claude Opus 4.6- Dockerfile now uses entrypoint.sh instead of direct uvicorn - entrypoint.sh cleans stale 'unknown' errors from cain_status.json - This fixes the 'Error: unknown' display issue on HF Spaces Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1485017 -
Claude Code: Fix middleware import - use starlette instead of fastapi.middleware.base
Claude Code +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b620f47 -
Claude Code: Force Docker rebuild to fix fastapi.middleware.base import
Claude Code +1: Claude Opus 4.6- Minor comment update to trigger fresh Docker image build - requirements.txt already has fastapi>=0.104.0 and uvicorn[standard]>=0.24.0 - Dockerfile correctly installs from requirements.txt - The ModuleNotFoundError suggests stale cached Docker layers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1026301 -
Claude Code: Bypass entrypoint to expose raw Python traceback
Claude Code +1: Claude Opus 4.6Diagnose silent crash by running uvicorn directly instead of through entrypoint.sh, which redirects output to /app/logs/uvicorn.log. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8bbcf59
-
Claude Code: Fix container exit issue - log paths and restart loop
Claude Code0d0e2dd