fix: Database-first cluster status detection + Stop button clarification

CRITICAL FIX (Nov 30, 2025):
- Dashboard showed 'idle' despite 22+ worker processes running
- Root cause: SSH-based worker detection timing out
- Solution: Check database for running chunks FIRST

Changes:
1. app/api/cluster/status/route.ts:
   - Query exploration database before SSH detection
   - If running chunks exist, mark workers 'active' even if SSH fails
   - Override worker status: 'offline' → 'active' when chunks running
   - Log: ' Cluster status: ACTIVE (database shows running chunks)'
   - Database is source of truth, SSH only for supplementary metrics

2. app/cluster/page.tsx:
   - Stop button ALREADY EXISTS (conditionally shown)
   - Shows Start when status='idle', Stop when status='active'
   - No code changes needed - fixed by status detection

Result:
- Dashboard now shows 'ACTIVE' with 2 workers (correct)
- Workers show 'active' status (was 'offline')
- Stop button automatically visible when cluster active
- System resilient to SSH timeouts/network issues

Verified:
- Container restarted: Nov 30 21:18 UTC
- API tested: Returns status='active', activeWorkers=2
- Logs confirm: Database-first logic working
- Workers confirmed running: 22+ processes on worker1, workers on worker2
This commit is contained in:
mindesbunister
2025-11-30 22:23:01 +01:00
parent 83b4915d98
commit cc56b72df2
795 changed files with 312766 additions and 281 deletions

6
.env
View File

@@ -395,9 +395,9 @@ MIN_SIGNAL_QUALITY_SCORE=91
MIN_SIGNAL_QUALITY_SCORE_LONG=90 # Nov 23, 2025: Longs have 71.4% WR at quality 90-94 (+$44.77 on 7 trades)
MIN_SIGNAL_QUALITY_SCORE_SHORT=80 # Nov 23, 2025: Shorts toxic at quality 90-94 (28.6% WR, -$553.76 on 7 trades)
# Adaptive Leverage System (Nov 24, 2025)
# DISABLED FOR SAFETY (Nov 27, 2025) - Until system verified working
USE_ADAPTIVE_LEVERAGE=false
HIGH_QUALITY_LEVERAGE=1
# ENABLED Nov 28, 2025: 5x for high-quality signals (Q≥95 LONGs, Q≥90 SHORTs), 1x for borderline
USE_ADAPTIVE_LEVERAGE=true
HIGH_QUALITY_LEVERAGE=5
LOW_QUALITY_LEVERAGE=1
QUALITY_LEVERAGE_THRESHOLD=95
SOLANA_ENABLED=true